/// <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 num = value.ToNumber(); if (num.HasValue) _value = num.Value; else if (value != CSSValue.Inherit) return false; return true; }
protected override Boolean IsValid(CSSValue value) { CSSCalcValue calc = value.AsCalc(); if (calc != null) { _mode = new CalcLineHeightMode(calc); } else if (value.Is("normal")) { _mode = _normal; } else if (value.ToNumber().HasValue) { _mode = new MultipleLineHeightMode(value.ToNumber().Value); } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { var num = value.ToNumber(); if (num.HasValue) { _value = num.Value; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
static ImageWidthMode ToMode(CSSValue value) { if (value.Is("auto")) return _auto; var multiple = value.ToNumber(); if (multiple.HasValue) return new MultipleImageWidthMode(multiple.Value); var calc = value.AsCalc(); if (calc != null) return new CalcImageWidthMode(calc); return null; }
static SliceMode ToMode(CSSValue value) { var percent = value.ToPercent(); if (percent.HasValue) { return(new PercentSliceMode(percent.Value)); } var number = value.ToNumber(); if (number.HasValue) { return(new PixelSliceMode(number.Value)); } return(null); }
Animation?ParseValue(CSSValue value) { var delay = Time.Zero; var duration = Time.Zero; var function = value.ToTimingFunction(); var name = "none"; var iterationCount = 1f; if (function == null) { function = CSSTimingValue.Ease; if (value is CSSIdentifierValue) { name = ((CSSIdentifierValue)value).Value; } else if (value is CSSPrimitiveValue <Time> ) { duration = value.ToTime().Value; } else if (value is CSSPrimitiveValue <Number> ) { iterationCount = value.ToNumber().Value; } else { return(null); } } return(new Animation { Delay = delay, Duration = duration, Timing = function, Name = name, IterationCount = iterationCount, FillMode = AnimationFillMode.None, Direction = AnimationDirection.Normal }); }
static ImageWidthMode ToMode(CSSValue value) { if (value.Is("auto")) { return(_auto); } var multiple = value.ToNumber(); if (multiple.HasValue) { return(new MultipleImageWidthMode(multiple.Value)); } var calc = value.AsCalc(); if (calc != null) { return(new CalcImageWidthMode(calc)); } return(null); }