예제 #1
0
        protected static Boolean ValidatePeriodic(CSSValue v, CSSProperty t, CSSProperty r, CSSProperty b, CSSProperty l)
        {
            var      values = v as CSSValueList ?? new CSSValueList(v);
            CSSValue top    = null;
            CSSValue right  = null;
            CSSValue bottom = null;
            CSSValue left   = null;

            if (values.Length > 4)
            {
                return(false);
            }

            foreach (var value in values)
            {
                if (!t.CanStore(value, ref top) && !r.CanStore(value, ref right) && !b.CanStore(value, ref bottom) && !l.CanStore(value, ref left))
                {
                    return(false);
                }
            }

            right  = right ?? top;
            bottom = bottom ?? top;
            left   = left ?? right;
            return(t.TrySetValue(top) && r.TrySetValue(right) && b.TrySetValue(bottom) && l.TrySetValue(left));
        }
예제 #2
0
        internal static Boolean CheckSingleProperty(CSSProperty property, Int32 index, CSSValueList arguments)
        {
            if (index < arguments.Length)
            {
                var argument = arguments[index];
                return(property.TrySetValue(argument));
            }

            return(false);
        }
예제 #3
0
        internal static Boolean CheckLastProperty(CSSProperty property, Int32 index, CSSValueList arguments)
        {
            if (arguments.Length - index > 1)
            {
                var newList = new CSSValueList();

                while (index < arguments.Length)
                {
                    newList.Add(arguments[index++]);
                }

                return(property.TrySetValue(newList));
            }

            return(CheckSingleProperty(property, index, arguments));
        }