public WrapperCssBoxBase(object controller,
      BoxSpec spec,
      RootGraphic root, CssDisplay display)
     : base(spec, root, display)
 {
     this.SetController(controller);
 }
        internal static LayoutFarm.HtmlBoxes.CssBox CreateCssBox(
            LayoutFarm.WebDom.IHtmlElement domE,
            LayoutFarm.HtmlBoxes.CssBox parentBox,
            LayoutFarm.Css.BoxSpec spec,
            LayoutFarm.HtmlBoxes.HtmlHost htmlhost)
        {
            //create cssbox 
            //test only!           
            var newspec = new BoxSpec();
            BoxSpec.InheritStyles(newspec, spec);
            newspec.BackgroundColor = Color.Blue;
            newspec.Width = new CssLength(50, CssUnitOrNames.Pixels);
            newspec.Height = new CssLength(50, CssUnitOrNames.Pixels);
            newspec.Position = CssPosition.Absolute;
            newspec.Freeze(); //freeze before use
            HtmlElement htmlElement = (HtmlElement)domE;
            var newBox = new CssBox(newspec, parentBox.RootGfx);
            newBox.SetController(domE);
            htmlElement.SetPrincipalBox(newBox);
            //auto set bc of the element

            parentBox.AppendChild(newBox);
            htmlhost.UpdateChildBoxes(htmlElement, true);
            //----------
            return newBox;
        }
        internal static LayoutFarm.HtmlBoxes.CssBox CreateCssBox(
            LayoutFarm.WebDom.IHtmlElement domE,
            LayoutFarm.HtmlBoxes.CssBox parentBox,
            LayoutFarm.Css.BoxSpec spec,
            LayoutFarm.HtmlBoxes.HtmlHost htmlhost)
        {


            //create cssbox 
            //test only!           
            var newspec = new BoxSpec();
            BoxSpec.InheritStyles(newspec, spec);
            newspec.BackgroundColor = Color.Blue;
            newspec.Width = new CssLength(50, CssUnitOrNames.Pixels);
            newspec.Height = new CssLength(50, CssUnitOrNames.Pixels);
            newspec.Position = CssPosition.Absolute;
            newspec.Freeze(); //freeze before use

            HtmlElement htmlElement = (HtmlElement)domE;
            var newBox = new CssBox(newspec, parentBox.RootGfx);
            newBox.SetController(domE);
            htmlElement.SetPrincipalBox(newBox);
            //auto set bc of the element

            parentBox.AppendChild(newBox);
            htmlhost.UpdateChildBoxes(htmlElement, true);
            //----------
            return newBox;
        }
Beispiel #4
0
 public RenderElementBridgeCssBox(BoxSpec spec,
     RenderElement containerElement,
     RootGraphic rootgfx)
     : base(spec, rootgfx)
 {
     this.containerElement = containerElement;
 }
 void EvaluateSpec(BoxSpec spec)
 {
     this._isVisible = this._cssDisplay != Css.CssDisplay.None &&
                       spec.Visibility == CssVisibility.Visible;
     this._cssBoxSizing = spec.BoxSizing;
     this._borderLeftVisible = spec.BorderLeftStyle >= CssBorderStyle.Visible;
     this._borderTopVisible = spec.BorderTopStyle >= CssBorderStyle.Visible;
     this._borderRightVisible = spec.BorderRightStyle >= CssBorderStyle.Visible;
     this._borderBottomVisble = spec.BorderBottomStyle >= CssBorderStyle.Visible;
     this._renderBGAndBorder = _cssDisplay != Css.CssDisplay.Inline ||
            this.Position == CssPosition.Absolute || //out of flow
            this.Position == CssPosition.Fixed; //out of flow
 }
Beispiel #6
0
 CssBox CreateCustomCssBox(CssBox parent,
                           LayoutFarm.WebDom.DomElement tag,
                           LayoutFarm.Css.BoxSpec boxspec)
 {
     for (int i = generators.Count - 1; i >= 0; --i)
     {
         var newbox = generators[i].CreateCssBox(tag, parent, boxspec, this);
         if (newbox != null)
         {
             return(newbox);
         }
     }
     return(null);
 }
Beispiel #7
0
        //=======================================================================================
        public static void AssignPropertyValue(BoxSpec spec, BoxSpec parentSpec, CssPropertyDeclaration decl)
        {
            if (decl.IsExpand)
            {
                return;
            }

            if (decl.MarkedAsInherit && parentSpec != null)
            {
                SetPropertyValueFromParent(spec, parentSpec, decl.WellknownPropertyName);
            }
            else
            {
                SetPropertyValue(spec, decl);
            }
        }
Beispiel #8
0
 //---------------------------------------------------------------------------------------
 public static void AddRunList(CssBox toBox,
     BoxSpec spec,
     List<CssRun> runlist,
     char[] buffer,
     bool isAllWhitespace)
 {
     CssBox.UnsafeSetTextBuffer(toBox, buffer);
     if (runlist != null)
     {
         for (int i = runlist.Count - 1; i >= 0; --i)
         {
             runlist[i].SetOwner(toBox);
         }
     }
     CssBox.UnsafeSetContentRuns(toBox, runlist, isAllWhitespace);
 }
Beispiel #9
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);
     }
 }
        public static CssBox CreateWrapper(object owner, RenderElement renderElement, BoxSpec spec, bool isInline)
        {
            var portalEvent = owner as IEventPortal;
            if (portalEvent == null)
            {
                portalEvent = new RenderElementEventPortal(renderElement);
            }

            if (isInline)
            {
                return new LayoutFarm.HtmlBoxes.InternalWrappers.WrapperInlineCssBox(portalEvent, spec, renderElement.Root, renderElement);
            }
            else
            {
                return new LayoutFarm.HtmlBoxes.InternalWrappers.WrapperBlockCssBox(portalEvent, spec, renderElement);
            }
        }
