Exemplo n.º 1
0
        public override bool OnReadValue(Style styleBlock, Css.Value value, int start, out int size)
        {
            // Check if it's inherit or initial:
            if (value is Css.Keywords.Initial || value is Css.Keywords.Inherit)
            {
                // Apply it!
                size = 1;

                if (SetInfo != null)
                {
                    // Indicate that we've been set:
                    SetInfo.Set = true;
                }

                styleBlock[RawProperty] = value;

                return(true);
            }

            Css.Spec.Value spec = RawProperty.Specification;

            if (spec.OnReadValue(styleBlock, value, start, out size))
            {
                // Apply it!
                if (SetInfo != null)
                {
                    // Indicate that we've been set:
                    SetInfo.Set = true;
                }

                if (size == 1)
                {
                    styleBlock[RawProperty] = value[start];
                }
                else
                {
                    // Chop out a segment:
                    Css.ValueSet set = new Css.ValueSet(new Css.Value[size]);

                    for (int i = 0; i < size; i++)
                    {
                        set[i] = value[start + i];
                    }

                    // Apply:
                    styleBlock[RawProperty] = set;
                }

                return(true);
            }

            size = 0;
            return(false);
        }
Exemplo n.º 2
0
        public PropertyAlt(CssProperty prop, string name, Css.Spec.Value spec)
        {
            RawProperty   = CssProperties.Get(name);
            Specification = spec;

            if (RawProperty == null)
            {
                throw new Exception("CSS Specification failure: Property '" + name + "' is required.");
            }

            CssCompositeProperty compProp = prop as CssCompositeProperty;

            if (compProp != null)
            {
                SetInfo = compProp.GetPropertySetInfo(RawProperty);
            }
        }