internal static void WriteAttributes(TextWriter writer, RenderStyle[] styles, int count) { for (int i = 0; i < count; i++) { RenderStyle style = styles[i]; WriteAttribute(writer, style.key, style.name, style.value); } }
/// <devdoc> /// Render the specified style attributes. This is used by HtmlTextWriter to render out all /// its collected style attributes. /// </devdoc> internal static void WriteAttributes(TextWriter writer, RenderStyle[] styles, int count) { for (int i = 0; i < count; i++) { RenderStyle style = styles[i]; WriteAttribute(writer, style.key, style.name, style.value); } }
protected virtual void AddStyleAttribute(string name, string value, HtmlTextWriterStyle key) { if(_styleList == null) { _styleList = new RenderStyle[20]; } else if (_styleCount > _styleList.Length) { RenderStyle[] newArray = new RenderStyle[_styleList.Length * 2]; Array.Copy(_styleList, newArray, _styleList.Length); _styleList = newArray; } RenderStyle style; style.name = name; style.key = key; string attributeValue = value; if (CssTextWriter.IsStyleEncoded(key)) { // note that only css attributes in an inline style value need to be attribute encoded // since CssTextWriter is used to render both embedded stylesheets and style attributes // the attribute encoding is done here. attributeValue = HttpUtility.HtmlAttributeEncode(value); } style.value = attributeValue; _styleList[_styleCount] = style; _styleCount++; }
protected virtual void AddStyleAttribute(string name, string value, HtmlTextWriterStyle key) { RenderStyle style; if (this._styleList == null) { this._styleList = new RenderStyle[20]; } else if (this._styleCount > this._styleList.Length) { RenderStyle[] destinationArray = new RenderStyle[this._styleList.Length * 2]; Array.Copy(this._styleList, destinationArray, this._styleList.Length); this._styleList = destinationArray; } style.name = name; style.key = key; string str = value; if (CssTextWriter.IsStyleEncoded(key)) { str = HttpUtility.HtmlAttributeEncode(value); } style.value = str; this._styleList[this._styleCount] = style; this._styleCount++; }
protected virtual void AddStyleAttribute(string name, string value, HtmlTextWriterStyle key){ if (_styleCount >= (int) _styleList.Length) { RenderStyle[] rAttrArr = new RenderStyle[_styleList.Length * 2]; System.Array.Copy(_styleList, rAttrArr, (int) _styleList.Length); _styleList = rAttrArr; } RenderStyle rAttr; rAttr.name = name; rAttr.value = value; rAttr.key = key; _styleList [_styleCount++] = rAttr; }
public HtmlTextWriter(TextWriter writer, string tabString) : base() { this.writer = writer; this.tabString = tabString; indentLevel = 0; tabsPending = false; _httpWriter = writer as HttpWriter; _isDescendant = GetType() == typeof(HtmlTextWriter) == false; _attrList = new RenderAttribute[20]; _attrCount = 0; _styleList = new RenderStyle[20]; _styleCount = 0; _endTags = new TagStackEntry[16]; _endTagCount = 0; _inlineCount = 0; }