/// <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) { var iterations = new List <Int32>(); foreach (var v in values) { var n = v.ToInteger(); if (n == null) { return(false); } iterations.Add(n.Value); } _iterations.Clear(); _iterations.AddRange(iterations); 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) { var values = value.AsList <CSSPrimitiveValue>(); if (values != null) { var fillModes = new List <AnimationFillStyle>(); foreach (var item in values) { var mode = item.ToFillMode(); if (mode == null) { return(false); } fillModes.Add(mode.Value); } _fillModes.Clear(); _fillModes.AddRange(fillModes); 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) { var values = value.AsList<CSSPrimitiveValue>(); if (values != null) { var times = new List<Time>(); foreach (var v in values) { var time = v.ToTime(); if (time == null) return false; times.Add(time.Value); } _times.Clear(); _times.AddRange(times); 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) { var values = value.AsList <CSSPrimitiveValue>(); if (values != null) { var fillModes = new List <AnimationDirection>(); foreach (var item in values) { var direction = item.ToDirection(); if (direction == null) { return(false); } fillModes.Add(direction.Value); } _directions.Clear(); _directions.AddRange(fillModes); 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) { var values = value.AsList <CSSPrimitiveValue>(); if (values != null) { var states = new List <PlayState>(); foreach (var item in values) { if (item.Is(Keywords.Running)) { states.Add(PlayState.Running); } else if (item.Is(Keywords.Paused)) { states.Add(PlayState.Paused); } else { return(false); } } _states.Clear(); _states.AddRange(states); 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) { var functions = value.AsList(ValueExtensions.ToTimingFunction); if (functions != null) { _functions.Clear(); _functions.AddRange(functions); 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.Is(Keywords.None)) { _names.Clear(); } else if (value is CSSPrimitiveValue) { var name = value.ToIdentifier(); if (name == null) { return(false); } _names.Clear(); _names.Add(name); } else if (value is CSSValueList) { var names = value.AsList(ValueExtensions.ToIdentifier); if (names == null) { return(false); } _names.Clear(); _names.AddRange(names); } else { 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(Keywords.None)) { _properties.Clear(); } else if (value is CSSPrimitiveValue) { var property = value.ToAnimatableIdentifier(); if (property == null) { return(false); } _properties.Clear(); _properties.Add(property); } else if (value is CSSValueList) { var properties = value.AsList(ValueExtensions.ToAnimatableIdentifier); if (properties == null) { return(false); } _properties.Clear(); _properties.AddRange(properties); } else { return(false); } return(true); }