Beispiel #11
0
        public CssBox(BoxSpec spec, RootGraphic rootgfx)
        {
            this.rootgfx = rootgfx;
            this._aa_boxes = new CssBoxCollection();
#if DEBUG
            //if (this.__aa_dbugId == 6)
            //{
            //}
            if (!spec.IsFreezed)
            {
                //must be freezed
                throw new NotSupportedException();
            }
#endif

            //assign spec 
            this._myspec = spec;
            EvaluateSpec(spec);
            ChangeDisplayType(this, _myspec.CssDisplay);
        }
        public override LayoutFarm.HtmlBoxes.CssBox CreateCssBox(
            DomElement domE,
            LayoutFarm.HtmlBoxes.CssBox parentBox,
            BoxSpec spec,
            HtmlHost host)
        {
            switch (domE.Name)
            {
                case "input":
                    {
                        var inputBox = CreateInputBox(domE, parentBox, spec, myHost.RootGfx, host);
                        if (inputBox != null)
                        {
                            return inputBox;
                        }
                    }
                    break;
                case "canvas":
                    {
                        //test only
                        //TODO: review here
                        var canvas = new LayoutFarm.CustomWidgets.MiniAggCanvasBox(400, 400);
                        var wrapperBox = CreateWrapper(
                             canvas,
                             canvas.GetPrimaryRenderElement(myHost.RootGfx),
                             spec, true);
                        parentBox.AppendChild(wrapperBox);
                        return wrapperBox;
                    }
            }

            //default unknown
            var simpleBox = new LayoutFarm.CustomWidgets.SimpleBox(100, 20);
            simpleBox.BackColor = PixelFarm.Drawing.Color.LightGray;
            var wrapperBox2 = CreateWrapper(
                               simpleBox,
                               simpleBox.GetPrimaryRenderElement(myHost.RootGfx),
                               spec, false);
            parentBox.AppendChild(wrapperBox2);
            return wrapperBox2;
        }
Beispiel #13
0
        //----------------------------------------------------------------------
#if DEBUG
        public static bool dbugCompare(dbugPropCheckReport dbugR, BoxSpec boxBase, BoxSpec spec)
        {
            int dd = boxBase.__aa_dbugId;

            dbugR.Check("_fontProps", CssFontFeature.dbugIsEq(dbugR, boxBase._fontFeats, spec._fontFeats));
            dbugR.Check("_listProps", CssListFeature.dbugIsEq(dbugR, boxBase._listFeats, spec._listFeats));
            dbugR.Check("_lineHeight", CssLength.IsEq(boxBase._lineHeight, spec._lineHeight));
            dbugR.Check("_textIndent", CssLength.IsEq(boxBase._textIndent, spec._textIndent));
            dbugR.Check("_actualColor", boxBase._actualColor == spec._actualColor);
            dbugR.Check("_emptyCells", boxBase._emptyCells == spec._emptyCells);
            dbugR.Check("_textAlign", boxBase._textAlign == spec._textAlign);
            dbugR.Check("_verticalAlign", boxBase._verticalAlign == spec._verticalAlign);
            dbugR.Check("_visibility", boxBase._visibility == spec._visibility);
            dbugR.Check("_whitespace", boxBase._whitespace == spec._whitespace);
            dbugR.Check("_wordBreak", boxBase._wordBreak == spec._wordBreak);
            dbugR.Check("_cssDirection", boxBase._cssDirection == spec._cssDirection);
            dbugR.Check("_backgroundProps", CssBackgroundFeature.dbugIsEq(dbugR, boxBase._backgroundFeats, spec._backgroundFeats));
            dbugR.Check("_borderProps", CssBorderFeature.dbugIsEq(dbugR, boxBase._borderFeats, spec._borderFeats));
            dbugR.Check("_cornerProps", CssCornerFeature.dbugIsEq(dbugR, boxBase._cornerFeats, spec._cornerFeats));
            //---------------------------------------
            dbugR.Check("_left", CssLength.IsEq(boxBase._left, spec._left));
            dbugR.Check("_top", CssLength.IsEq(boxBase._top, spec._top));
            dbugR.Check("_bottom", CssLength.IsEq(boxBase._bottom, spec._bottom));
            dbugR.Check("_right", CssLength.IsEq(boxBase._right, spec._right));
            dbugR.Check("_width", CssLength.IsEq(boxBase._width, spec._width));
            dbugR.Check("_height", CssLength.IsEq(boxBase._height, spec._height));
            dbugR.Check("_maxWidth", CssLength.IsEq(boxBase._maxWidth, spec._maxWidth));
            dbugR.Check("_position", boxBase._position == spec._position);
            dbugR.Check("_wordSpacing", CssLength.IsEq(boxBase._wordSpacing, spec._wordSpacing));
            dbugR.Check("_float", boxBase._float == spec._float);
            dbugR.Check("_cssDisplay", boxBase._cssDisplay == spec._cssDisplay);
            dbugR.Check("_overflow", boxBase._overflow == spec._overflow);
            dbugR.Check("_textDecoration", boxBase._textDecoration == spec._textDecoration);
            if (dbugR.Count > 0)
            {
                return(false);
            }
            return(true);
        }
Beispiel #14
0
        public CssBox(BoxSpec spec, RootGraphic rootgfx, CssDisplay displayType)
        {
            this.rootgfx = rootgfx;
            this._aa_boxes = new CssBoxCollection();
#if DEBUG
            //if (this.__aa_dbugId == 6)
            //{
            //}
            if (!spec.IsFreezed)
            {
                //must be freezed 
                throw new NotSupportedException();
            }
#endif

            //assign spec             
            this._boxCompactFlags |= BoxFlags.DONT_CHANGE_DISPLAY_TYPE;
            this._cssDisplay = displayType;
            this._myspec = spec;
            //---------------------------- 
            EvaluateSpec(spec);
            ChangeDisplayType(this, _myspec.CssDisplay);
        }
