UpdateChildBoxes() private method

private UpdateChildBoxes ( HtmlElement parentElement, bool fullmode ) : void
parentElement LayoutFarm.Composers.HtmlElement
fullmode bool update all nodes (true) or somenode (false)
return void
Esempio n. 1
0
        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 override CssBox GetPrincipalBox(CssBox parentCssBox, HtmlHost htmlHost)
        {
            if (rootbox != null)
            {
                return this.rootbox;
            }
            else
            {
                var root = (HtmlElement)shadowDoc.RootNode;
                //1. builder 
                var renderTreeBuilder = htmlHost.GetRenderTreeBuilder();
                //------------------------------------------------------------------- 
                //2. generate render tree
                ////build rootbox from htmldoc

                var rootElement = renderTreeBuilder.BuildCssRenderTree2(shadowDoc,
                    htmlHost.BaseStylesheet,
                    htmlHost.RootGfx);
                //3. create small htmlContainer

                rootbox = new CssBox(this.Spec, parentCssBox.RootGfx);
                root.SetPrincipalBox(rootbox);
                htmlHost.UpdateChildBoxes(root, true);
                return rootbox;
            }
        }