+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
/* System.Web.UI\r
* Authors\r
* Leen Toelen (toelen@hotmail.com)\r
public class HtmlTextWriter : System.IO.TextWriter {\r
\r
static HtmlTextWriter(){\r
- HtmlTextWriter._tagKeyLookupTable = new Hashtable(97);\r
+ HtmlTextWriter._tagKeyLookupTable = new Hashtable(97,CaseInsensitiveHashCodeProvider.Default,\r
+ CaseInsensitiveComparer.Default);\r
HtmlTextWriter._tagNameLookupArray = new TagInformation[97];\r
HtmlTextWriter.RegisterTag("", HtmlTextWriterTag.Unknown, TagType.Other);\r
HtmlTextWriter.RegisterTag("a", HtmlTextWriterTag.A, TagType.Inline);\r
HtmlTextWriter.RegisterTag("wbr", HtmlTextWriterTag.Wbr, TagType.NonClosing);\r
HtmlTextWriter.RegisterTag("xml", HtmlTextWriterTag.Xml, TagType.Other);\r
\r
- HtmlTextWriter._attrKeyLookupTable = new Hashtable(40);\r
+ HtmlTextWriter._attrKeyLookupTable = new Hashtable(40,CaseInsensitiveHashCodeProvider.Default,\r
+ CaseInsensitiveComparer.Default);\r
HtmlTextWriter._attrNameLookupArray = new AttributeInformation[40];\r
HtmlTextWriter.RegisterAttribute("accesskey", HtmlTextWriterAttribute.Accesskey, true);\r
HtmlTextWriter.RegisterAttribute("align", HtmlTextWriterAttribute.Align, false);\r
HtmlTextWriter.RegisterAttribute("width", HtmlTextWriterAttribute.Width, false);\r
HtmlTextWriter.RegisterAttribute("wrap", HtmlTextWriterAttribute.Wrap, false);\r
\r
- HtmlTextWriter._styleKeyLookupTable = new Hashtable(14);\r
+#if NET_2_0\r
+ HtmlTextWriter._styleNameLookupArray = new String[42];\r
+#else\r
HtmlTextWriter._styleNameLookupArray = new String[14];\r
+#endif\r
+ HtmlTextWriter._styleKeyLookupTable = new Hashtable (HtmlTextWriter._styleNameLookupArray.Length,\r
+ CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);\r
HtmlTextWriter.RegisterStyle("background-color", HtmlTextWriterStyle.BackgroundColor);\r
HtmlTextWriter.RegisterStyle("background-image", HtmlTextWriterStyle.BackgroundImage);\r
HtmlTextWriter.RegisterStyle("border-collapse", HtmlTextWriterStyle.BorderCollapse);\r
HtmlTextWriter.RegisterStyle("height", HtmlTextWriterStyle.Height);\r
HtmlTextWriter.RegisterStyle("text-decoration", HtmlTextWriterStyle.TextDecoration);\r
HtmlTextWriter.RegisterStyle("width", HtmlTextWriterStyle.Width);\r
+#if NET_2_0\r
+ HtmlTextWriter.RegisterStyle("list-style-image", HtmlTextWriterStyle.ListStyleImage);\r
+ HtmlTextWriter.RegisterStyle("list-style-type", HtmlTextWriterStyle.ListStyleType);\r
+ HtmlTextWriter.RegisterStyle("cursor", HtmlTextWriterStyle.Cursor);\r
+ HtmlTextWriter.RegisterStyle("direction", HtmlTextWriterStyle.Direction);\r
+ HtmlTextWriter.RegisterStyle("display", HtmlTextWriterStyle.Display);\r
+ HtmlTextWriter.RegisterStyle("filter", HtmlTextWriterStyle.Filter);\r
+ HtmlTextWriter.RegisterStyle("font-variant", HtmlTextWriterStyle.FontVariant);\r
+ HtmlTextWriter.RegisterStyle("left", HtmlTextWriterStyle.Left);\r
+ HtmlTextWriter.RegisterStyle("margin", HtmlTextWriterStyle.Margin);\r
+ HtmlTextWriter.RegisterStyle("margin-bottom", HtmlTextWriterStyle.MarginBottom);\r
+ HtmlTextWriter.RegisterStyle("margin-left", HtmlTextWriterStyle.MarginLeft);\r
+ HtmlTextWriter.RegisterStyle("margin-right", HtmlTextWriterStyle.MarginRight);\r
+ HtmlTextWriter.RegisterStyle("margin-top", HtmlTextWriterStyle.MarginTop);\r
+ HtmlTextWriter.RegisterStyle("overflow", HtmlTextWriterStyle.Overflow);\r
+ HtmlTextWriter.RegisterStyle("overflow-x", HtmlTextWriterStyle.OverflowX);\r
+ HtmlTextWriter.RegisterStyle("overflow-y", HtmlTextWriterStyle.OverflowY);\r
+ HtmlTextWriter.RegisterStyle("padding", HtmlTextWriterStyle.Padding);\r
+ HtmlTextWriter.RegisterStyle("padding-bottom", HtmlTextWriterStyle.PaddingBottom);\r
+ HtmlTextWriter.RegisterStyle("padding-left", HtmlTextWriterStyle.PaddingLeft);\r
+ HtmlTextWriter.RegisterStyle("padding-right", HtmlTextWriterStyle.PaddingRight);\r
+ HtmlTextWriter.RegisterStyle("padding-top", HtmlTextWriterStyle.PaddingTop);\r
+ HtmlTextWriter.RegisterStyle("position", HtmlTextWriterStyle.Position);\r
+ HtmlTextWriter.RegisterStyle("text-align", HtmlTextWriterStyle.TextAlign);\r
+ HtmlTextWriter.RegisterStyle("text-overflow", HtmlTextWriterStyle.TextOverflow);\r
+ HtmlTextWriter.RegisterStyle("top", HtmlTextWriterStyle.Top);\r
+ HtmlTextWriter.RegisterStyle("visibility", HtmlTextWriterStyle.Visibility);\r
+ HtmlTextWriter.RegisterStyle("white-space", HtmlTextWriterStyle.WhiteSpace);\r
+ HtmlTextWriter.RegisterStyle("z-index", HtmlTextWriterStyle.ZIndex);\r
+#endif\r
}\r
\r
public HtmlTextWriter(TextWriter writer):this(writer, " "){}\r
\r
protected HtmlTextWriterAttribute GetAttributeKey(string attrName){\r
if (attrName != null && attrName.Length > 0) {\r
- object attr = HtmlTextWriter._attrKeyLookupTable[attrName.ToLower()];\r
+ object attr = HtmlTextWriter._attrKeyLookupTable[attrName];\r
if (attr != null)\r
return (HtmlTextWriterAttribute) attr;\r
}\r
\r
protected HtmlTextWriterStyle GetStyleKey(string styleName){\r
if (styleName != null && styleName.Length > 0) {\r
- object style = HtmlTextWriter._styleKeyLookupTable[styleName.ToLower()];\r
+ object style = HtmlTextWriter._styleKeyLookupTable[styleName];\r
if (style != null)\r
return (HtmlTextWriterStyle) style;\r
}\r
}\r
\r
protected string GetStyleName(HtmlTextWriterStyle styleKey){\r
+ return StaticGetStyleName (styleKey);\r
+}\r
+\r
+internal static string StaticGetStyleName (HtmlTextWriterStyle styleKey){\r
if ((int) styleKey >= 0 && (int) styleKey < HtmlTextWriter._styleNameLookupArray.Length)\r
return HtmlTextWriter._styleNameLookupArray[(int) styleKey];\r
return System.String.Empty;\r
\r
protected virtual HtmlTextWriterTag GetTagKey(string tagName){\r
if (tagName != null && tagName.Length > 0) {\r
- object tag = HtmlTextWriter._tagKeyLookupTable[tagName.ToLower()];\r
+ object tag = HtmlTextWriter._tagKeyLookupTable[tagName];\r
if (tag != null)\r
return (HtmlTextWriterTag) tag;\r
}\r
return false;\r
}\r
\r
-protected bool IsAttributeDefined(HtmlTextWriterAttribute key, ref string value){\r
+protected bool IsAttributeDefined(HtmlTextWriterAttribute key, out string value){\r
value = null;\r
for (int i=0; i < _attrCount; i++) {\r
if (_attrList[i].key == key) {\r
return false;\r
}\r
\r
-protected bool IsStyleAttributeDefined(HtmlTextWriterStyle key, ref string value){\r
+protected bool IsStyleAttributeDefined(HtmlTextWriterStyle key, out string value){\r
value = null;\r
for( int i=0; i < _styleCount; i++) {\r
if (_styleList[i].key == key) {\r
}\r
}\r
TagInformation currentTag = HtmlTextWriter._tagNameLookupArray[_tagIndex];\r
+ if (currentTag.closingTag == null && currentTag.tagType == TagType.Other) {\r
+ currentTag.closingTag = EndTagLeftChars + _tagName + TagRightChar;\r
+ }\r
+\r
if (tagRender) {\r
tagRendered = false;\r
if (tabsPending)\r