Beispiel #15
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);
 }
        void ApplyStyleSheetForSingleHtmlElement(
          HtmlElement element,
          BoxSpec parentSpec,
          TopDownActiveCssTemplate activeCssTemplate)
        {
            BoxSpec curSpec = element.Spec;
            BoxSpec.InheritStyles(curSpec, parentSpec);
            //--------------------------------
            string classValue = null;
            if (element.HasAttributeClass)
            {
                classValue = element.AttrClassValue;
            }
            //-------------------------------- 
            //1. apply style  
            activeCssTemplate.ApplyCacheTemplate(element.LocalName,
                 classValue,//class
                 curSpec,
                 parentSpec);
            //-------------------------------------------------------------------  
            //2. specific id 
            if (element.HasAttributeElementId)
            {
                // element.ElementId;
                activeCssTemplate.ApplyActiveTemplateForSpecificElementId(element);
            }
            //3. some html translate attributes

            if (element.WellknownElementName != WellKnownDomNodeName.svg)
            {
                //translate svg attributes
                AssignStylesFromTranslatedAttributesHTML5(element);
            }
            else
            {
                AssignSvgAttributes(element);
            }
            //------------------------------------------------------------------- 
            //4. style attribute value 
            //'style' object of this element
            if (!element.IsStyleEvaluated)
            {
                CssRuleSet parsedRuleSet = null;
                string attrStyleValue;
                if (element.TryGetAttribute(WellknownName.Style, out attrStyleValue))
                {
                    //parse and evaluate the ruleset
                    parsedRuleSet = miniCssParser.ParseCssPropertyDeclarationList(attrStyleValue.ToCharArray());
                    foreach (WebDom.CssPropertyDeclaration propDecl in parsedRuleSet.GetAssignmentIter())
                    {
                        SpecSetter.AssignPropertyValue(
                            curSpec,
                            parentSpec,
                            propDecl);
                    }
                }
                else
                {
                }
                //----------------------------------------------------------------
                element.IsStyleEvaluated = true;
                element.ElementRuleSet = parsedRuleSet;
            }
            else
            {
                var elemRuleSet = element.ElementRuleSet;
                if (elemRuleSet != null)
                {
                    if (curSpec.IsFreezed)
                    {
                        curSpec.Defreeze();
                        //var newspec = new BoxSpec();
                        //BoxSpec.CloneAllStyles(newspec, curSpec);
                        //curSpec = newspec;
                        //element.Spec = curSpec;
                    }

                    foreach (WebDom.CssPropertyDeclaration propDecl in elemRuleSet.GetAssignmentIter())
                    {
                        SpecSetter.AssignPropertyValue(
                            curSpec,
                            parentSpec,
                            propDecl);
                    }
                }
            }
            //===================== 
            curSpec.Freeze(); //***
            //===================== 
        }
