コード例 #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());
        }
コード例 #2
0
        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);
        }
コード例 #3
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);
        }