Пример #1
0
        /// <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.Is(Keywords.None))
            {
                _transforms.Clear();
                return(true);
            }

            var transform = value.ToTransform();

            if (transform != null)
            {
                _transforms.Clear();
                _transforms.Add(transform);
                return(true);
            }

            var list = value as CSSValueList;

            if (list != null)
            {
                var transforms = new ITransform[list.Length];

                for (int i = 0; i < transforms.Length; i++)
                {
                    transforms[i] = list[i].ToTransform();

                    if (transforms[i] == null)
                    {
                        return(false);
                    }
                }

                _transforms.Clear();
                _transforms.AddRange(transforms);
                return(true);
            }

            return(false);
        }