Beispiel #17
0
        /// <summary>
        /// assign property value from parent
        /// </summary>
        /// <param name="spec"></param>
        /// <param name="propName"></param>
        static void SetPropertyValueFromParent(BoxSpec spec, BoxSpec parentSpec, WellknownCssPropertyName propName)
        {
            switch (propName)
            {
                case WellknownCssPropertyName.BorderBottomWidth:
                    spec.BorderBottomWidth = parentSpec.BorderBottomWidth;
                    break;
                case WellknownCssPropertyName.BorderLeftWidth:
                    spec.BorderLeftWidth = parentSpec.BorderLeftWidth;
                    break;
                case WellknownCssPropertyName.BorderRightWidth:
                    spec.BorderRightWidth = parentSpec.BorderRightWidth;
                    break;
                case WellknownCssPropertyName.BorderTopWidth:
                    spec.BorderTopWidth = parentSpec.BorderTopWidth;
                    break;
                //------------------------------------------------
                case WellknownCssPropertyName.BorderBottomStyle:
                    spec.BorderBottomStyle = parentSpec.BorderBottomStyle;
                    break;
                case WellknownCssPropertyName.BorderLeftStyle:
                    spec.BorderLeftStyle = parentSpec.BorderBottomStyle;
                    break;
                case WellknownCssPropertyName.BorderRightStyle:
                    spec.BorderRightStyle = parentSpec.BorderRightStyle;
                    break;
                case WellknownCssPropertyName.BorderTopStyle:
                    spec.BorderTopStyle = parentSpec.BorderTopStyle;
                    break;
                //------------------------------------------------
                case WellknownCssPropertyName.BorderBottomColor:
                    spec.BorderBottomColor = parentSpec.BorderBottomColor;
                    break;
                case WellknownCssPropertyName.BorderLeftColor:
                    spec.BorderLeftColor = parentSpec.BorderLeftColor;
                    break;
                case WellknownCssPropertyName.BorderRightColor:
                    spec.BorderRightColor = parentSpec.BorderRightColor;
                    break;
                case WellknownCssPropertyName.BorderTopColor:
                    spec.BorderTopColor = parentSpec.BorderTopColor;
                    break;
                //------------------------------------------------
                case WellknownCssPropertyName.BorderSpacing:

                    spec.BorderSpacingHorizontal = parentSpec.BorderSpacingHorizontal;
                    spec.BorderSpacingVertical = parentSpec.BorderSpacingVertical;
                    break;
                case WellknownCssPropertyName.BorderCollapse:
                    spec.BorderCollapse = parentSpec.BorderCollapse;
                    break;
                //------------------------------------------------
                case WellknownCssPropertyName.CornerRadius:
                    spec.CornerNERadius = parentSpec.CornerNERadius;
                    spec.CornerNWRadius = parentSpec.CornerNWRadius;
                    spec.CornerSERadius = parentSpec.CornerSERadius;
                    spec.CornerSWRadius = parentSpec.CornerSWRadius;
                    break;
                case WellknownCssPropertyName.CornerNWRadius:

                    spec.CornerNWRadius = parentSpec.CornerNWRadius;
                    break;
                case WellknownCssPropertyName.CornerNERadius:
                    spec.CornerNERadius = parentSpec.CornerNERadius;
                    break;
                case WellknownCssPropertyName.CornerSERadius:
                    spec.CornerSERadius = parentSpec.CornerSERadius;
                    break;
                case WellknownCssPropertyName.CornerSWRadius:
                    spec.CornerSWRadius = parentSpec.CornerSWRadius;
                    break;
                //------------------------------------------------
                case WellknownCssPropertyName.MarginBottom:
                    spec.MarginBottom = parentSpec.MarginBottom;
                    break;
                case WellknownCssPropertyName.MarginLeft:
                    spec.MarginLeft = parentSpec.MarginLeft;
                    break;
                case WellknownCssPropertyName.MarginRight:
                    spec.MarginRight = parentSpec.MarginRight;
                    break;
                case WellknownCssPropertyName.MarginTop:
                    spec.MarginTop = parentSpec.MarginTop;
                    break;
                //------------------------------------------------
                case WellknownCssPropertyName.PaddingBottom:
                    spec.PaddingBottom = parentSpec.PaddingBottom;
                    break;
                case WellknownCssPropertyName.PaddingLeft:
                    spec.PaddingLeft = parentSpec.PaddingLeft;
                    break;
                case WellknownCssPropertyName.PaddingRight:
                    spec.PaddingRight = parentSpec.PaddingRight;
                    break;
                case WellknownCssPropertyName.PaddingTop:
                    spec.PaddingTop = parentSpec.PaddingTop;
                    break;
                //------------------------------------------------
                case WellknownCssPropertyName.Left:
                    spec.Left = parentSpec.Left;
                    break;
                case WellknownCssPropertyName.Top:
                    spec.Top = parentSpec.Top;
                    break;
                case WellknownCssPropertyName.Width:
                    spec.Width = parentSpec.Width;
                    break;
                case WellknownCssPropertyName.MaxWidth:
                    spec.MaxWidth = parentSpec.MaxWidth;
                    break;
                case WellknownCssPropertyName.Height:
                    spec.Height = parentSpec.Height;
                    break;
                case WellknownCssPropertyName.BackgroundColor:
                    spec.BackgroundColor = parentSpec.BackgroundColor;
                    break;
                case WellknownCssPropertyName.BackgroundImage:
                    spec.BackgroundImageBinder = parentSpec.BackgroundImageBinder;
                    break;
                case WellknownCssPropertyName.BackgroundPosition:
                    spec.BackgroundPositionX = parentSpec.BackgroundPositionX;
                    spec.BackgroundPositionY = parentSpec.BackgroundPositionY;
                    break;
                case WellknownCssPropertyName.BackgroundRepeat:
                    spec.BackgroundRepeat = parentSpec.BackgroundRepeat;
                    break;
                case WellknownCssPropertyName.BackgroundGradient:
                    spec.BackgroundGradient = parentSpec.BackgroundGradient;
                    break;
                case WellknownCssPropertyName.BackgroundGradientAngle:
                    {
                        spec.BackgroundGradientAngle = parentSpec.BackgroundGradientAngle;
                    }
                    break;
                case WellknownCssPropertyName.Color:
                    spec.Color = parentSpec.Color;
                    break;
                case WellknownCssPropertyName.Display:
                    spec.CssDisplay = parentSpec.CssDisplay;
                    break;
                case WellknownCssPropertyName.Direction:
                    spec.CssDirection = parentSpec.CssDirection;
                    break;
                case WellknownCssPropertyName.EmptyCells:
                    spec.EmptyCells = parentSpec.EmptyCells;
                    break;
                case WellknownCssPropertyName.Float:
                    spec.Float = parentSpec.Float;
                    break;
                case WellknownCssPropertyName.Position:
                    spec.Position = parentSpec.Position;
                    break;
                case WellknownCssPropertyName.LineHeight:
                    spec.LineHeight = parentSpec.LineHeight;
                    break;
                case WellknownCssPropertyName.VerticalAlign:
                    spec.VerticalAlign = parentSpec.VerticalAlign;
                    break;
                case WellknownCssPropertyName.TextIndent:
                    spec.TextIndent = parentSpec.TextIndent;
                    break;
                case WellknownCssPropertyName.TextAlign:
                    spec.CssTextAlign = parentSpec.CssTextAlign;
                    break;
                case WellknownCssPropertyName.TextDecoration:
                    spec.TextDecoration = parentSpec.TextDecoration;
                    break;
                case WellknownCssPropertyName.Whitespace:
                    spec.WhiteSpace = parentSpec.WhiteSpace;
                    break;
                case WellknownCssPropertyName.WordBreak:
                    spec.WordBreak = parentSpec.WordBreak;
                    break;
                case WellknownCssPropertyName.Visibility:
                    spec.Visibility = parentSpec.Visibility;
                    break;
                case WellknownCssPropertyName.WordSpacing:
                    spec.WordSpacing = parentSpec.WordSpacing;
                    break;
                case WellknownCssPropertyName.FontFamily:
                    spec.FontFamily = parentSpec.FontFamily;
                    //cssBox.FontFamily = value;
                    break;
                case WellknownCssPropertyName.FontSize:
                    spec.FontSize = parentSpec.FontSize;
                    break;
                case WellknownCssPropertyName.FontStyle:
                    spec.FontStyle = parentSpec.FontStyle;
                    break;
                case WellknownCssPropertyName.FontVariant:
                    spec.FontVariant = parentSpec.FontVariant;
                    break;
                case WellknownCssPropertyName.FontWeight:
                    spec.FontWeight = parentSpec.FontWeight;
                    break;
                case WellknownCssPropertyName.ListStyle:

                    spec.ListStyle = parentSpec.ListStyle;
                    break;
                case WellknownCssPropertyName.ListStylePosition:
                    spec.ListStylePosition = parentSpec.ListStylePosition;
                    break;
                case WellknownCssPropertyName.ListStyleImage:

                    spec.ListStyleImage = parentSpec.ListStyleImage;
                    break;
                case WellknownCssPropertyName.ListStyleType:

                    spec.ListStyleType = parentSpec.ListStyleType;
                    break;
                case WellknownCssPropertyName.Overflow:
                    spec.Overflow = parentSpec.Overflow;
                    break;
                case WellknownCssPropertyName.BoxSizing:
                    spec.BoxSizing = parentSpec.BoxSizing;
                    break;
            }
        }
