Exemplo 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 CSSBorderTopColorProperty();
            var bottom = new CSSBorderBottomColorProperty();
            var right  = new CSSBorderRightColorProperty();
            var left   = new CSSBorderLeftColorProperty();

            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);
        }
Exemplo n.º 2
0
 internal CSSBorderColorProperty()
     : base(PropertyNames.BorderColor)
 {
     _inherited = false;
     _top       = new CSSBorderTopColorProperty();
     _right     = new CSSBorderRightColorProperty();
     _bottom    = new CSSBorderBottomColorProperty();
     _left      = new CSSBorderLeftColorProperty();
 }