Esempio n. 1
0
        protected override Boolean IsValid(CSSValue value)
        {
            if (value == CSSValue.Inherit)
            {
                return(true);
            }

            var values = value as CSSValueList ?? new CSSValueList(value);
            var top    = new CSSBorderTopStyleProperty();
            var bottom = new CSSBorderBottomStyleProperty();
            var right  = new CSSBorderRightStyleProperty();
            var left   = new CSSBorderLeftStyleProperty();

            if (values.Length == 1)
            {
                if (!CheckSingleProperty(top, 0, values))
                {
                    return(false);
                }

                right.Value = left.Value = bottom.Value = top.Value;
            }
            else if (values.Length == 2)
            {
                if (!CheckSingleProperty(top, 0, values) || !CheckSingleProperty(right, 1, values))
                {
                    return(false);
                }

                bottom.Value = top.Value;
                left.Value   = right.Value;
            }
            else if (values.Length == 3)
            {
                if (!CheckSingleProperty(top, 0, values) || !CheckSingleProperty(right, 1, values) || !CheckSingleProperty(bottom, 2, values))
                {
                    return(false);
                }

                left.Value = right.Value;
            }
            else if (values.Length == 4)
            {
                if (!CheckSingleProperty(top, 0, values) || !CheckSingleProperty(right, 1, values) || !CheckSingleProperty(bottom, 2, values) || !CheckSingleProperty(left, 3, values))
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            _top    = top;
            _bottom = bottom;
            _right  = right;
            _left   = left;
            return(true);
        }
Esempio n. 2
0
 internal CSSBorderStyleProperty()
     : base(PropertyNames.BorderStyle)
 {
     _inherited = false;
     _left      = new CSSBorderLeftStyleProperty();
     _right     = new CSSBorderRightStyleProperty();
     _bottom    = new CSSBorderBottomStyleProperty();
     _top       = new CSSBorderTopStyleProperty();
 }