Beispiel #18
0
 public static void AddRunList(CssBox toBox, BoxSpec spec, HtmlTextNode textnode)
 {
     AddRunList(toBox, spec, textnode.InternalGetRuns(), textnode.GetOriginalBuffer(), textnode.IsWhiteSpace);
 }
        LayoutFarm.HtmlBoxes.CssBox CreateInputBox(DomElement domE,
            LayoutFarm.HtmlBoxes.CssBox parentBox,
            BoxSpec spec,
            LayoutFarm.RootGraphic rootgfx, HtmlHost host)
        {
            var typeAttr = domE.FindAttribute("type");
            if (typeAttr != null)
            {
                switch (typeAttr.Value)
                {
                    case "text":
                        {
                            // user can specific width of textbox 
                            //var textbox = new LayoutFarm.CustomWidgets.TextBox(100, 17, false);
                            var textbox = new LayoutFarm.CustomWidgets.TextBoxContainer(100, 20, false);
                            var wrapperBox = CreateWrapper(
                                 textbox,
                                 textbox.GetPrimaryRenderElement(rootgfx),
                                 spec, true);
                            //place holder support
                            var placeHolderAttr = domE.FindAttribute("placeholder");
                            if (placeHolderAttr != null)
                            {
                                textbox.PlaceHolderText = placeHolderAttr.Value;
                            }
                            parentBox.AppendChild(wrapperBox);
                            return wrapperBox;
                        }
                    case "button":
                        {
                            //use subdom? technique
                            //todo: review the technique here
                            var button = new HtmlWidgets.Button(60, 30);
                            var ihtmlElement = domE as LayoutFarm.WebDom.IHtmlElement;
                            if (ihtmlElement != null)
                            {
                                button.Text = ihtmlElement.innerHTML;
                            }
                            else
                            {
                                button.Text = "";
                            }
                            button.Text = "testButton";
                            DomElement buttonDom = button.GetPresentationDomNode((HtmlDocument)domE.OwnerDocument);
                            CssBox buttonCssBox = host.CreateBox2(parentBox, (WebDom.Impl.HtmlElement)buttonDom, true); // CreateCssBox(buttonDom, parentBox, spec, host);
                            //var ui = button.GetPrimaryUIElement(this.myHost);

                            //var wrapperBox = CreateWrapper(
                            //    button,
                            //    ui.GetPrimaryRenderElement(rootgfx),
                            //    spec, true);
                            //parentBox.AppendChild(wrapperBox);
                            //return wrapperBox;

                            parentBox.AppendChild(buttonCssBox);
                            return buttonCssBox;
                        }
                    case "textbox":
                        {
                            var textbox = new LayoutFarm.CustomWidgets.TextBox(100, 17, false);
                            CssBox wrapperBox = CreateWrapper(
                                 textbox,
                                 textbox.GetPrimaryRenderElement(rootgfx),
                                 spec, true);
                            parentBox.AppendChild(wrapperBox);
                            return wrapperBox;
                        }
                    case "radio":
                        {
                            //tempfix -> just copy the Button code,
                            //TODO: review here, use proper radio button 
                            var box = new LayoutFarm.CustomWidgets.SimpleBox(20, 20);
                            CssBox wrapperBox = CreateWrapper(
                                 box,
                                 box.GetPrimaryRenderElement(rootgfx),
                                 spec, true);
                            parentBox.AppendChild(wrapperBox);
                            return wrapperBox;
                        }
                        break;
                }
            }
            return null;
        }
