public static IDistance ToImageBorderWidth(this CSSValue value) { if (value.Is(Keywords.Auto)) { return(Percent.Hundred); } var multiple = value.ToSingle(); if (multiple.HasValue) { return(new Percent(multiple.Value * 100f)); } return(value.ToDistance()); }
public static IDistance ToBorderSlice(this CSSValue value) { var percent = value.ToPercent(); if (percent.HasValue) { return(percent.Value); } var number = value.ToSingle(); if (number.HasValue) { return(new Length(number.Value, Length.Unit.Px)); } return(null); }
public static IDistance ToLineHeight(this CSSValue value) { var distance = value.ToDistance(); if (distance != null) { return(distance); } else if (value.Is(Keywords.Normal)) { return(new Percent(120f)); } var val = value.ToSingle(); if (val.HasValue) { return(new Percent(val.Value * 100f)); } return(null); }