1 //------------------------------------------------------------------------------
2 // <copyright file="HttpCapabilitiesBase.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //------------------------------------------------------------------------------
8 * Base class for browser capabilities object: just a read-only dictionary
9 * holder that supports Init()
16 namespace System
.Web
.Configuration
{
18 using System
.Collections
;
19 using System
.Security
.Permissions
;
20 using System
.Text
.RegularExpressions
;
21 using System
.Globalization
;
22 using System
.Collections
.Specialized
;
23 using System
.Configuration
;
24 using System
.Diagnostics
;
26 using System
.Threading
;
27 using System
.Web
.Compilation
;
29 using System
.Web
.Util
;
30 using System
.Web
.UI
.Adapters
;
31 using Debug
=System
.Web
.Util
.Debug
;
34 * Abstract base class for Capabilities
36 public class HttpCapabilitiesBase
: IFilterResolutionService
{
38 #if !DONTUSEFACTORYGENERATOR
39 private static FactoryGenerator _controlAdapterFactoryGenerator
;
40 private static Hashtable _controlAdapterFactoryTable
;
41 private static object _staticLock
= new object();
42 #endif // DONTUSEFACTORYGENERATOR
43 private static object s_nullAdapterSingleton
= new object();
44 private bool _useOptimizedCacheKey
= true;
45 private static object _emptyHttpCapabilitiesBaseLock
= new object();
46 private static HttpCapabilitiesProvider _browserCapabilitiesProvider
= null;
48 private static HttpCapabilitiesBase _emptyHttpCapabilitiesBase
;
50 internal static HttpCapabilitiesBase EmptyHttpCapabilitiesBase
{
52 if (_emptyHttpCapabilitiesBase
!= null) {
53 return _emptyHttpCapabilitiesBase
;
56 lock (_emptyHttpCapabilitiesBaseLock
) {
57 if (_emptyHttpCapabilitiesBase
!= null) {
58 return _emptyHttpCapabilitiesBase
;
61 _emptyHttpCapabilitiesBase
= new HttpCapabilitiesBase();
64 return _emptyHttpCapabilitiesBase
;
68 public static HttpCapabilitiesProvider BrowserCapabilitiesProvider
{
70 return _browserCapabilitiesProvider
;
73 _browserCapabilitiesProvider
= value;
77 public bool UseOptimizedCacheKey
{
79 return _useOptimizedCacheKey
;
83 public void DisableOptimizedCacheKey() {
84 _useOptimizedCacheKey
= false;
88 // Public API for retrieving capabilities from config.
90 // Note that this API will return an empty HttpCapabilitiesBase
91 // if capabilties cannot be found.
93 [ConfigurationPermission(SecurityAction
.Assert
, Unrestricted
= true)]
94 public static HttpCapabilitiesBase
GetConfigCapabilities(string configKey
, HttpRequest request
) {
96 HttpCapabilitiesBase capabilities
= null;
98 if (configKey
== "system.web/browserCaps") {
99 // Use cached config for system.web/browserCaps
100 capabilities
= GetBrowserCapabilities(request
);
104 // Slower code path to get capabilities from any section
105 // that implements System.Web.Configuration.HttpCapabilitiesSectionHandler.
106 // This code path will hit a demand for ConfigurationPermission.
108 HttpCapabilitiesDefaultProvider capsbuilder
= (HttpCapabilitiesDefaultProvider
) request
.Context
.GetSection(configKey
);
109 if (capsbuilder
!= null) {
110 if (BrowserCapabilitiesProvider
!= null) {
111 capsbuilder
.BrowserCapabilitiesProvider
= BrowserCapabilitiesProvider
;
113 if (capsbuilder
.BrowserCapabilitiesProvider
== null) {
114 capabilities
= capsbuilder
.Evaluate(request
);
117 capabilities
= capsbuilder
.BrowserCapabilitiesProvider
.GetBrowserCapabilities(request
);
122 if (capabilities
== null) {
123 capabilities
= EmptyHttpCapabilitiesBase
;
130 // Get browser capabilities from config that are stored at "system.web/browserCaps".
132 // This code path will use the cached config object and avoid the demand for ConfigurationPermission
133 // after the first request for config.
135 // Note: this API will return null if the section isn't found.
137 internal static HttpBrowserCapabilities
GetBrowserCapabilities(HttpRequest request
) {
139 HttpCapabilitiesBase capabilities
= null;
141 // Get the config evaluator from the cached config object.
142 HttpCapabilitiesDefaultProvider capsbuilder
= request
.Context
.IsRuntimeErrorReported
?
143 RuntimeConfig
.GetLKGConfig(request
.Context
).BrowserCaps
: RuntimeConfig
.GetConfig(request
.Context
).BrowserCaps
;
144 if (capsbuilder
!= null) {
145 if (BrowserCapabilitiesProvider
!= null) {
146 capsbuilder
.BrowserCapabilitiesProvider
= BrowserCapabilitiesProvider
;
148 if (capsbuilder
.BrowserCapabilitiesProvider
== null) {
149 capabilities
= capsbuilder
.Evaluate(request
);
152 capabilities
= capsbuilder
.BrowserCapabilitiesProvider
.GetBrowserCapabilities(request
);
156 return (HttpBrowserCapabilities
) capabilities
;
160 * A Capabilities object is just a read-only dictionary
163 /// <para>Allows access to individual dictionary values.</para>
165 public virtual String
this[String key
] {
167 return (String
)_items
[key
];
171 public HtmlTextWriter
CreateHtmlTextWriter(TextWriter w
) {
172 string mtw
= HtmlTextWriter
;
173 if (mtw
!= null && mtw
.Length
!= 0) {
174 HtmlTextWriter writer
= null;
176 Type writerType
= BuildManager
.GetType(mtw
, true /* throwOnFail */, false /* ignoreCase */);
177 object[] arr
= new object[1];
179 writer
= (HtmlTextWriter
)Activator
.CreateInstance(writerType
, arr
);
180 if (writer
!= null) {
185 throw new Exception(SR
.GetString(SR
.Could_not_create_type_instance
, mtw
));
188 return CreateHtmlTextWriterInternal(w
);
191 internal HtmlTextWriter
CreateHtmlTextWriterInternal(TextWriter tw
) {
192 Type tagWriter
= TagWriter
;
193 if (tagWriter
!= null) {
194 return Page
.CreateHtmlTextWriterFromType(tw
, tagWriter
);
197 // Fall back to Html 3.2
198 return new Html32TextWriter(tw
);
202 * It provides an overridable Init method
207 protected virtual void Init() {
211 * The actual initializer sets up Item[] before calling Init()
214 internal void InitInternal(HttpBrowserCapabilities browserCaps
) {
215 if (_items
!= null) {
216 throw new ArgumentException(SR
.GetString(SR
.Caps_cannot_be_inited_twice
));
219 _items
= browserCaps
._items
;
220 _adapters
= browserCaps
._adapters
;
221 _browsers
= browserCaps
._browsers
;
222 _htmlTextWriter
= browserCaps
._htmlTextWriter
;
223 _useOptimizedCacheKey
= browserCaps
._useOptimizedCacheKey
;
228 internal ControlAdapter
GetAdapter(System
.Web
.UI
.Control control
) {
229 if (_adapters
== null || _adapters
.Count
== 0) {
233 if (control
== null) {
237 //see if we have already cached the type;
238 Type controlType
= control
.GetType();
239 object o
= AdapterTypes
[controlType
];
241 // Common desktop case: simply return null since we already tried to resolve the adapter.
242 if (object.ReferenceEquals(o
, s_nullAdapterSingleton
))
245 Type adapterType
= (Type
)o
;
246 if (adapterType
== null) {
247 Type tempControlType
= controlType
;
248 string controlTypename
= null;
249 string adapterTypename
= null;
251 while (adapterTypename
== null && tempControlType
!= typeof(Control
)) {
252 controlTypename
= tempControlType
.AssemblyQualifiedName
;
253 adapterTypename
= (string)Adapters
[controlTypename
];
255 if (adapterTypename
== null) {
256 controlTypename
= tempControlType
.FullName
;
257 adapterTypename
= (string)Adapters
[controlTypename
];
260 if (adapterTypename
!= null) {
264 tempControlType
= tempControlType
.BaseType
;
267 // Remember it so that we do not walk the control hierarchy again.
268 if (String
.IsNullOrEmpty(adapterTypename
)) {
269 AdapterTypes
[controlType
] = s_nullAdapterSingleton
;
273 //do not thrownOnFail or ignoreCase
274 adapterType
= BuildManager
.GetType(adapterTypename
, false, false);
275 if (adapterType
== null) {
276 throw new Exception(SR
.GetString(SR
.ControlAdapters_TypeNotFound
, adapterTypename
));
279 AdapterTypes
[controlType
] = adapterType
;
282 #if DONTUSEFACTORYGENERATOR
283 ControlAdapter adapter
= (ControlAdapter
) HttpRuntime
.CreatePublicInstance(adapterType
);
285 IWebObjectFactory factory
= GetAdapterFactory(adapterType
);
286 ControlAdapter adapter
= (ControlAdapter
)factory
.CreateInstance();
287 #endif // DONTUSEFACTORYGENERATOR
288 adapter
._control
= control
;
293 #if !DONTUSEFACTORYGENERATOR
294 private IWebObjectFactory
GetAdapterFactory(Type adapterType
) {
295 if (_controlAdapterFactoryGenerator
== null) {
297 if (_controlAdapterFactoryGenerator
== null) {
298 _controlAdapterFactoryTable
= new Hashtable();
299 _controlAdapterFactoryGenerator
= new FactoryGenerator();
304 IWebObjectFactory factory
= (IWebObjectFactory
)_controlAdapterFactoryTable
[adapterType
];
305 if (factory
== null) {
307 lock (_controlAdapterFactoryTable
.SyncRoot
) {
308 factory
= (IWebObjectFactory
)_controlAdapterFactoryTable
[adapterType
];
310 if (factory
== null) {
312 factory
= _controlAdapterFactoryGenerator
.CreateFactory(adapterType
);
315 throw new Exception(SR
.GetString(SR
.Could_not_create_type_instance
, adapterType
.ToString()));
318 _controlAdapterFactoryTable
[adapterType
] = factory
;
325 #endif // DONTUSEFACTORYGENERATOR
327 public IDictionary Capabilities
{
336 public IDictionary Adapters
{
338 if (_adapters
== null) {
340 if (_adapters
== null) {
341 _adapters
= new Hashtable(StringComparer
.OrdinalIgnoreCase
);
349 public string HtmlTextWriter
{
351 return _htmlTextWriter
;
354 _htmlTextWriter
= value;
358 private Hashtable AdapterTypes
{
360 if (_adapterTypes
== null) {
362 if (_adapterTypes
== null) {
363 _adapterTypes
= Hashtable
.Synchronized(new Hashtable());
367 return _adapterTypes
;
373 if (_browsers
!= null) {
374 return (string)_browsers
[_browsers
.Count
- 1];
376 else return String
.Empty
;
380 public ArrayList Browsers
{
386 Hashtable _adapterTypes
;
387 private IDictionary _adapters
;
388 private string _htmlTextWriter
;
389 private IDictionary _items
;
391 public Version ClrVersion
{
393 Version
[] clrVersions
= GetClrVersions();
394 if (clrVersions
!= null) {
395 return clrVersions
[clrVersions
.Length
- 1];
402 public Version
[] GetClrVersions() {
403 string ua
= HttpCapabilitiesDefaultProvider
.GetUserAgent(HttpContext
.Current
.Request
);
404 if (String
.IsNullOrEmpty(ua
)) {
408 // Adding timeout for Regex in case of malicious UA string causing DoS
409 Regex regex
= RegexUtil
.CreateRegex("\\.NET CLR (?'clrVersion'[0-9\\.]*)", RegexOptions
.None
);
410 MatchCollection matches
= regex
.Matches(ua
);
412 if (matches
.Count
== 0) {
413 return new Version
[1] { new Version() }
;
416 ArrayList versionList
= new ArrayList();
417 foreach (Match match
in matches
) {
419 Version version
= new Version(match
.Groups
["clrVersion"].Value
);
420 versionList
.Add(version
);
422 catch (System
.FormatException
) {
423 //got imvalid version data
428 return (Version
[])versionList
.ToArray(typeof(Version
));
434 _type
= this["type"];
441 public string Browser
{
444 _browser
= this["browser"];
451 public string Version
{
454 _version
= this["version"];
461 public int MajorVersion
{
463 if (!_havemajorversion
) {
465 _majorversion
= int.Parse(this["majorversion"], CultureInfo
.InvariantCulture
);
466 _havemajorversion
= true;
468 catch (FormatException e
) {
469 throw BuildParseError(e
, "majorversion");
472 return _majorversion
;
476 Exception
BuildParseError(Exception e
, string capsKey
) {
477 string message
= SR
.GetString(SR
.Invalid_string_from_browser_caps
, e
.Message
, capsKey
, this[capsKey
]);
479 // to show ConfigurationException in stack trace
480 ConfigurationErrorsException configEx
= new ConfigurationErrorsException(message
, e
);
482 // I want it to look like an unhandled exception
483 HttpUnhandledException httpUnhandledEx
= new HttpUnhandledException(null, null);
485 // but show message from outer exception (it normally shows the inner-most)
486 httpUnhandledEx
.SetFormatter(new UseLastUnhandledErrorFormatter(configEx
));
488 return httpUnhandledEx
;
491 bool CapsParseBoolDefault(string capsKey
, bool defaultValue
) {
492 string value = this[capsKey
];
498 return bool.Parse(value);
500 catch (FormatException
) {
505 bool CapsParseBool(string capsKey
) {
507 return bool.Parse(this[capsKey
]);
509 catch (FormatException e
) {
510 throw BuildParseError(e
, capsKey
);
514 public string MinorVersionString
{
516 return this["minorversion"];
520 public double MinorVersion
{
522 if (!_haveminorversion
) {
524 if (!_haveminorversion
)
530 _minorversion
= double.Parse(
531 this["minorversion"],
532 NumberStyles
.Float
| NumberStyles
.AllowDecimalPoint
,
533 NumberFormatInfo
.InvariantInfo
);
534 _haveminorversion
= true;
536 catch (FormatException e
)
538 // Check if there's more than one decimal
539 // The only exception case we handle is of form .4.1, it becomes .4
540 string minor
= this["minorversion"];
541 int firstDecimal
= minor
.IndexOf('.');
542 if (firstDecimal
!= -1)
544 int nextDecimal
= minor
.IndexOf('.', firstDecimal
+ 1);
545 if (nextDecimal
!= -1)
549 _minorversion
= double.Parse(
550 minor
.Substring(0, nextDecimal
),
551 NumberStyles
.Float
| NumberStyles
.AllowDecimalPoint
,
552 NumberFormatInfo
.InvariantInfo
);
553 Thread
.MemoryBarrier();
554 _haveminorversion
= true;
556 catch (FormatException
)
561 if (!_haveminorversion
)
563 throw BuildParseError(e
, "minorversion");
569 return _minorversion
;
573 public string Platform
{
575 if (!_haveplatform
) {
576 _platform
= this["platform"];
577 _haveplatform
= true;
583 public Type TagWriter
{
586 if (!_havetagwriter
) {
587 string tagWriter
= this["tagwriter"];
588 if (String
.IsNullOrEmpty(tagWriter
)) {
591 else if (string.Compare(tagWriter
, typeof(System
.Web
.UI
.HtmlTextWriter
).FullName
, StringComparison
.Ordinal
) == 0) {
592 _tagwriter
= typeof(System
.Web
.UI
.HtmlTextWriter
);
595 _tagwriter
= BuildManager
.GetType(tagWriter
, true /*throwOnError*/);
597 _havetagwriter
= true;
600 catch (Exception e
) {
601 throw BuildParseError(e
, "tagwriter");
607 public Version EcmaScriptVersion
{
609 if (!_haveecmascriptversion
) {
610 _ecmascriptversion
= new Version(this["ecmascriptversion"]);
611 _haveecmascriptversion
= true;
613 return _ecmascriptversion
;
617 public Version MSDomVersion
{
619 if (!_havemsdomversion
) {
620 _msdomversion
= new Version(this["msdomversion"]);
621 _havemsdomversion
= true;
623 return _msdomversion
;
627 public Version W3CDomVersion
{
629 if (!_havew3cdomversion
) {
630 _w3cdomversion
= new Version(this["w3cdomversion"]);
631 _havew3cdomversion
= true;
633 return _w3cdomversion
;
640 _beta
= CapsParseBool("beta");
647 public bool Crawler
{
650 _crawler
= CapsParseBool("crawler");
660 _aol
= CapsParseBool("aol");
670 _win16
= CapsParseBool("win16");
680 _win32
= CapsParseBool("win32");
690 _frames
= CapsParseBool("frames");
697 public bool RequiresControlStateInSession
{
699 if (!_haverequiresControlStateInSession
) {
700 if (this["requiresControlStateInSession"] != null) {
701 _requiresControlStateInSession
= CapsParseBoolDefault("requiresControlStateInSession", false);
703 _haverequiresControlStateInSession
= true;
705 return _requiresControlStateInSession
;
712 _tables
= CapsParseBool("tables");
719 public bool Cookies
{
722 _cookies
= CapsParseBool("cookies");
729 public bool VBScript
{
731 if (!_havevbscript
) {
732 _vbscript
= CapsParseBool("vbscript");
733 _havevbscript
= true;
739 [Obsolete("The recommended alternative is the EcmaScriptVersion property. A Major version value greater than or equal to 1 implies JavaScript support. http://go.microsoft.com/fwlink/?linkid=14202")]
740 public bool JavaScript
{
742 if (!_havejavascript
) {
743 _javascript
= CapsParseBool("javascript");
744 _havejavascript
= true;
750 public bool JavaApplets
{
752 if (!_havejavaapplets
) {
753 _javaapplets
= CapsParseBool("javaapplets");
754 _havejavaapplets
= true;
760 public Version JScriptVersion
{
762 if (!_havejscriptversion
) {
763 _jscriptversion
= new Version(this["jscriptversion"]);
764 _havejscriptversion
= true;
766 return _jscriptversion
;
770 public bool ActiveXControls
{
772 if (!_haveactivexcontrols
) {
773 _activexcontrols
= CapsParseBool("activexcontrols");
774 _haveactivexcontrols
= true;
776 return _activexcontrols
;
780 public bool BackgroundSounds
{
782 if (!_havebackgroundsounds
) {
783 _backgroundsounds
= CapsParseBool("backgroundsounds");
784 _havebackgroundsounds
= true;
786 return _backgroundsounds
;
793 _cdf
= CapsParseBool("cdf");
800 //previously in System.Web.Mobile
801 public virtual String MobileDeviceManufacturer
{
803 if (!_haveMobileDeviceManufacturer
) {
804 _mobileDeviceManufacturer
= this["mobileDeviceManufacturer"];
805 _haveMobileDeviceManufacturer
= true;
807 return _mobileDeviceManufacturer
;
812 public virtual String MobileDeviceModel
{
814 if (!_haveMobileDeviceModel
) {
815 _mobileDeviceModel
= this["mobileDeviceModel"];
816 _haveMobileDeviceModel
= true;
818 return _mobileDeviceModel
;
823 public virtual String GatewayVersion
{
825 if (!_haveGatewayVersion
) {
826 _gatewayVersion
= this["gatewayVersion"];
827 _haveGatewayVersion
= true;
829 return _gatewayVersion
;
834 public virtual int GatewayMajorVersion
{
836 if (!_haveGatewayMajorVersion
) {
837 _gatewayMajorVersion
= Convert
.ToInt32(this["gatewayMajorVersion"], CultureInfo
.InvariantCulture
);
838 _haveGatewayMajorVersion
= true;
840 return _gatewayMajorVersion
;
845 public virtual double GatewayMinorVersion
{
847 if (!_haveGatewayMinorVersion
) {
848 // The conversion below does not use Convert.ToDouble()
849 // because it depends on the current locale. So a german machine it would look for
850 // a comma as a seperator "1,5" where all user-agent strings use english
851 // decimal points "1.5". URT11176
853 _gatewayMinorVersion
= double.Parse(
854 this["gatewayMinorVersion"],
855 NumberStyles
.Float
| NumberStyles
.AllowDecimalPoint
,
856 NumberFormatInfo
.InvariantInfo
);
857 _haveGatewayMinorVersion
= true;
859 return _gatewayMinorVersion
;
863 public virtual String PreferredRenderingType
{
865 if (!_havePreferredRenderingType
) {
866 _preferredRenderingType
= this["preferredRenderingType"];
867 _havePreferredRenderingType
= true;
869 return _preferredRenderingType
;
874 public virtual String PreferredRequestEncoding
{
876 if (!_havePreferredRequestEncoding
) {
877 _preferredRequestEncoding
= this["preferredRequestEncoding"];
878 Thread
.MemoryBarrier();
879 _havePreferredRequestEncoding
= true;
881 return _preferredRequestEncoding
;
886 public virtual String PreferredResponseEncoding
{
888 if (!_havePreferredResponseEncoding
) {
889 _preferredResponseEncoding
= this["preferredResponseEncoding"];
890 _havePreferredResponseEncoding
= true;
892 return _preferredResponseEncoding
;
897 public virtual String PreferredRenderingMime
{
899 if (!_havePreferredRenderingMime
) {
900 _preferredRenderingMime
= this["preferredRenderingMime"];
901 _havePreferredRenderingMime
= true;
903 return _preferredRenderingMime
;
908 public virtual String PreferredImageMime
{
910 if (!_havePreferredImageMime
) {
911 _preferredImageMime
= this["preferredImageMime"];
912 _havePreferredImageMime
= true;
914 return _preferredImageMime
;
919 public virtual int ScreenCharactersWidth
{
921 if (!_haveScreenCharactersWidth
) {
922 if (this["screenCharactersWidth"] == null) {
923 // calculate from best partial information
925 int screenPixelsWidthToUse
= 640;
926 int characterWidthToUse
= 8;
928 if (this["screenPixelsWidth"] != null && this["characterWidth"] != null) {
929 screenPixelsWidthToUse
= Convert
.ToInt32(this["screenPixelsWidth"], CultureInfo
.InvariantCulture
);
930 characterWidthToUse
= Convert
.ToInt32(this["characterWidth"], CultureInfo
.InvariantCulture
);
932 else if (this["screenPixelsWidth"] != null) {
933 screenPixelsWidthToUse
= Convert
.ToInt32(this["screenPixelsWidth"], CultureInfo
.InvariantCulture
);
934 characterWidthToUse
= Convert
.ToInt32(this["defaultCharacterWidth"], CultureInfo
.InvariantCulture
);
936 else if (this["characterWidth"] != null) {
937 screenPixelsWidthToUse
= Convert
.ToInt32(this["defaultScreenPixelsWidth"], CultureInfo
.InvariantCulture
);
938 characterWidthToUse
= Convert
.ToInt32(this["characterWidth"], CultureInfo
.InvariantCulture
);
940 else if (this["defaultScreenCharactersWidth"] != null) {
941 screenPixelsWidthToUse
= Convert
.ToInt32(this["defaultScreenCharactersWidth"], CultureInfo
.InvariantCulture
);
942 characterWidthToUse
= 1;
945 _screenCharactersWidth
= screenPixelsWidthToUse
/ characterWidthToUse
;
948 _screenCharactersWidth
= Convert
.ToInt32(this["screenCharactersWidth"], CultureInfo
.InvariantCulture
);
950 _haveScreenCharactersWidth
= true;
952 return _screenCharactersWidth
;
957 public virtual int ScreenCharactersHeight
{
959 if (!_haveScreenCharactersHeight
) {
960 if (this["screenCharactersHeight"] == null) {
961 // calculate from best partial information
963 int screenPixelHeightToUse
= 480;
964 int characterHeightToUse
= 12;
966 if (this["screenPixelsHeight"] != null && this["characterHeight"] != null) {
967 screenPixelHeightToUse
= Convert
.ToInt32(this["screenPixelsHeight"], CultureInfo
.InvariantCulture
);
968 characterHeightToUse
= Convert
.ToInt32(this["characterHeight"], CultureInfo
.InvariantCulture
);
970 else if (this["screenPixelsHeight"] != null) {
971 screenPixelHeightToUse
= Convert
.ToInt32(this["screenPixelsHeight"], CultureInfo
.InvariantCulture
);
972 characterHeightToUse
= Convert
.ToInt32(this["defaultCharacterHeight"], CultureInfo
.InvariantCulture
);
974 else if (this["characterHeight"] != null) {
975 screenPixelHeightToUse
= Convert
.ToInt32(this["defaultScreenPixelsHeight"], CultureInfo
.InvariantCulture
);
976 characterHeightToUse
= Convert
.ToInt32(this["characterHeight"], CultureInfo
.InvariantCulture
);
978 else if (this["defaultScreenCharactersHeight"] != null) {
979 screenPixelHeightToUse
= Convert
.ToInt32(this["defaultScreenCharactersHeight"], CultureInfo
.InvariantCulture
);
980 characterHeightToUse
= 1;
983 _screenCharactersHeight
= screenPixelHeightToUse
/ characterHeightToUse
;
986 _screenCharactersHeight
= Convert
.ToInt32(this["screenCharactersHeight"], CultureInfo
.InvariantCulture
);
988 _haveScreenCharactersHeight
= true;
990 return _screenCharactersHeight
;
995 public virtual int ScreenPixelsWidth
{
997 if (!_haveScreenPixelsWidth
) {
998 if (this["screenPixelsWidth"] == null) {
999 // calculate from best partial information
1001 int screenCharactersWidthToUse
= 80;
1002 int characterWidthToUse
= 8;
1004 if (this["screenCharactersWidth"] != null && this["characterWidth"] != null) {
1005 screenCharactersWidthToUse
= Convert
.ToInt32(this["screenCharactersWidth"], CultureInfo
.InvariantCulture
);
1006 characterWidthToUse
= Convert
.ToInt32(this["characterWidth"], CultureInfo
.InvariantCulture
);
1008 else if (this["screenCharactersWidth"] != null) {
1009 screenCharactersWidthToUse
= Convert
.ToInt32(this["screenCharactersWidth"], CultureInfo
.InvariantCulture
);
1010 characterWidthToUse
= Convert
.ToInt32(this["defaultCharacterWidth"], CultureInfo
.InvariantCulture
);
1012 else if (this["characterWidth"] != null) {
1013 screenCharactersWidthToUse
= Convert
.ToInt32(this["defaultScreenCharactersWidth"], CultureInfo
.InvariantCulture
);
1014 characterWidthToUse
= Convert
.ToInt32(this["characterWidth"], CultureInfo
.InvariantCulture
);
1016 else if (this["defaultScreenPixelsWidth"] != null) {
1017 screenCharactersWidthToUse
= Convert
.ToInt32(this["defaultScreenPixelsWidth"], CultureInfo
.InvariantCulture
);
1018 characterWidthToUse
= 1;
1021 _screenPixelsWidth
= screenCharactersWidthToUse
* characterWidthToUse
;
1024 _screenPixelsWidth
= Convert
.ToInt32(this["screenPixelsWidth"], CultureInfo
.InvariantCulture
);
1026 _haveScreenPixelsWidth
= true;
1028 return _screenPixelsWidth
;
1033 public virtual int ScreenPixelsHeight
{
1035 if (!_haveScreenPixelsHeight
) {
1036 if (this["screenPixelsHeight"] == null) {
1037 int screenCharactersHeightToUse
= 480 / 12;
1038 int characterHeightToUse
= 12;
1040 if (this["screenCharactersHeight"] != null && this["characterHeight"] != null) {
1041 screenCharactersHeightToUse
= Convert
.ToInt32(this["screenCharactersHeight"], CultureInfo
.InvariantCulture
);
1042 characterHeightToUse
= Convert
.ToInt32(this["characterHeight"], CultureInfo
.InvariantCulture
);
1044 else if (this["screenCharactersHeight"] != null) {
1045 screenCharactersHeightToUse
= Convert
.ToInt32(this["screenCharactersHeight"], CultureInfo
.InvariantCulture
);
1046 characterHeightToUse
= Convert
.ToInt32(this["defaultCharacterHeight"], CultureInfo
.InvariantCulture
);
1048 else if (this["characterHeight"] != null) {
1049 screenCharactersHeightToUse
= Convert
.ToInt32(this["defaultScreenCharactersHeight"], CultureInfo
.InvariantCulture
);
1050 characterHeightToUse
= Convert
.ToInt32(this["characterHeight"], CultureInfo
.InvariantCulture
);
1052 else if (this["defaultScreenPixelsHeight"] != null) {
1053 screenCharactersHeightToUse
= Convert
.ToInt32(this["defaultScreenPixelsHeight"], CultureInfo
.InvariantCulture
);
1054 characterHeightToUse
= 1;
1057 _screenPixelsHeight
= screenCharactersHeightToUse
* characterHeightToUse
;
1060 _screenPixelsHeight
= Convert
.ToInt32(this["screenPixelsHeight"], CultureInfo
.InvariantCulture
);
1062 _haveScreenPixelsHeight
= true;
1064 return _screenPixelsHeight
;
1069 public virtual int ScreenBitDepth
{
1071 if (!_haveScreenBitDepth
) {
1072 _screenBitDepth
= Convert
.ToInt32(this["screenBitDepth"], CultureInfo
.InvariantCulture
);
1073 _haveScreenBitDepth
= true;
1075 return _screenBitDepth
;
1080 public virtual bool IsColor
{
1082 if (!_haveIsColor
) {
1083 String isColorString
= this["isColor"];
1084 if (isColorString
== null) {
1088 _isColor
= Convert
.ToBoolean(this["isColor"], CultureInfo
.InvariantCulture
);
1090 _haveIsColor
= true;
1097 public virtual String InputType
{
1099 if (!_haveInputType
) {
1100 _inputType
= this["inputType"];
1101 _haveInputType
= true;
1108 public virtual int NumberOfSoftkeys
{
1110 if (!_haveNumberOfSoftkeys
) {
1111 _numberOfSoftkeys
= Convert
.ToInt32(this["numberOfSoftkeys"], CultureInfo
.InvariantCulture
);
1112 _haveNumberOfSoftkeys
= true;
1114 return _numberOfSoftkeys
;
1119 public virtual int MaximumSoftkeyLabelLength
{
1121 if (!_haveMaximumSoftkeyLabelLength
) {
1122 _maximumSoftkeyLabelLength
= Convert
.ToInt32(this["maximumSoftkeyLabelLength"], CultureInfo
.InvariantCulture
);
1123 _haveMaximumSoftkeyLabelLength
= true;
1125 return _maximumSoftkeyLabelLength
;
1130 public virtual bool CanInitiateVoiceCall
{
1132 if (!_haveCanInitiateVoiceCall
) {
1133 _canInitiateVoiceCall
= CapsParseBoolDefault("canInitiateVoiceCall", false);
1134 _haveCanInitiateVoiceCall
= true;
1136 return _canInitiateVoiceCall
;
1141 public virtual bool CanSendMail
{
1143 if (!_haveCanSendMail
) {
1144 _canSendMail
= CapsParseBoolDefault("canSendMail", true);
1145 _haveCanSendMail
= true;
1147 return _canSendMail
;
1151 public virtual bool HasBackButton
{
1153 if (!_haveHasBackButton
) {
1154 _hasBackButton
= CapsParseBoolDefault("hasBackButton", true);
1155 _haveHasBackButton
= true;
1157 return _hasBackButton
;
1161 public virtual bool RendersWmlDoAcceptsInline
{
1163 if (!_haveRendersWmlDoAcceptsInline
) {
1164 _rendersWmlDoAcceptsInline
= CapsParseBoolDefault("rendersWmlDoAcceptsInline", true);
1165 _haveRendersWmlDoAcceptsInline
= true;
1167 return _rendersWmlDoAcceptsInline
;
1171 public virtual bool RendersWmlSelectsAsMenuCards
{
1173 if (!_haveRendersWmlSelectsAsMenuCards
) {
1174 _rendersWmlSelectsAsMenuCards
= CapsParseBoolDefault("rendersWmlSelectsAsMenuCards", false);
1175 _haveRendersWmlSelectsAsMenuCards
= true;
1177 return _rendersWmlSelectsAsMenuCards
;
1181 public virtual bool RendersBreaksAfterWmlAnchor
{
1183 if (!_haveRendersBreaksAfterWmlAnchor
) {
1184 _rendersBreaksAfterWmlAnchor
= CapsParseBoolDefault("rendersBreaksAfterWmlAnchor", true);
1185 _haveRendersBreaksAfterWmlAnchor
= true;
1187 return _rendersBreaksAfterWmlAnchor
;
1191 public virtual bool RendersBreaksAfterWmlInput
{
1193 if (!_haveRendersBreaksAfterWmlInput
) {
1194 _rendersBreaksAfterWmlInput
= CapsParseBoolDefault("rendersBreaksAfterWmlInput", true);
1195 _haveRendersBreaksAfterWmlInput
= true;
1197 return _rendersBreaksAfterWmlInput
;
1201 public virtual bool RendersBreakBeforeWmlSelectAndInput
{
1203 if (!_haveRendersBreakBeforeWmlSelectAndInput
) {
1204 _rendersBreakBeforeWmlSelectAndInput
= CapsParseBoolDefault("rendersBreakBeforeWmlSelectAndInput", false);
1205 _haveRendersBreakBeforeWmlSelectAndInput
= true;
1207 return _rendersBreakBeforeWmlSelectAndInput
;
1211 public virtual bool RequiresPhoneNumbersAsPlainText
{
1213 if (!_haveRequiresPhoneNumbersAsPlainText
) {
1214 _requiresPhoneNumbersAsPlainText
= CapsParseBoolDefault("requiresPhoneNumbersAsPlainText", false);
1215 _haveRequiresPhoneNumbersAsPlainText
= true;
1217 return _requiresPhoneNumbersAsPlainText
;
1221 public virtual bool RequiresUrlEncodedPostfieldValues
{
1223 if (!_haveRequiresUrlEncodedPostfieldValues
) {
1224 _requiresUrlEncodedPostfieldValues
= CapsParseBoolDefault("requiresUrlEncodedPostfieldValues", true);
1225 _haveRequiresUrlEncodedPostfieldValues
= true;
1227 return _requiresUrlEncodedPostfieldValues
;
1231 public virtual String RequiredMetaTagNameValue
{
1233 if (!_haveRequiredMetaTagNameValue
) {
1234 String
value = this["requiredMetaTagNameValue"];
1235 if (!String
.IsNullOrEmpty(value)) {
1236 _requiredMetaTagNameValue
= value;
1239 _requiredMetaTagNameValue
= null;
1241 _haveRequiredMetaTagNameValue
= true;
1243 return _requiredMetaTagNameValue
;
1247 public virtual bool RendersBreaksAfterHtmlLists
{
1249 if (!_haveRendersBreaksAfterHtmlLists
) {
1250 _rendersBreaksAfterHtmlLists
= CapsParseBoolDefault("rendersBreaksAfterHtmlLists", true);
1251 _haveRendersBreaksAfterHtmlLists
= true;
1253 return _rendersBreaksAfterHtmlLists
;
1257 public virtual bool RequiresUniqueHtmlInputNames
{
1259 if (!_haveRequiresUniqueHtmlInputNames
) {
1260 _requiresUniqueHtmlInputNames
= CapsParseBoolDefault("requiresUniqueHtmlInputNames", false);
1261 _haveRequiresUniqueHtmlInputNames
= true;
1263 return _requiresUniqueHtmlInputNames
;
1267 public virtual bool RequiresUniqueHtmlCheckboxNames
{
1269 if (!_haveRequiresUniqueHtmlCheckboxNames
) {
1270 _requiresUniqueHtmlCheckboxNames
= CapsParseBoolDefault("requiresUniqueHtmlCheckboxNames", false);
1271 _haveRequiresUniqueHtmlCheckboxNames
= true;
1273 return _requiresUniqueHtmlCheckboxNames
;
1277 public virtual bool SupportsCss
{
1279 if (!_haveSupportsCss
) {
1280 _supportsCss
= CapsParseBoolDefault("supportsCss", false);
1281 _haveSupportsCss
= true;
1283 return _supportsCss
;
1287 public virtual bool HidesRightAlignedMultiselectScrollbars
{
1289 if (!_haveHidesRightAlignedMultiselectScrollbars
) {
1290 _hidesRightAlignedMultiselectScrollbars
= CapsParseBoolDefault("hidesRightAlignedMultiselectScrollbars", false);
1291 _haveHidesRightAlignedMultiselectScrollbars
= true;
1293 return _hidesRightAlignedMultiselectScrollbars
;
1297 public virtual bool IsMobileDevice
{
1299 if (!_haveIsMobileDevice
) {
1300 _isMobileDevice
= CapsParseBoolDefault("isMobileDevice", false);
1301 _haveIsMobileDevice
= true;
1303 return _isMobileDevice
;
1307 public virtual bool RequiresAttributeColonSubstitution
{
1309 if (!_haveRequiresAttributeColonSubstitution
) {
1310 _requiresAttributeColonSubstitution
= CapsParseBoolDefault("requiresAttributeColonSubstitution", false);
1311 _haveRequiresAttributeColonSubstitution
= true;
1313 return _requiresAttributeColonSubstitution
;
1317 public virtual bool CanRenderOneventAndPrevElementsTogether
{
1319 if (!_haveCanRenderOneventAndPrevElementsTogether
) {
1320 _canRenderOneventAndPrevElementsTogether
= CapsParseBoolDefault("canRenderOneventAndPrevElementsTogether", true);
1321 _haveCanRenderOneventAndPrevElementsTogether
= true;
1323 return _canRenderOneventAndPrevElementsTogether
;
1327 public virtual bool CanRenderInputAndSelectElementsTogether
{
1329 if (!_haveCanRenderInputAndSelectElementsTogether
) {
1330 _canRenderInputAndSelectElementsTogether
= CapsParseBoolDefault("canRenderInputAndSelectElementsTogether", true);
1331 _haveCanRenderInputAndSelectElementsTogether
= true;
1333 return _canRenderInputAndSelectElementsTogether
;
1337 public virtual bool CanRenderAfterInputOrSelectElement
{
1339 if (!_haveCanRenderAfterInputOrSelectElement
) {
1340 _canRenderAfterInputOrSelectElement
= CapsParseBoolDefault("canRenderAfterInputOrSelectElement", true);
1341 _haveCanRenderAfterInputOrSelectElement
= true;
1343 return _canRenderAfterInputOrSelectElement
;
1347 public virtual bool CanRenderPostBackCards
{
1349 if (!_haveCanRenderPostBackCards
) {
1350 _canRenderPostBackCards
= CapsParseBoolDefault("canRenderPostBackCards", true);
1351 _haveCanRenderPostBackCards
= true;
1353 return _canRenderPostBackCards
;
1357 public virtual bool CanRenderMixedSelects
{
1359 if (!_haveCanRenderMixedSelects
) {
1360 _canRenderMixedSelects
= CapsParseBoolDefault("canRenderMixedSelects", true);
1361 _haveCanRenderMixedSelects
= true;
1363 return _canRenderMixedSelects
;
1367 public virtual bool CanCombineFormsInDeck
{
1369 if (!_haveCanCombineFormsInDeck
) {
1370 _canCombineFormsInDeck
= CapsParseBoolDefault("canCombineFormsInDeck", true);
1371 _haveCanCombineFormsInDeck
= true;
1373 return _canCombineFormsInDeck
;
1377 public virtual bool CanRenderSetvarZeroWithMultiSelectionList
{
1379 if (!_haveCanRenderSetvarZeroWithMultiSelectionList
) {
1380 _canRenderSetvarZeroWithMultiSelectionList
= CapsParseBoolDefault("canRenderSetvarZeroWithMultiSelectionList", true);
1381 _haveCanRenderSetvarZeroWithMultiSelectionList
= true;
1383 return _canRenderSetvarZeroWithMultiSelectionList
;
1387 public virtual bool SupportsImageSubmit
{
1389 if (!_haveSupportsImageSubmit
) {
1390 _supportsImageSubmit
= CapsParseBoolDefault("supportsImageSubmit", false);
1391 _haveSupportsImageSubmit
= true;
1393 return _supportsImageSubmit
;
1397 public virtual bool RequiresUniqueFilePathSuffix
{
1399 if (!_haveRequiresUniqueFilePathSuffix
) {
1400 _requiresUniqueFilePathSuffix
= CapsParseBoolDefault("requiresUniqueFilePathSuffix", false);
1401 _haveRequiresUniqueFilePathSuffix
= true;
1403 return _requiresUniqueFilePathSuffix
;
1407 public virtual bool RequiresNoBreakInFormatting
{
1409 if (!_haveRequiresNoBreakInFormatting
) {
1410 _requiresNoBreakInFormatting
= CapsParseBoolDefault("requiresNoBreakInFormatting", false);
1411 _haveRequiresNoBreakInFormatting
= true;
1413 return _requiresNoBreakInFormatting
;
1417 public virtual bool RequiresLeadingPageBreak
{
1419 if (!_haveRequiresLeadingPageBreak
) {
1420 _requiresLeadingPageBreak
= CapsParseBoolDefault("requiresLeadingPageBreak", false);
1421 _haveRequiresLeadingPageBreak
= true;
1423 return _requiresLeadingPageBreak
;
1427 public virtual bool SupportsSelectMultiple
{
1429 if (!_haveSupportsSelectMultiple
) {
1430 _supportsSelectMultiple
= CapsParseBoolDefault("supportsSelectMultiple", false);
1431 _haveSupportsSelectMultiple
= true;
1433 return _supportsSelectMultiple
;
1437 public /*new*/ virtual bool SupportsBold
{
1439 if (!_haveSupportsBold
) {
1440 _supportsBold
= CapsParseBoolDefault("supportsBold", true);
1441 _haveSupportsBold
= true;
1443 return _supportsBold
;
1447 public /*new*/ virtual bool SupportsItalic
{
1449 if (!_haveSupportsItalic
) {
1450 _supportsItalic
= CapsParseBoolDefault("supportsItalic", true);
1451 _haveSupportsItalic
= true;
1453 return _supportsItalic
;
1457 public virtual bool SupportsFontSize
{
1459 if (!_haveSupportsFontSize
) {
1460 _supportsFontSize
= CapsParseBoolDefault("supportsFontSize", false);
1461 _haveSupportsFontSize
= true;
1463 return _supportsFontSize
;
1467 public virtual bool SupportsFontName
{
1469 if (!_haveSupportsFontName
) {
1470 _supportsFontName
= CapsParseBoolDefault("supportsFontName", false);
1471 _haveSupportsFontName
= true;
1473 return _supportsFontName
;
1477 public virtual bool SupportsFontColor
{
1479 if (!_haveSupportsFontColor
) {
1480 _supportsFontColor
= CapsParseBoolDefault("supportsFontColor", false);
1481 _haveSupportsFontColor
= true;
1483 return _supportsFontColor
;
1487 public virtual bool SupportsBodyColor
{
1489 if (!_haveSupportsBodyColor
) {
1490 _supportsBodyColor
= CapsParseBoolDefault("supportsBodyColor", false);
1491 _haveSupportsBodyColor
= true;
1493 return _supportsBodyColor
;
1497 public virtual bool SupportsDivAlign
{
1499 if (!_haveSupportsDivAlign
) {
1500 _supportsDivAlign
= CapsParseBoolDefault("supportsDivAlign", false);
1501 _haveSupportsDivAlign
= true;
1503 return _supportsDivAlign
;
1507 public virtual bool SupportsDivNoWrap
{
1509 if (!_haveSupportsDivNoWrap
) {
1510 _supportsDivNoWrap
= CapsParseBoolDefault("supportsDivNoWrap", false);
1511 _haveSupportsDivNoWrap
= true;
1513 return _supportsDivNoWrap
;
1517 internal bool SupportsMaintainScrollPositionOnPostback
{
1519 if (!_haveSupportsMaintainScrollPositionOnPostback
) {
1520 _supportsMaintainScrollPositionOnPostback
= CapsParseBoolDefault("supportsMaintainScrollPositionOnPostback", false);
1521 _haveSupportsMaintainScrollPositionOnPostback
= true;
1523 return _supportsMaintainScrollPositionOnPostback
;
1527 public virtual bool RequiresContentTypeMetaTag
{
1529 if (!_haveRequiresContentTypeMetaTag
) {
1530 _requiresContentTypeMetaTag
= CapsParseBoolDefault("requiresContentTypeMetaTag", false);
1531 _haveRequiresContentTypeMetaTag
= true;
1533 return _requiresContentTypeMetaTag
;
1537 public virtual bool RequiresDBCSCharacter
{
1539 if (!_haveRequiresDBCSCharacter
) {
1540 _requiresDBCSCharacter
= CapsParseBoolDefault("requiresDBCSCharacter", false);
1541 _haveRequiresDBCSCharacter
= true;
1543 return _requiresDBCSCharacter
;
1547 public virtual bool RequiresHtmlAdaptiveErrorReporting
{
1549 if (!_haveRequiresHtmlAdaptiveErrorReporting
) {
1550 _requiresHtmlAdaptiveErrorReporting
= CapsParseBoolDefault("requiresHtmlAdaptiveErrorReporting", false);
1551 _haveRequiresHtmlAdaptiveErrorReporting
= true;
1553 return _requiresHtmlAdaptiveErrorReporting
;
1557 public virtual bool RequiresOutputOptimization
{
1559 if (!_haveRequiresOutputOptimization
) {
1560 _requiresOutputOptimization
= CapsParseBoolDefault("requiresOutputOptimization", false);
1561 _haveRequiresOutputOptimization
= true;
1563 return _requiresOutputOptimization
;
1567 public virtual bool SupportsAccesskeyAttribute
{
1569 if (!_haveSupportsAccesskeyAttribute
) {
1570 _supportsAccesskeyAttribute
= CapsParseBoolDefault("supportsAccesskeyAttribute", false);
1571 _haveSupportsAccesskeyAttribute
= true;
1573 return _supportsAccesskeyAttribute
;
1577 public virtual bool SupportsInputIStyle
{
1579 if (!_haveSupportsInputIStyle
) {
1580 _supportsInputIStyle
= CapsParseBoolDefault("supportsInputIStyle", false);
1581 _haveSupportsInputIStyle
= true;
1583 return _supportsInputIStyle
;
1587 public virtual bool SupportsInputMode
{
1589 if (!_haveSupportsInputMode
) {
1590 _supportsInputMode
= CapsParseBoolDefault("supportsInputMode", false);
1591 _haveSupportsInputMode
= true;
1593 return _supportsInputMode
;
1597 public virtual bool SupportsIModeSymbols
{
1599 if (!_haveSupportsIModeSymbols
) {
1600 _supportsIModeSymbols
= CapsParseBoolDefault("supportsIModeSymbols", false);
1601 _haveSupportsIModeSymbols
= true;
1603 return _supportsIModeSymbols
;
1607 public virtual bool SupportsJPhoneSymbols
{
1609 if (!_haveSupportsJPhoneSymbols
) {
1610 _supportsJPhoneSymbols
= CapsParseBoolDefault("supportsJPhoneSymbols", false);
1611 _haveSupportsJPhoneSymbols
= true;
1613 return _supportsJPhoneSymbols
;
1617 public virtual bool SupportsJPhoneMultiMediaAttributes
{
1619 if (!_haveSupportsJPhoneMultiMediaAttributes
) {
1620 _supportsJPhoneMultiMediaAttributes
= CapsParseBoolDefault("supportsJPhoneMultiMediaAttributes", false);
1621 _haveSupportsJPhoneMultiMediaAttributes
= true;
1623 return _supportsJPhoneMultiMediaAttributes
;
1627 public virtual int MaximumRenderedPageSize
{
1629 if (!_haveMaximumRenderedPageSize
) {
1630 _maximumRenderedPageSize
= Convert
.ToInt32(this["maximumRenderedPageSize"], CultureInfo
.InvariantCulture
);
1631 _haveMaximumRenderedPageSize
= true;
1633 return _maximumRenderedPageSize
;
1637 public virtual bool RequiresSpecialViewStateEncoding
{
1639 if (!_haveRequiresSpecialViewStateEncoding
) {
1640 _requiresSpecialViewStateEncoding
= CapsParseBoolDefault("requiresSpecialViewStateEncoding", false);
1641 _haveRequiresSpecialViewStateEncoding
= true;
1643 return _requiresSpecialViewStateEncoding
;
1647 public virtual bool SupportsQueryStringInFormAction
{
1649 if (!_haveSupportsQueryStringInFormAction
) {
1650 _supportsQueryStringInFormAction
= CapsParseBoolDefault("supportsQueryStringInFormAction", true);
1651 _haveSupportsQueryStringInFormAction
= true;
1653 return _supportsQueryStringInFormAction
;
1657 public virtual bool SupportsCacheControlMetaTag
{
1659 if (!_haveSupportsCacheControlMetaTag
) {
1660 _supportsCacheControlMetaTag
= CapsParseBoolDefault("supportsCacheControlMetaTag", true);
1661 _haveSupportsCacheControlMetaTag
= true;
1663 return _supportsCacheControlMetaTag
;
1667 public virtual bool SupportsUncheck
{
1669 if (!_haveSupportsUncheck
) {
1670 _supportsUncheck
= CapsParseBoolDefault("supportsUncheck", true);
1671 _haveSupportsUncheck
= true;
1673 return _supportsUncheck
;
1677 public virtual bool CanRenderEmptySelects
{
1679 if (!_haveCanRenderEmptySelects
) {
1680 _canRenderEmptySelects
= CapsParseBoolDefault("canRenderEmptySelects", true);
1681 _haveCanRenderEmptySelects
= true;
1683 return _canRenderEmptySelects
;
1687 public virtual bool SupportsRedirectWithCookie
{
1689 if (!_haveSupportsRedirectWithCookie
) {
1690 _supportsRedirectWithCookie
= CapsParseBoolDefault("supportsRedirectWithCookie", true);
1691 _haveSupportsRedirectWithCookie
= true;
1693 return _supportsRedirectWithCookie
;
1697 public virtual bool SupportsEmptyStringInCookieValue
{
1699 if (!_haveSupportsEmptyStringInCookieValue
) {
1700 _supportsEmptyStringInCookieValue
= CapsParseBoolDefault("supportsEmptyStringInCookieValue", true);
1701 _haveSupportsEmptyStringInCookieValue
= true;
1703 return _supportsEmptyStringInCookieValue
;
1707 public virtual int DefaultSubmitButtonLimit
{
1709 if (!_haveDefaultSubmitButtonLimit
) {
1710 String s
= this["defaultSubmitButtonLimit"];
1711 _defaultSubmitButtonLimit
= s
!= null ? Convert
.ToInt32(this["defaultSubmitButtonLimit"], CultureInfo
.InvariantCulture
) : 1;
1712 _haveDefaultSubmitButtonLimit
= true;
1714 return _defaultSubmitButtonLimit
;
1718 public virtual bool SupportsXmlHttp
{
1720 if (!_haveSupportsXmlHttp
) {
1721 _supportsXmlHttp
= CapsParseBoolDefault("supportsXmlHttp", false);
1722 _haveSupportsXmlHttp
= true;
1724 return _supportsXmlHttp
;
1728 public virtual bool SupportsCallback
{
1730 if (!_haveSupportsCallback
) {
1731 _supportsCallback
= CapsParseBoolDefault("supportsCallback", false);
1732 _haveSupportsCallback
= true;
1734 return _supportsCallback
;
1738 public virtual int MaximumHrefLength
{
1740 if (!_haveMaximumHrefLength
) {
1741 _maximumHrefLength
= Convert
.ToInt32(this["maximumHrefLength"], CultureInfo
.InvariantCulture
);
1742 _haveMaximumHrefLength
= true;
1744 return _maximumHrefLength
;
1748 public bool IsBrowser(string browserName
) {
1749 if (String
.IsNullOrEmpty(browserName
)) {
1753 if (_browsers
== null) {
1757 for (int i
= 0; i
< _browsers
.Count
; i
++) {
1758 if (String
.Equals(browserName
, (string)_browsers
[i
], StringComparison
.OrdinalIgnoreCase
)) {
1766 public void AddBrowser(string browserName
) {
1767 if (_browsers
== null) {
1768 lock (_staticLock
) {
1769 if (_browsers
== null) {
1770 _browsers
= new ArrayList(6);
1774 _browsers
.Add(browserName
.ToLower(CultureInfo
.InvariantCulture
));
1777 private ArrayList _browsers
;
1779 volatile private string _type
;
1780 volatile private string _browser
;
1781 volatile private string _version
;
1782 volatile private int _majorversion
;
1783 private double _minorversion
;
1784 volatile private string _platform
;
1785 volatile private Type _tagwriter
;
1786 volatile private Version _ecmascriptversion
;
1787 volatile private Version _jscriptversion
;
1788 volatile private Version _msdomversion
;
1789 volatile private Version _w3cdomversion
;
1791 volatile private bool _beta
;
1792 volatile private bool _crawler
;
1793 volatile private bool _aol
;
1794 volatile private bool _win16
;
1795 volatile private bool _win32
;
1796 volatile private bool _requiresControlStateInSession
;
1798 volatile private bool _frames
;
1799 //private bool _supportsbold;
1800 //private bool _supportsitalic;
1801 volatile private bool _tables
;
1802 volatile private bool _cookies
;
1803 volatile private bool _vbscript
;
1804 volatile private bool _javascript
;
1805 volatile private bool _javaapplets
;
1806 volatile private bool _activexcontrols
;
1807 volatile private bool _backgroundsounds
;
1808 volatile private bool _cdf
;
1810 volatile private bool _havetype
;
1811 volatile private bool _havebrowser
;
1812 volatile private bool _haveversion
;
1813 volatile private bool _havemajorversion
;
1814 volatile private bool _haveminorversion
;
1815 volatile private bool _haveplatform
;
1816 volatile private bool _havetagwriter
;
1817 volatile private bool _haveecmascriptversion
;
1818 volatile private bool _havemsdomversion
;
1819 volatile private bool _havew3cdomversion
;
1821 volatile private bool _havebeta
;
1822 volatile private bool _havecrawler
;
1823 volatile private bool _haveaol
;
1824 volatile private bool _havewin16
;
1825 volatile private bool _havewin32
;
1827 volatile private bool _haveframes
;
1828 volatile private bool _haverequiresControlStateInSession
;
1829 //private bool _havesupportsbold;
1830 //private bool _havesupportsitalic;
1831 volatile private bool _havetables
;
1832 volatile private bool _havecookies
;
1833 volatile private bool _havevbscript
;
1834 volatile private bool _havejavascript
;
1835 volatile private bool _havejavaapplets
;
1836 volatile private bool _haveactivexcontrols
;
1837 volatile private bool _havebackgroundsounds
;
1838 volatile private bool _havecdf
;
1840 //previously in System.Web.Mobile
1841 volatile private String _mobileDeviceManufacturer
;
1842 volatile private String _mobileDeviceModel
;
1843 volatile private String _gatewayVersion
;
1844 volatile private int _gatewayMajorVersion
;
1845 private double _gatewayMinorVersion
;
1846 volatile private String _preferredRenderingType
; //
1847 volatile private String _preferredRenderingMime
;
1848 volatile private String _preferredImageMime
;
1849 volatile private String _requiredMetaTagNameValue
;
1850 volatile private String _preferredRequestEncoding
;
1851 volatile private String _preferredResponseEncoding
;
1852 volatile private int _screenCharactersWidth
;
1853 volatile private int _screenCharactersHeight
;
1854 volatile private int _screenPixelsWidth
;
1855 volatile private int _screenPixelsHeight
;
1856 volatile private int _screenBitDepth
;
1857 volatile private bool _isColor
;
1858 volatile private String _inputType
;
1859 volatile private int _numberOfSoftkeys
;
1860 volatile private int _maximumSoftkeyLabelLength
;
1861 volatile private bool _canInitiateVoiceCall
;
1862 volatile private bool _canSendMail
;
1863 volatile private bool _hasBackButton
;
1865 volatile private bool _rendersWmlDoAcceptsInline
;
1866 volatile private bool _rendersWmlSelectsAsMenuCards
;
1867 volatile private bool _rendersBreaksAfterWmlAnchor
;
1868 volatile private bool _rendersBreaksAfterWmlInput
;
1869 volatile private bool _rendersBreakBeforeWmlSelectAndInput
;
1870 volatile private bool _requiresPhoneNumbersAsPlainText
;
1871 volatile private bool _requiresAttributeColonSubstitution
;
1872 volatile private bool _requiresUrlEncodedPostfieldValues
;
1873 volatile private bool _rendersBreaksAfterHtmlLists
;
1874 volatile private bool _requiresUniqueHtmlCheckboxNames
;
1875 volatile private bool _requiresUniqueHtmlInputNames
;
1876 volatile private bool _supportsCss
;
1877 volatile private bool _hidesRightAlignedMultiselectScrollbars
;
1878 volatile private bool _isMobileDevice
;
1879 volatile private bool _canRenderOneventAndPrevElementsTogether
;
1880 volatile private bool _canRenderInputAndSelectElementsTogether
;
1881 volatile private bool _canRenderAfterInputOrSelectElement
;
1882 volatile private bool _canRenderPostBackCards
;
1883 volatile private bool _canRenderMixedSelects
;
1884 volatile private bool _canCombineFormsInDeck
;
1885 volatile private bool _canRenderSetvarZeroWithMultiSelectionList
;
1886 volatile private bool _supportsImageSubmit
;
1887 volatile private bool _requiresUniqueFilePathSuffix
;
1888 volatile private bool _requiresNoBreakInFormatting
;
1889 volatile private bool _requiresLeadingPageBreak
;
1890 volatile private bool _supportsSelectMultiple
;
1891 volatile private bool _supportsBold
;
1892 volatile private bool _supportsItalic
;
1893 volatile private bool _supportsFontSize
;
1894 volatile private bool _supportsFontName
;
1895 volatile private bool _supportsFontColor
;
1896 volatile private bool _supportsBodyColor
;
1897 volatile private bool _supportsDivAlign
;
1898 volatile private bool _supportsDivNoWrap
;
1899 volatile private bool _requiresHtmlAdaptiveErrorReporting
;
1900 volatile private bool _requiresContentTypeMetaTag
;
1901 volatile private bool _requiresDBCSCharacter
;
1902 volatile private bool _requiresOutputOptimization
;
1903 volatile private bool _supportsAccesskeyAttribute
;
1904 volatile private bool _supportsInputIStyle
;
1905 volatile private bool _supportsInputMode
;
1906 volatile private bool _supportsIModeSymbols
;
1907 volatile private bool _supportsJPhoneSymbols
;
1908 volatile private bool _supportsJPhoneMultiMediaAttributes
;
1909 volatile private int _maximumRenderedPageSize
;
1910 volatile private bool _requiresSpecialViewStateEncoding
;
1911 volatile private bool _supportsQueryStringInFormAction
;
1912 volatile private bool _supportsCacheControlMetaTag
;
1913 volatile private bool _supportsUncheck
;
1914 volatile private bool _canRenderEmptySelects
;
1915 volatile private bool _supportsRedirectWithCookie
;
1916 volatile private bool _supportsEmptyStringInCookieValue
;
1917 volatile private int _defaultSubmitButtonLimit
;
1918 volatile private bool _supportsXmlHttp
;
1919 volatile private bool _supportsCallback
;
1920 volatile private bool _supportsMaintainScrollPositionOnPostback
;
1921 volatile private int _maximumHrefLength
;
1923 volatile private bool _haveMobileDeviceManufacturer
;
1924 volatile private bool _haveMobileDeviceModel
;
1925 volatile private bool _haveGatewayVersion
;
1926 volatile private bool _haveGatewayMajorVersion
;
1927 volatile private bool _haveGatewayMinorVersion
;
1928 volatile private bool _havePreferredRenderingType
;
1929 volatile private bool _havePreferredRenderingMime
;
1930 volatile private bool _havePreferredImageMime
;
1931 volatile private bool _havePreferredRequestEncoding
;
1932 volatile private bool _havePreferredResponseEncoding
;
1933 volatile private bool _haveScreenCharactersWidth
;
1934 volatile private bool _haveScreenCharactersHeight
;
1935 volatile private bool _haveScreenPixelsWidth
;
1936 volatile private bool _haveScreenPixelsHeight
;
1937 volatile private bool _haveScreenBitDepth
;
1938 volatile private bool _haveIsColor
;
1939 volatile private bool _haveInputType
;
1940 volatile private bool _haveNumberOfSoftkeys
;
1941 volatile private bool _haveMaximumSoftkeyLabelLength
;
1942 volatile private bool _haveCanInitiateVoiceCall
;
1943 volatile private bool _haveCanSendMail
;
1944 volatile private bool _haveHasBackButton
;
1945 volatile private bool _haveRendersWmlDoAcceptsInline
;
1946 volatile private bool _haveRendersWmlSelectsAsMenuCards
;
1947 volatile private bool _haveRendersBreaksAfterWmlAnchor
;
1948 volatile private bool _haveRendersBreaksAfterWmlInput
;
1949 volatile private bool _haveRendersBreakBeforeWmlSelectAndInput
;
1950 volatile private bool _haveRequiresPhoneNumbersAsPlainText
;
1951 volatile private bool _haveRequiresUrlEncodedPostfieldValues
;
1952 volatile private bool _haveRequiredMetaTagNameValue
;
1953 volatile private bool _haveRendersBreaksAfterHtmlLists
;
1954 volatile private bool _haveRequiresUniqueHtmlCheckboxNames
;
1955 volatile private bool _haveRequiresUniqueHtmlInputNames
;
1956 volatile private bool _haveSupportsCss
;
1957 volatile private bool _haveHidesRightAlignedMultiselectScrollbars
;
1958 volatile private bool _haveIsMobileDevice
;
1959 volatile private bool _haveCanRenderOneventAndPrevElementsTogether
;
1960 volatile private bool _haveCanRenderInputAndSelectElementsTogether
;
1961 volatile private bool _haveCanRenderAfterInputOrSelectElement
;
1962 volatile private bool _haveCanRenderPostBackCards
;
1963 volatile private bool _haveCanCombineFormsInDeck
;
1964 volatile private bool _haveCanRenderMixedSelects
;
1965 volatile private bool _haveCanRenderSetvarZeroWithMultiSelectionList
;
1966 volatile private bool _haveSupportsImageSubmit
;
1967 volatile private bool _haveRequiresUniqueFilePathSuffix
;
1968 volatile private bool _haveRequiresNoBreakInFormatting
;
1969 volatile private bool _haveRequiresLeadingPageBreak
;
1970 volatile private bool _haveSupportsSelectMultiple
;
1971 volatile private bool _haveRequiresAttributeColonSubstitution
;
1972 volatile private bool _haveRequiresHtmlAdaptiveErrorReporting
;
1973 volatile private bool _haveRequiresContentTypeMetaTag
;
1974 volatile private bool _haveRequiresDBCSCharacter
;
1975 volatile private bool _haveRequiresOutputOptimization
;
1976 volatile private bool _haveSupportsAccesskeyAttribute
;
1977 volatile private bool _haveSupportsInputIStyle
;
1978 volatile private bool _haveSupportsInputMode
;
1979 volatile private bool _haveSupportsIModeSymbols
;
1980 volatile private bool _haveSupportsJPhoneSymbols
;
1981 volatile private bool _haveSupportsJPhoneMultiMediaAttributes
;
1982 volatile private bool _haveSupportsRedirectWithCookie
;
1983 volatile private bool _haveSupportsEmptyStringInCookieValue
= false;
1985 volatile private bool _haveSupportsBold
;
1986 volatile private bool _haveSupportsItalic
;
1987 volatile private bool _haveSupportsFontSize
;
1988 volatile private bool _haveSupportsFontName
;
1989 volatile private bool _haveSupportsFontColor
;
1990 volatile private bool _haveSupportsBodyColor
;
1991 volatile private bool _haveSupportsDivAlign
;
1992 volatile private bool _haveSupportsDivNoWrap
;
1993 volatile private bool _haveMaximumRenderedPageSize
;
1994 volatile private bool _haveRequiresSpecialViewStateEncoding
;
1995 volatile private bool _haveSupportsQueryStringInFormAction
;
1996 volatile private bool _haveSupportsCacheControlMetaTag
;
1997 volatile private bool _haveSupportsUncheck
;
1998 volatile private bool _haveCanRenderEmptySelects
;
1999 volatile private bool _haveDefaultSubmitButtonLimit
;
2000 volatile private bool _haveSupportsXmlHttp
;
2001 volatile private bool _haveSupportsCallback
;
2002 volatile private bool _haveSupportsMaintainScrollPositionOnPostback
;
2003 volatile private bool _haveMaximumHrefLength
;
2004 volatile private bool _havejscriptversion
;
2006 #region IFilterResolutionService implementation
2009 bool IFilterResolutionService
.EvaluateFilter(string filterName
) {
2010 return IsBrowser(filterName
);
2014 int IFilterResolutionService
.CompareFilters(string filter1
, string filter2
) {
2015 return BrowserCapabilitiesCompiler
.BrowserCapabilitiesFactory
.CompareFilters(filter1
, filter2
);