/// <summary>
        /// Determines if the given value represents a valid state of this property.
        /// </summary>
        /// <param name="value">The state that should be used.</param>
        /// <returns>True if the state is valid, otherwise false.</returns>
        protected override Boolean IsValid(CSSValue value)
        {
            var width = value.ToBorderWidth();

            if (width.HasValue)
                _width = width.Value;
            else if (value != CSSValue.Inherit)
                return false;

            return true;
        }
        /// <summary>
        /// Determines if the given value represents a valid state of this property.
        /// </summary>
        /// <param name="value">The state that should be used.</param>
        /// <returns>True if the state is valid, otherwise false.</returns>
        protected override Boolean IsValid(CSSValue value)
        {
            //TODO
            //UNITLESS in QUIRKSMODE
            var length = value.ToBorderWidth();

            if (length.HasValue)
                _width = length.Value;
            else if (value != CSSValue.Inherit)
                return false;

            return true;
        }
        protected override Boolean IsValid(CSSValue value)
        {
            var width = value.ToBorderWidth();

            if (width.HasValue)
            {
                _width = width.Value;
            }
            else if (value != CSSValue.Inherit)
            {
                return(false);
            }

            return(true);
        }
Beispiel #4
0
        protected override Boolean IsValid(CSSValue value)
        {
            //TODO
            //UNITLESS in QUIRKSMODE
            var length = value.ToBorderWidth();

            if (length.HasValue)
            {
                _width = length.Value;
            }
            else if (value != CSSValue.Inherit)
            {
                return(false);
            }

            return(true);
        }
Beispiel #5
0
        protected override Boolean IsValid(CSSValue value)
        {
            if (value == CSSValue.Inherit)
            {
                return(true);
            }

            var width = Length.Medium;
            var color = Color.Transparent;
            var style = LineStyle.None;

            if (value is CSSValueList)
            {
                var values = (CSSValueList)value;

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

                Length?   w = null;
                Color?    c = null;
                LineStyle?s = null;

                foreach (var v in values)
                {
                    if (!w.HasValue && (w = v.ToBorderWidth()).HasValue)
                    {
                        width = w.Value;
                    }
                    else if (!c.HasValue && (c = v.ToColor()).HasValue)
                    {
                        color = c.Value;
                    }
                    else if (!s.HasValue && (s = v.ToLineStyle()).HasValue)
                    {
                        style = s.Value;
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            else
            {
                var w = value.ToBorderWidth();
                var c = value.ToColor();
                var s = value.ToLineStyle();

                if (w.HasValue)
                {
                    width = w.Value;
                }
                else if (c.HasValue)
                {
                    color = c.Value;
                }
                else if (s.HasValue)
                {
                    style = s.Value;
                }
                else
                {
                    return(false);
                }
            }

            _width = width;
            _color = color;
            _style = style;
            return(true);
        }