Beispiel #20
0
        static void SetPropertyValue(BoxSpec spec, WebDom.CssPropertyDeclaration decl)
        {
            //assign property  
            CssCodeValueExpression cssValue = decl.GetPropertyValue(0);
            switch (decl.WellknownPropertyName)
            {
                case WellknownCssPropertyName.Display:
                    spec.CssDisplay = UserMapUtil.GetDisplayType(cssValue);
                    break;
                //------------------------------------------------
                case WellknownCssPropertyName.BorderBottomWidth:
                    spec.BorderBottomWidth = cssValue.AsBorderLength();
                    break;
                case WellknownCssPropertyName.BorderLeftWidth:
                    spec.BorderLeftWidth = cssValue.AsBorderLength();
                    break;
                case WellknownCssPropertyName.BorderRightWidth:
                    spec.BorderRightWidth = cssValue.AsBorderLength();
                    break;
                case WellknownCssPropertyName.BorderTopWidth:
                    spec.BorderTopWidth = cssValue.AsBorderLength();
                    break;
                //------------------------------------------------
                case WellknownCssPropertyName.BorderBottomStyle:
                    spec.BorderBottomStyle = UserMapUtil.GetBorderStyle(cssValue);
                    break;
                case WellknownCssPropertyName.BorderLeftStyle:
                    spec.BorderLeftStyle = UserMapUtil.GetBorderStyle(cssValue);
                    break;
                case WellknownCssPropertyName.BorderRightStyle:
                    spec.BorderRightStyle = UserMapUtil.GetBorderStyle(cssValue);
                    break;
                case WellknownCssPropertyName.BorderTopStyle:
                    spec.BorderTopStyle = UserMapUtil.GetBorderStyle(cssValue);
                    break;
                //------------------------------------------------
                case WellknownCssPropertyName.BorderBottomColor:
                    spec.BorderBottomColor = AsColor(cssValue);
                    break;
                case WellknownCssPropertyName.BorderLeftColor:
                    spec.BorderLeftColor = AsColor(cssValue);
                    break;
                case WellknownCssPropertyName.BorderRightColor:
                    spec.BorderRightColor = AsColor(cssValue);
                    break;
                case WellknownCssPropertyName.BorderTopColor:
                    spec.BorderTopColor = AsColor(cssValue); ;
                    break;
                //------------------------------------------------
                case WellknownCssPropertyName.BorderSpacing:

                    SetBorderSpacing(spec, cssValue);
                    break;
                case WellknownCssPropertyName.BorderCollapse:
                    spec.BorderCollapse = UserMapUtil.GetBorderCollapse(cssValue);
                    break;
                //------------------------------------------------
                case WellknownCssPropertyName.BoxSizing:
                    spec.BoxSizing = UserMapUtil.GetBoxSizing(cssValue);
                    break;
                case WellknownCssPropertyName.BoxShadow:
                    SetBoxShadow(spec, decl);
                    break;
                case WellknownCssPropertyName.CornerRadius:

                    SetCornerRadius(spec, cssValue);
                    break;
                case WellknownCssPropertyName.CornerNWRadius:
                    spec.CornerNWRadius = cssValue.AsLength();
                    break;
                case WellknownCssPropertyName.CornerNERadius:
                    spec.CornerNERadius = cssValue.AsLength();
                    break;
                case WellknownCssPropertyName.CornerSERadius:
                    spec.CornerSERadius = cssValue.AsLength();
                    break;
                case WellknownCssPropertyName.CornerSWRadius:
                    spec.CornerSWRadius = cssValue.AsLength();
                    break;
                //------------------------------------------------
                case WellknownCssPropertyName.MarginBottom:
                    spec.MarginBottom = cssValue.AsTranslatedLength();
                    break;
                case WellknownCssPropertyName.MarginLeft:
                    spec.MarginLeft = cssValue.AsTranslatedLength();
                    break;
                case WellknownCssPropertyName.MarginRight:
                    spec.MarginRight = cssValue.AsTranslatedLength();
                    break;
                case WellknownCssPropertyName.MarginTop:
                    spec.MarginTop = cssValue.AsTranslatedLength();
                    break;
                //------------------------------------------------
                case WellknownCssPropertyName.PaddingBottom:
                    spec.PaddingBottom = cssValue.AsTranslatedLength();
                    break;
                case WellknownCssPropertyName.PaddingLeft:
                    spec.PaddingLeft = cssValue.AsTranslatedLength();
                    break;
                case WellknownCssPropertyName.PaddingRight:
                    spec.PaddingRight = cssValue.AsTranslatedLength();
                    break;
                case WellknownCssPropertyName.PaddingTop:
                    spec.PaddingTop = cssValue.AsTranslatedLength();
                    break;
                //------------------------------------------------
                case WellknownCssPropertyName.Left:
                    spec.Left = cssValue.AsLength();
                    break;
                case WellknownCssPropertyName.Top:
                    spec.Top = cssValue.AsLength();
                    break;
                case WellknownCssPropertyName.Width:
                    spec.Width = cssValue.AsLength();
                    break;
                case WellknownCssPropertyName.MaxWidth:
                    spec.MaxWidth = cssValue.AsLength();
                    break;
                case WellknownCssPropertyName.Height:
                    spec.Height = cssValue.AsLength();
                    break;
                case WellknownCssPropertyName.BackgroundColor:
                    spec.BackgroundColor = AsColor(cssValue);
                    break;
                case WellknownCssPropertyName.BackgroundImage:
                    spec.BackgroundImageBinder = new ClientImageBinder(cssValue.GetTranslatedStringValue());
                    break;
                case WellknownCssPropertyName.BackgroundPosition:
                    SetBackgroundPosition(spec, cssValue);
                    break;
                case WellknownCssPropertyName.BackgroundRepeat:
                    spec.BackgroundRepeat = UserMapUtil.GetBackgroundRepeat(cssValue);
                    break;
                case WellknownCssPropertyName.BackgroundGradient:
                    spec.BackgroundGradient = AsColor(cssValue);
                    break;
                case WellknownCssPropertyName.BackgroundGradientAngle:
                    spec.BackgroundGradientAngle = cssValue.AsNumber();
                    break;
                case WellknownCssPropertyName.Color:
                    spec.Color = AsColor(cssValue);
                    break;
                case WellknownCssPropertyName.Direction:
                    spec.CssDirection = UserMapUtil.GetCssDirection(cssValue);
                    break;
                case WellknownCssPropertyName.EmptyCells:
                    spec.EmptyCells = UserMapUtil.GetEmptyCell(cssValue);
                    break;
                case WellknownCssPropertyName.Float:
                    spec.Float = UserMapUtil.GetFloat(cssValue);
                    break;
                case WellknownCssPropertyName.Position:
                    spec.Position = UserMapUtil.GetCssPosition(cssValue);
                    break;
                case WellknownCssPropertyName.LineHeight:
                    spec.LineHeight = cssValue.AsLength();
                    break;
                case WellknownCssPropertyName.VerticalAlign:
                    spec.VerticalAlign = UserMapUtil.GetVerticalAlign(cssValue);
                    break;
                case WellknownCssPropertyName.TextIndent:
                    spec.TextIndent = cssValue.AsLength();
                    break;
                case WellknownCssPropertyName.TextAlign:

                    spec.CssTextAlign = UserMapUtil.GetTextAlign(cssValue);
                    break;
                case WellknownCssPropertyName.TextDecoration:
                    spec.TextDecoration = UserMapUtil.GetTextDecoration(cssValue);
                    break;
                case WellknownCssPropertyName.Whitespace:
                    spec.WhiteSpace = UserMapUtil.GetWhitespace(cssValue);
                    break;
                case WellknownCssPropertyName.WordBreak:
                    spec.WordBreak = UserMapUtil.GetWordBreak(cssValue);
                    break;
                case WellknownCssPropertyName.Visibility:
                    spec.Visibility = UserMapUtil.GetVisibility(cssValue);
                    break;
                case WellknownCssPropertyName.WordSpacing:
                    spec.WordSpacing = cssValue.AsLength();
                    break;
                case WellknownCssPropertyName.FontFamily:
                    spec.FontFamily = cssValue.GetTranslatedStringValue();
                    break;
                case WellknownCssPropertyName.FontSize:

                    SetFontSize(spec, cssValue);
                    break;
                case WellknownCssPropertyName.FontStyle:
                    spec.FontStyle = UserMapUtil.GetFontStyle(cssValue);
                    break;
                case WellknownCssPropertyName.FontVariant:
                    spec.FontVariant = UserMapUtil.GetFontVariant(cssValue);
                    break;
                case WellknownCssPropertyName.FontWeight:
                    spec.FontWeight = UserMapUtil.GetFontWeight(cssValue);
                    break;
                case WellknownCssPropertyName.ListStyle:
                    spec.ListStyle = cssValue.GetTranslatedStringValue();
                    break;
                case WellknownCssPropertyName.ListStylePosition:
                    spec.ListStylePosition = UserMapUtil.GetListStylePosition(cssValue);
                    break;
                case WellknownCssPropertyName.ListStyleImage:
                    spec.ListStyleImage = cssValue.GetTranslatedStringValue();
                    break;
                case WellknownCssPropertyName.ListStyleType:
                    spec.ListStyleType = UserMapUtil.GetListStyleType(cssValue);
                    break;
                case WellknownCssPropertyName.Overflow:
                    spec.Overflow = UserMapUtil.GetOverflow(cssValue);
                    break;
                //------------------------------------------------ 
                //for flex container
                case WellknownCssPropertyName.Flex:
                    {
                        //TODO: implement this
                    }
                    break;
                case WellknownCssPropertyName.FlexDirection:
                    {
                        //TODO: implement this
                    }
                    break;
                case WellknownCssPropertyName.FlexFlow:
                    {
                        //TODO: implement this
                    }
                    break;
                case WellknownCssPropertyName.FlexWrap:
                    {
                        //TODO: implement this
                    }
                    break;
                //------------------------------------------------ 
                //for flex item
                case WellknownCssPropertyName.FlexGrow:
                    spec.FlexGrow = (int)cssValue.AsNumber();
                    break;
                case WellknownCssPropertyName.FlexShrink:
                    spec.FlexShrink = (int)cssValue.AsNumber();
                    break;
                case WellknownCssPropertyName.FlexOrder:
                    spec.FlexOrder = (int)cssValue.AsNumber();
                    break;
                //------------------------------------------------   
                //experiment : for container
                case WellknownCssPropertyName.FlexExtensionNum:
                    spec.FlexExtensionNum = (int)cssValue.AsNumber();
                    break;
                //experiment : for space part
                case WellknownCssPropertyName.FlexExtensionPart:
                    spec.FlexExtensionPart = (int)cssValue.AsNumber();
                    break;
            }
        }
        internal void ParseWordContent(
            char[] textBuffer,
            BoxSpec spec,
            bool isBlock,
            List<CssRun> runlistOutput,
            out bool hasSomeCharacter)
        {
            bool preserverLine = false;
            bool preserveWhiteSpace = false;
            var isblock = spec.CssDisplay == CssDisplay.Block;
            switch (spec.WhiteSpace)
            {
                case CssWhiteSpace.Pre:
                case CssWhiteSpace.PreWrap:
                    //run and preserve whitespace  
                    preserveWhiteSpace = true;
                    preserverLine = true;
                    break;
                case CssWhiteSpace.PreLine:
                    preserverLine = true;
                    break;
            }

            //---------------------------------------
            //1. check if has some text 
            //--------------------------------------

            hasSomeCharacter = false;
            //--------------------------------------
            //just parse and preserve all whitespace
            //--------------------------------------  
            int startIndex = 0;
            int buffLength = textBuffer.Length;
            //whitespace and respect newline  
            WordParsingState parsingState = WordParsingState.Init;
            int appendLength = 0;
            //--------------------------------------  

            //some text
            bool needFinerTextParser = false;

            for (int i = 0; i < buffLength; ++i)
            {
                char c0 = textBuffer[i];
                if (c0 == '\r')
                {
                    continue;
                }
                //----------------------------------------
                //switch by state  
                switch (parsingState)
                {
                    case WordParsingState.Init:
                        {
                            if (char.IsWhiteSpace(c0))
                            {
                                if (c0 == '\n')
                                {
                                    if (preserverLine)
                                    {
                                        runlistOutput.Add(CssTextRun.CreateLineBreak());
                                        appendLength = 0; //clear append length 
                                        continue;
                                    }
                                }
                                parsingState = WordParsingState.Whitespace;
                                //start collect whitespace
                                startIndex = i;
                                appendLength = 1;//start collect whitespace
                            }
                            else if (char.IsPunctuation(c0))
                            {
                                parsingState = WordParsingState.Init;
                                startIndex = i;
                                appendLength = 1;
                                //add single token
                                runlistOutput.Add(CssTextRun.CreateTextRun(startIndex, appendLength));
                            }
                            else
                            {
                                //character  
                                if (c0 > '~') { needFinerTextParser = true; }

                                parsingState = WordParsingState.CharacterCollecting;
                                startIndex = i;
                                appendLength = 1;//start collect whitespace 
                            }
                        }
                        break;
                    case WordParsingState.Whitespace:
                        {
                            if (char.IsWhiteSpace(c0))
                            {
                                if (c0 == '\n')
                                {
                                    if (preserverLine)
                                    {
                                        runlistOutput.Add(CssTextRun.CreateLineBreak());
                                        appendLength = 0; //clear append length 
                                        continue;
                                    }
                                }
                                if (appendLength == 0)
                                {
                                    startIndex = i;
                                }

                                appendLength++;
                            }
                            else
                            {
                                runlistOutput.Add(CssTextRun.CreateWhitespace(preserveWhiteSpace ? appendLength : 1));
                                if (char.IsPunctuation(c0))
                                {
                                    parsingState = WordParsingState.Init;
                                    startIndex = i;
                                    appendLength = 1;
                                    //add single token
                                    runlistOutput.Add(CssTextRun.CreateTextRun(startIndex, appendLength));
                                }
                                else
                                {
                                    if (c0 > '~') { needFinerTextParser = true; }

                                    parsingState = WordParsingState.CharacterCollecting;
                                    startIndex = i;//start collect
                                    appendLength = 1;//start append length 
                                }
                            }
                        }
                        break;
                    case WordParsingState.CharacterCollecting:
                        {
                            bool isWhiteSpace;
                            if ((isWhiteSpace = char.IsWhiteSpace(c0)) || char.IsPunctuation(c0))
                            {
                                //flush collecting token  
                                if (needFinerTextParser && TextBreaker != null)
                                {

                                    CreateTextRuns(textBuffer, runlistOutput, startIndex, appendLength);
                                    needFinerTextParser = false;//reset                                     
                                }
                                else
                                {
                                    runlistOutput.Add(CssTextRun.CreateTextRun(startIndex, appendLength));
                                }

                                hasSomeCharacter = true;
                                startIndex = i;//start collect
                                appendLength = 1; //collect whitespace
                                if (isWhiteSpace)
                                {
                                    if (c0 == '\n')
                                    {
                                        if (preserverLine)
                                        {
                                            runlistOutput.Add(CssTextRun.CreateLineBreak());
                                            appendLength = 0; //clear append length 
                                            continue;
                                        }
                                    }
                                    parsingState = WordParsingState.Whitespace;
                                }
                                else
                                {
                                    parsingState = WordParsingState.Init;
                                    runlistOutput.Add(CssTextRun.CreateTextRun(startIndex, appendLength));
                                }
                                //---------------------------------------- 
                            }
                            else
                            {
                                if (c0 > '~') { needFinerTextParser = true; }

                                if (appendLength == 0)
                                {
                                    startIndex = i;
                                }
                                appendLength++;
                            }
                        }
                        break;
                }
            }
            //--------------------

            if (appendLength > 0)
            {
                switch (parsingState)
                {
                    case WordParsingState.Whitespace:
                        {
                            //last with whitespace
                            if (preserveWhiteSpace)
                            {
                                runlistOutput.Add(CssTextRun.CreateWhitespace(appendLength));
                            }
                            else
                            {
                                if (!isblock || (runlistOutput.Count > 0))
                                {
                                    runlistOutput.Add(CssTextRun.CreateWhitespace(1));
                                }
                            }
                        }
                        break;
                    case WordParsingState.CharacterCollecting:
                        {
                            if (needFinerTextParser && TextBreaker != null)
                            {
                                CreateTextRuns(textBuffer, runlistOutput, startIndex, appendLength);
                                needFinerTextParser = false;//reset
                            }
                            else
                            {
                                runlistOutput.Add(CssTextRun.CreateTextRun(startIndex, appendLength));
                            }

                            hasSomeCharacter = true;
                        }
                        break;
                }
            }
        }
 public void AddBoxSpec(CssTemplateKey key, BoxSpec spec)
 {
     //add box spec at this level
     if (specCollections == null)
     {
         specCollections = new Dictionary<CssTemplateKey, BoxSpec>();
     }
     //add or replace if exists
     specCollections[key] = spec;
 }
