Exemple #1
0
        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());
        }
Exemple #2
0
        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);
        }