Esempio n. 1
0
 static void SetCornerRadius(BoxSpec box, WebDom.CssCodeValueExpression value)
 {
     WebDom.CssCodePrimitiveExpression prim = value as WebDom.CssCodePrimitiveExpression;
     if (prim == null)
     {
         //combinator values?
         throw new NotSupportedException();
         return;
     }
     box.CornerNERadius     = box.CornerNWRadius =
         box.CornerSERadius = box.CornerSWRadius = UserMapUtil.AsLength(prim);
 }
Esempio n. 2
0
 static void SetBorderSpacing(BoxSpec box, WebDom.CssCodeValueExpression value)
 {
     WebDom.CssCodePrimitiveExpression primValue = value as WebDom.CssCodePrimitiveExpression;
     if (primValue == null)
     {
         //2 values?
         //box.BorderSpacingHorizontal = new CssLength(r[0].Value);
         //box.BorderSpacingVertical = new CssLength(r[1].Value);
         throw new NotSupportedException();
     }
     else
     {
         //primitive value
         box.BorderSpacingHorizontal = box.BorderSpacingVertical = UserMapUtil.AsLength(primValue);
     }
 }
Esempio n. 3
0
        static void SetFontSize(this BoxSpec box, WebDom.CssCodeValueExpression value)
        {
            //number + value
            WebDom.CssCodePrimitiveExpression primValue = value as WebDom.CssCodePrimitiveExpression;
            if (primValue == null)
            {
                return;
            }
            switch (primValue.Hint)
            {
            case WebDom.CssValueHint.Number:
            {
                //has unit or not
                //?
                //or percent ?

                CssLength len = UserMapUtil.AsLength(primValue);
                if (len.HasError)
                {
                    len = CssLength.FontSizeMedium;
                }
                box.FontSize = len;
            }
            break;

            case WebDom.CssValueHint.Iden:
            {
                switch (primValue.GetTranslatedStringValue())
                {
                default:
                {
                    throw new NotSupportedException();
                }

                case CssConstants.Medium:
                    box.FontSize = CssLength.FontSizeMedium;
                    break;

                case CssConstants.Small:
                    box.FontSize = CssLength.FontSizeSmall;
                    break;

                case CssConstants.XSmall:
                    box.FontSize = CssLength.FontSizeXSmall;
                    break;

                case CssConstants.XXSmall:
                    box.FontSize = CssLength.FontSizeXXSmall;
                    break;

                case CssConstants.Large:
                    box.FontSize = CssLength.FontSizeLarge;
                    break;

                case CssConstants.XLarge:
                    box.FontSize = CssLength.FontSizeLarge;
                    break;

                case CssConstants.XXLarge:
                    box.FontSize = CssLength.FontSizeLarger;
                    break;

                case CssConstants.Smaller:
                    box.FontSize = CssLength.FontSizeSmaller;
                    break;

                case CssConstants.Larger:
                    box.FontSize = CssLength.FontSizeLarger;
                    break;
                }
            }
            break;
            }
        }