Beispiel #23
0
 static void SetBoxShadow(BoxSpec box, WebDom.CssPropertyDeclaration decl)
 {
     switch (decl.ValueCount)
     {
         case 2:
             {
                 //
                 var v0 = decl.GetPropertyValue(0);
                 var v1 = decl.GetPropertyValue(1);
                 box.BoxShadowHOffset = v0.AsLength();
                 box.BoxShadowVOffset = v1.AsLength();
             }
             break;
         case 3:
             {
                 var v0 = decl.GetPropertyValue(0);
                 var v1 = decl.GetPropertyValue(1);
                 var v2 = decl.GetPropertyValue(2);
                 box.BoxShadowHOffset = v0.AsLength();
                 box.BoxShadowVOffset = v1.AsLength();
                 box.BoxShadowColor = AsColor(v2);
             }
             break;
     }
 }
 public WrapperBlockCssBox(object controller,
      BoxSpec spec,
      RenderElement renderElement)
     : base(controller, spec, renderElement.Root, CssDisplay.Block)
 {
     SetAsCustomCssBox(this);
     int w = renderElement.Width;
     int h = renderElement.Height;
     this.renderE = renderElement;
     ChangeDisplayType(this, CssDisplay.Block);
     this.SetVisualSize(w, h);
     LayoutFarm.RenderElement.SetParentLink(renderElement, this);
 }
