protected virtual void AddStyleAttribute(string name, string value, HtmlTextWriterStyle key) { NextStyleStack(); #if TARGET_JVM if (styles [styles_pos] == null) { styles [styles_pos] = new AddedStyle(); } #endif styles [styles_pos].name = name; value = HttpUtility.HtmlAttributeEncode(value); styles [styles_pos].value = value; styles [styles_pos].key = key; }
protected virtual void FilterAttributes() { AddedAttr style_attr = new AddedAttr(); for (int i = 0; i <= attrs_pos; i++) { AddedAttr a = attrs [i]; if (OnAttributeRender(a.name, a.value, a.key)) { if (a.key == HtmlTextWriterAttribute.Style) { style_attr = a; continue; } WriteAttribute(a.name, a.value, false); } } if (styles_pos != -1 || style_attr.value != null) { Write(SpaceChar); Write("style"); Write(EqualsDoubleQuoteString); for (int i = 0; i <= styles_pos; i++) { AddedStyle a = styles [i]; if (OnStyleAttributeRender(a.name, a.value, a.key)) { #if NET_2_0 if (a.key == HtmlTextWriterStyle.BackgroundImage) { a.value = String.Concat("url(", HttpUtility.UrlPathEncode(a.value), ")"); } #endif WriteStyleAttribute(a.name, a.value, false); } } Write(style_attr.value); Write(DoubleQuoteChar); } styles_pos = attrs_pos = -1; }
void NextStyleStack() { if (styles == null) { styles = new AddedStyle [16]; } if (++styles_pos < styles.Length) { return; } int nsize = styles.Length * 2; AddedStyle [] ncontents = new AddedStyle [nsize]; Array.Copy(styles, ncontents, styles.Length); styles = ncontents; }
void NextStyleStack () { if (styles == null) styles = new AddedStyle [16]; if (++styles_pos < styles.Length) return; int nsize = styles.Length * 2; AddedStyle [] ncontents = new AddedStyle [nsize]; Array.Copy (styles, ncontents, styles.Length); styles = ncontents; }
protected virtual void AddStyleAttribute (string name, string value, HtmlTextWriterStyle key) { NextStyleStack (); #if TARGET_JVM if (styles [styles_pos] == null) styles [styles_pos] = new AddedStyle (); #endif styles [styles_pos].name = name; value = HttpUtility.HtmlAttributeEncode (value); styles [styles_pos].value = value; styles [styles_pos].key = key; }