/// <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 if (value != CSSValue.Inherit) return false; return true; }
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 if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { if (value.Is("normal")) { _spacing = null; } else if (value.ToLength().HasValue) { _spacing = value.ToLength(); } else if (value != CSSValue.Inherit) { return(false); } return(true); }
internal override Boolean TrySetValue(CSSValue value) { var length = value.ToLength(); if (length.HasValue) { Value = value; _length = length.Value; 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 width = value.ToLength(); if (width.HasValue) _width = width.Value; else if (value.Is("auto")) _width = null; else if (value != CSSValue.Inherit) return false; return true; }
protected override Boolean IsValid(CSSValue value) { var gap = value.ToLength(); if (gap.HasValue) { _gap = gap.Value; } else if (value.Is("normal")) { _gap = _normal; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { var width = value.ToLength(); if (width.HasValue) { _width = width.Value; } else if (value.Is("auto")) { _width = null; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
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("none")) { _distance = Length.Zero; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
public static Length?ToBorderWidth(this CSSValue value) { var length = value.ToLength(); if (length != null) { return(length); } else if (value.Is(Keywords.Thin)) { return(Length.Thin); } else if (value.Is(Keywords.Medium)) { return(Length.Medium); } else if (value.Is(Keywords.Thick)) { return(Length.Thick); } return(null); }