X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.Web%2FSystem.Web.UI%2FHtmlTextWriter.cs;h=e43791f79671994dedb42f3f7b8a37edd0209b9b;hb=c39145af2464b19374fac41b252e07480ae1a197;hp=b7276c9bd3a5d91a004ab31a2036035eb8ae63da;hpb=093071fda352e40fceac14d5902b17433caa212c;p=mono.git diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs index b7276c9bd3a..e43791f7967 100644 --- a/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs +++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs @@ -1,3 +1,24 @@ + +// +// 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 * Authors * Leen Toelen (toelen@hotmail.com) @@ -14,7 +35,8 @@ namespace System.Web.UI{ public class HtmlTextWriter : System.IO.TextWriter { static HtmlTextWriter(){ - HtmlTextWriter._tagKeyLookupTable = new Hashtable(97); + HtmlTextWriter._tagKeyLookupTable = new Hashtable(97,CaseInsensitiveHashCodeProvider.Default, + CaseInsensitiveComparer.Default); HtmlTextWriter._tagNameLookupArray = new TagInformation[97]; HtmlTextWriter.RegisterTag("", HtmlTextWriterTag.Unknown, TagType.Other); HtmlTextWriter.RegisterTag("a", HtmlTextWriterTag.A, TagType.Inline); @@ -114,7 +136,8 @@ static HtmlTextWriter(){ HtmlTextWriter.RegisterTag("wbr", HtmlTextWriterTag.Wbr, TagType.NonClosing); HtmlTextWriter.RegisterTag("xml", HtmlTextWriterTag.Xml, TagType.Other); - HtmlTextWriter._attrKeyLookupTable = new Hashtable(40); + HtmlTextWriter._attrKeyLookupTable = new Hashtable(40,CaseInsensitiveHashCodeProvider.Default, + CaseInsensitiveComparer.Default); HtmlTextWriter._attrNameLookupArray = new AttributeInformation[40]; HtmlTextWriter.RegisterAttribute("accesskey", HtmlTextWriterAttribute.Accesskey, true); HtmlTextWriter.RegisterAttribute("align", HtmlTextWriterAttribute.Align, false); @@ -157,8 +180,13 @@ static HtmlTextWriter(){ HtmlTextWriter.RegisterAttribute("width", HtmlTextWriterAttribute.Width, false); HtmlTextWriter.RegisterAttribute("wrap", HtmlTextWriterAttribute.Wrap, false); - HtmlTextWriter._styleKeyLookupTable = new Hashtable(14); +#if NET_2_0 + HtmlTextWriter._styleNameLookupArray = new String[42]; +#else HtmlTextWriter._styleNameLookupArray = new String[14]; +#endif + HtmlTextWriter._styleKeyLookupTable = new Hashtable (HtmlTextWriter._styleNameLookupArray.Length, + CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default); HtmlTextWriter.RegisterStyle("background-color", HtmlTextWriterStyle.BackgroundColor); HtmlTextWriter.RegisterStyle("background-image", HtmlTextWriterStyle.BackgroundImage); HtmlTextWriter.RegisterStyle("border-collapse", HtmlTextWriterStyle.BorderCollapse); @@ -173,6 +201,36 @@ static HtmlTextWriter(){ HtmlTextWriter.RegisterStyle("height", HtmlTextWriterStyle.Height); HtmlTextWriter.RegisterStyle("text-decoration", HtmlTextWriterStyle.TextDecoration); HtmlTextWriter.RegisterStyle("width", HtmlTextWriterStyle.Width); +#if NET_2_0 + HtmlTextWriter.RegisterStyle("list-style-image", HtmlTextWriterStyle.ListStyleImage); + HtmlTextWriter.RegisterStyle("list-style-type", HtmlTextWriterStyle.ListStyleType); + HtmlTextWriter.RegisterStyle("cursor", HtmlTextWriterStyle.Cursor); + HtmlTextWriter.RegisterStyle("direction", HtmlTextWriterStyle.Direction); + HtmlTextWriter.RegisterStyle("display", HtmlTextWriterStyle.Display); + HtmlTextWriter.RegisterStyle("filter", HtmlTextWriterStyle.Filter); + HtmlTextWriter.RegisterStyle("font-variant", HtmlTextWriterStyle.FontVariant); + HtmlTextWriter.RegisterStyle("left", HtmlTextWriterStyle.Left); + HtmlTextWriter.RegisterStyle("margin", HtmlTextWriterStyle.Margin); + HtmlTextWriter.RegisterStyle("margin-bottom", HtmlTextWriterStyle.MarginBottom); + HtmlTextWriter.RegisterStyle("margin-left", HtmlTextWriterStyle.MarginLeft); + HtmlTextWriter.RegisterStyle("margin-right", HtmlTextWriterStyle.MarginRight); + HtmlTextWriter.RegisterStyle("margin-top", HtmlTextWriterStyle.MarginTop); + HtmlTextWriter.RegisterStyle("overflow", HtmlTextWriterStyle.Overflow); + HtmlTextWriter.RegisterStyle("overflow-x", HtmlTextWriterStyle.OverflowX); + HtmlTextWriter.RegisterStyle("overflow-y", HtmlTextWriterStyle.OverflowY); + HtmlTextWriter.RegisterStyle("padding", HtmlTextWriterStyle.Padding); + HtmlTextWriter.RegisterStyle("padding-bottom", HtmlTextWriterStyle.PaddingBottom); + HtmlTextWriter.RegisterStyle("padding-left", HtmlTextWriterStyle.PaddingLeft); + HtmlTextWriter.RegisterStyle("padding-right", HtmlTextWriterStyle.PaddingRight); + HtmlTextWriter.RegisterStyle("padding-top", HtmlTextWriterStyle.PaddingTop); + HtmlTextWriter.RegisterStyle("position", HtmlTextWriterStyle.Position); + HtmlTextWriter.RegisterStyle("text-align", HtmlTextWriterStyle.TextAlign); + HtmlTextWriter.RegisterStyle("text-overflow", HtmlTextWriterStyle.TextOverflow); + HtmlTextWriter.RegisterStyle("top", HtmlTextWriterStyle.Top); + HtmlTextWriter.RegisterStyle("visibility", HtmlTextWriterStyle.Visibility); + HtmlTextWriter.RegisterStyle("white-space", HtmlTextWriterStyle.WhiteSpace); + HtmlTextWriter.RegisterStyle("z-index", HtmlTextWriterStyle.ZIndex); +#endif } public HtmlTextWriter(TextWriter writer):this(writer, " "){} @@ -314,7 +372,7 @@ public override void Flush(){ protected HtmlTextWriterAttribute GetAttributeKey(string attrName){ if (attrName != null && attrName.Length > 0) { - object attr = HtmlTextWriter._attrKeyLookupTable[attrName.ToLower()]; + object attr = HtmlTextWriter._attrKeyLookupTable[attrName]; if (attr != null) return (HtmlTextWriterAttribute) attr; } @@ -329,7 +387,7 @@ protected string GetAttributeName(HtmlTextWriterAttribute attrKey){ protected HtmlTextWriterStyle GetStyleKey(string styleName){ if (styleName != null && styleName.Length > 0) { - object style = HtmlTextWriter._styleKeyLookupTable[styleName.ToLower()]; + object style = HtmlTextWriter._styleKeyLookupTable[styleName]; if (style != null) return (HtmlTextWriterStyle) style; } @@ -337,6 +395,10 @@ protected HtmlTextWriterStyle GetStyleKey(string styleName){ } protected string GetStyleName(HtmlTextWriterStyle styleKey){ + return StaticGetStyleName (styleKey); +} + +internal static string StaticGetStyleName (HtmlTextWriterStyle styleKey){ if ((int) styleKey >= 0 && (int) styleKey < HtmlTextWriter._styleNameLookupArray.Length) return HtmlTextWriter._styleNameLookupArray[(int) styleKey]; return System.String.Empty; @@ -344,7 +406,7 @@ protected string GetStyleName(HtmlTextWriterStyle styleKey){ protected virtual HtmlTextWriterTag GetTagKey(string tagName){ if (tagName != null && tagName.Length > 0) { - object tag = HtmlTextWriter._tagKeyLookupTable[tagName.ToLower()]; + object tag = HtmlTextWriter._tagKeyLookupTable[tagName]; if (tag != null) return (HtmlTextWriterTag) tag; }