internal CSSTextDecorationProperty()
     : base(PropertyNames.TextDecoration)
 {
     _style = new CSSTextDecorationStyleProperty();
     _line = new CSSTextDecorationLineProperty();
     _color = new CSSTextDecorationColorProperty();
     _inherited = false;
 }
Example #2
0
 internal CSSTextDecorationProperty()
     : base(PropertyNames.TextDecoration)
 {
     _style     = new CSSTextDecorationStyleProperty();
     _line      = new CSSTextDecorationLineProperty();
     _color     = new CSSTextDecorationColorProperty();
     _inherited = false;
 }
Example #3
0
        protected override Boolean IsValid(CSSValue value)
        {
            if (value == CSSValue.Inherit)
            {
                return(true);
            }

            var list = value as CSSValueList;

            if (list == null)
            {
                list = new CSSValueList(value);
            }

            var index      = 0;
            var startGroup = new List <CSSProperty>(3);
            var style      = new CSSTextDecorationStyleProperty();
            var line       = new CSSTextDecorationLineProperty();
            var color      = new CSSTextDecorationColorProperty();

            startGroup.Add(style);
            startGroup.Add(line);
            startGroup.Add(color);

            while (true)
            {
                var length = startGroup.Count;

                for (int i = 0; i < length; i++)
                {
                    if (CheckSingleProperty(startGroup[i], index, list))
                    {
                        startGroup.RemoveAt(i);
                        index++;
                        break;
                    }
                }

                if (length == startGroup.Count)
                {
                    break;
                }
            }

            if (index == list.Length)
            {
                _style = style;
                _line  = line;
                _color = color;
                return(true);
            }

            return(false);
        }
        /// <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)
        {
            if (value == CSSValue.Inherit)
                return true;

            var list = value as CSSValueList;

            if (list == null)
                list = new CSSValueList(value);

            var index = 0;
            var startGroup = new List<CSSProperty>(3);
            var style = new CSSTextDecorationStyleProperty();
            var line = new CSSTextDecorationLineProperty();
            var color = new CSSTextDecorationColorProperty();
            startGroup.Add(style);
            startGroup.Add(line);
            startGroup.Add(color);

            while (true)
            {
                var length = startGroup.Count;

                for (int i = 0; i < length; i++)
                {
                    if (CheckSingleProperty(startGroup[i], index, list))
                    {
                        startGroup.RemoveAt(i);
                        index++;
                        break;
                    }
                }

                if (length == startGroup.Count)
                    break;
            }

            if (index == list.Length)
            {
                _style = style;
                _line = line;
                _color = color;
                return true;
            }

            return false;
        }