/// <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 length = value.ToLength(); if (length.HasValue) { _h = _v = length.Value; } else if (value is CSSValueList) { var values = (CSSValueList)value; if (values.Length != 2) { return(false); } var h = values[0].ToLength(); var v = values[1].ToLength(); if (!h.HasValue || !v.HasValue) { return(false); } _h = h.Value; _v = v.Value; } 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.Normal)) { _spacing = null; } else if (value.ToLength().HasValue) { _spacing = value.ToLength(); } 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) { var gap = value.ToLength(); if (gap.HasValue) { _gap = gap.Value; } else if (value.Is(Keywords.Normal)) { _gap = _normal; } 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) { var width = value.ToLength(); if (width.HasValue) { _width = width.Value; } else if (value.Is(Keywords.Auto)) { _width = null; } 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) { var distance = value.ToLength(); if (distance.HasValue) { _distance = distance.Value; } //Is a keyword indicating that no perspective transform has to be applied. else if (value.Is(Keywords.None)) { _distance = Length.Zero; } else { return(false); } return(true); }