Beispiel #25
0
 internal static CssBox CreateBridgeBox(IFonts iFonts, LayoutFarm.RenderElement containerElement, RootGraphic rootgfx)
 {
     var spec = new BoxSpec();
     spec.CssDisplay = CssDisplay.Block;
     spec.Freeze();
     var box = new RenderElementBridgeCssBox(spec, containerElement, rootgfx);
     //------------------------------------
     box.ReEvaluateFont(iFonts, 10);
     //------------------------------------
     return box;
 }
 public abstract CssBox CreateCssBox(LayoutFarm.WebDom.DomElement tag,
     CssBox parentBox, BoxSpec spec, HtmlHost host);
Beispiel #27
0
 public CssIsolateBox(BoxSpec spec, RootGraphic rootgfx)
     : base(spec, rootgfx)
 {
 }
 void CacheBoxSpec(CssTemplateKey key, BoxSpec spec)
 {
     //add at last(top) level
     specLevels[specLevels.Count - 1].AddBoxSpec(key, spec);
 }
Beispiel #29
0
 internal static CssBox CreateIsolateBox(IFonts iFonts, RootGraphic rootgfx)
 {
     var spec = new BoxSpec();
     spec.CssDisplay = CssDisplay.Block;
     spec.Freeze();
     var box = new CssIsolateBox(spec, rootgfx);
     //------------------------------------
     box.ReEvaluateFont(iFonts, 10);
     //------------------------------------
     return box;
 }
        internal void ApplyCacheTemplate(string elemName,
             string class_value,
             BoxSpec currentBoxSpec,
             BoxSpec parentSpec)
        {
            //1. tag name key
            int tagNameKey = ustrTable.AddStringIfNotExist(elemName);
            //2. class name key
            int classNameKey = 0;
            if (class_value != null)
            {
                classNameKey = ustrTable.AddStringIfNotExist(class_value);
            }
            //find cache in the same level
            var templateKey = new CssTemplateKey(tagNameKey, classNameKey);
            //BoxSpec boxTemplate = SearchUpBoxSpec(templateKey);
            BoxSpec boxTemplate = null;
            if (boxTemplate != null)
            {
                BoxSpec.CloneAllStyles(currentBoxSpec, boxTemplate);
            }
            else
            {
                //create template for specific key  
                boxTemplate = new BoxSpec();
                //copy current spec to boxTemplate
                BoxSpec.CloneAllStyles(boxTemplate, currentBoxSpec);
                //*** 
                //----------------------------
                //1. tag name
                CssRuleSetGroup ruleGroup = activeSheet.GetRuleSetForTagName(elemName);
                if (ruleGroup != null)
                {
                    //currentBoxSpec.VersionNumber++;
                    foreach (WebDom.CssPropertyDeclaration decl in ruleGroup.GetPropertyDeclIter())
                    {
                        SpecSetter.AssignPropertyValue(boxTemplate, parentSpec, decl);
                    }
                }
                //----------------------------
                //2. series of class
                if (class_value != null)
                {
                    //currentBoxSpec.VersionNumber++;
                    string[] classNames = class_value.Split(_whiteSplitter, StringSplitOptions.RemoveEmptyEntries);
                    int j = classNames.Length;
                    if (j > 0)
                    {
                        for (int i = 0; i < j; ++i)
                        {
                            CssRuleSetGroup ruleSetGroup = activeSheet.GetRuleSetForClassName(classNames[i]);
                            if (ruleSetGroup != null)
                            {
                                foreach (var propDecl in ruleSetGroup.GetPropertyDeclIter())
                                {
                                    SpecSetter.AssignPropertyValue(boxTemplate, parentSpec, propDecl);
                                }
                                //---------------------------------------------------------
                                //find subgroup for more specific conditions
                                int subgroupCount = ruleSetGroup.SubGroupCount;
                                for (int m = 0; m < subgroupCount; ++m)
                                {
                                    //find if selector condition match with this box
                                    CssRuleSetGroup ruleSetSubGroup = ruleSetGroup.GetSubGroup(m);
                                    var selector = ruleSetSubGroup.OriginalSelector;
                                }
                            }
                        }
                    }
                }

                boxTemplate.Freeze();
                //this.CacheBoxSpec(templateKey, boxTemplate); 
                boxTemplate.IsTemplate = true;
                //copy back from template to currentBoxSpec
                BoxSpec.CloneAllStyles(currentBoxSpec, boxTemplate);
            }
        }