Ejemplo n.º 1
0
        protected override Boolean IsValid(CSSValue value)
        {
            if (value.Is("none"))
            {
                _properties.Clear();
            }
            else if (value is CSSIdentifierValue)
            {
                _properties.Clear();
                _properties.Add(((CSSIdentifierValue)value).Value);
            }
            else if (value is CSSValueList)
            {
                var values = value.AsList <CSSIdentifierValue>();

                if (values == null)
                {
                    return(false);
                }

                _properties.Clear();

                foreach (var ident in values)
                {
                    _properties.Add(ident.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)
        {
            var values = value.AsList<CSSIdentifierValue>();

            if (values != null)
            {
                var states = new List<PlayState>();

                foreach (var item in values)
                {
                    if (item.Is("running"))
                        states.Add(PlayState.Running);
                    else if (item.Is("paused"))
                        states.Add(PlayState.Paused);
                    else
                        return false;
                }

                _states = states;
            }
            else if (value != CSSValue.Inherit)
                return false;

            return true;
        }
        protected override Boolean IsValid(CSSValue value)
        {
            var values = value.AsList <CSSIdentifierValue>();

            if (values != null)
            {
                var fillModes = new List <AnimationDirection>();

                foreach (var item in values)
                {
                    var direction = item.ToDirection();

                    if (!direction.HasValue)
                    {
                        return(false);
                    }

                    fillModes.Add(direction.Value);
                }

                _directions = fillModes;
            }
            else if (value != CSSValue.Inherit)
            {
                return(false);
            }

            return(true);
        }
        protected override Boolean IsValid(CSSValue value)
        {
            var values = value.AsList <CSSIdentifierValue>();

            if (values != null)
            {
                var states = new List <PlayState>();

                foreach (var item in values)
                {
                    if (item.Is("running"))
                    {
                        states.Add(PlayState.Running);
                    }
                    else if (item.Is("paused"))
                    {
                        states.Add(PlayState.Paused);
                    }
                    else
                    {
                        return(false);
                    }
                }

                _states = states;
            }
            else if (value != CSSValue.Inherit)
            {
                return(false);
            }

            return(true);
        }
        protected override Boolean IsValid(CSSValue value)
        {
            var values = value.AsList <CSSIdentifierValue>();

            if (values != null)
            {
                var fillModes = new List <AnimationFillMode>();

                foreach (var item in values)
                {
                    var mode = item.ToFillMode();

                    if (!mode.HasValue)
                    {
                        return(false);
                    }

                    fillModes.Add(mode.Value);
                }

                _fillModes = fillModes;
            }
            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)
        {
            var values = value.AsList<CSSIdentifierValue>();

            if (values != null)
            {
                var fillModes = new List<AnimationDirection>();

                foreach (var item in values)
                {
                    var direction = item.ToDirection();

                    if (!direction.HasValue)
                        return false;

                    fillModes.Add(direction.Value);
                }

                _directions = fillModes;
            }
            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)
        {
            if (value.Is("none"))
                _names.Clear();
            else if (value is CSSIdentifierValue)
            {
                _names.Clear();
                _names.Add(((CSSIdentifierValue)value).Value);
            }
            else if (value is CSSValueList)
            {
                var values = value.AsList<CSSIdentifierValue>();

                if (values == null)
                    return false;

                _names.Clear();

                foreach (var ident in values)
                    _names.Add(ident.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)
        {
            var values = value.AsList(ValueExtensions.ToTimingFunction);

            if (values != null)
                _functions = values;
            else if (value != CSSValue.Inherit)
                return false;

            return true;
        }
        protected override Boolean IsValid(CSSValue value)
        {
            var values = value.AsList(ValueExtensions.ToTimingFunction);

            if (values != null)
            {
                _functions = values;
            }
            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)
        {
            var values = value.AsList(ToNumber);

            if (values != null)
            {
                _iterations.Clear();

                foreach (var v in values)
                    _iterations.Add(v.Value.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)
        {
            var values = value.AsList<CSSPrimitiveValue<Time>>();

            if (values != null)
            {
                _times.Clear();

                foreach (var v in values)
                    _times.Add(v.Value);
            }
            else if (value != CSSValue.Inherit)
                return false;

            return true;
        }
        protected override Boolean IsValid(CSSValue value)
        {
            var values = value.AsList <CSSPrimitiveValue <Time> >();

            if (values != null)
            {
                _times.Clear();

                foreach (var v in values)
                {
                    _times.Add(v.Value);
                }
            }
            else if (value != CSSValue.Inherit)
            {
                return(false);
            }

            return(true);
        }
        protected override Boolean IsValid(CSSValue value)
        {
            var values = value.AsList(ToNumber);

            if (values != null)
            {
                _iterations.Clear();

                foreach (var v in values)
                {
                    _iterations.Add(v.Value.Value);
                }
            }
            else if (value != CSSValue.Inherit)
            {
                return(false);
            }

            return(true);
        }