예제 #1
0
        protected virtual void AddAttribute(string name, string value, HtmlTextWriterAttribute key)
        {
            NextAttrStack();
#if TARGET_JVM
            if (attrs [attrs_pos] == null)
            {
                attrs [attrs_pos] = new AddedAttr();
            }
#endif
            attrs [attrs_pos].name  = name;
            attrs [attrs_pos].value = value;
            attrs [attrs_pos].key   = key;
        }
예제 #2
0
        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;
        }
예제 #3
0
        void NextAttrStack()
        {
            if (attrs == null)
            {
                attrs = new AddedAttr [16];
            }

            if (++attrs_pos < attrs.Length)
            {
                return;
            }

            int nsize = attrs.Length * 2;

            AddedAttr [] ncontents = new AddedAttr [nsize];

            Array.Copy(attrs, ncontents, attrs.Length);
            attrs = ncontents;
        }
예제 #4
0
		void NextAttrStack ()
		{
			if (attrs == null)
				attrs = new AddedAttr [16];

			if (++attrs_pos < attrs.Length)
				return;

			int nsize = attrs.Length * 2;
			AddedAttr [] ncontents = new AddedAttr [nsize];

			Array.Copy (attrs, ncontents, attrs.Length);
			attrs = ncontents;
		}
예제 #5
0
		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 (a.key == HtmlTextWriterStyle.BackgroundImage)
							a.value = String.Concat ("url(", HttpUtility.UrlPathEncode (a.value), ")");
						WriteStyleAttribute (a.name, a.value, false);
					}
				}

				Write (style_attr.value);
				Write (DoubleQuoteChar);
			}

			styles_pos = attrs_pos = -1;
		}
예제 #6
0
		protected virtual void AddAttribute (string name, string value, HtmlTextWriterAttribute key)
		{
			NextAttrStack ();
#if TARGET_JVM
			if (attrs [attrs_pos] == null)
				attrs [attrs_pos] = new AddedAttr ();
#endif
			attrs [attrs_pos].name = name;
			attrs [attrs_pos].value = value;
			attrs [attrs_pos].key = key;
		}