コード例 #1
0
        public CssBox BuildCssRenderTree(WebDocument webdoc,
                                         CssActiveSheet cssActiveSheet,
                                         RenderElement containerElement)
        {
            HtmlDocument htmldoc = webdoc as HtmlDocument;

            if (htmldoc == null)
            {
                //TODO: fixed here
                throw new NotSupportedException();
            }
            htmldoc.CssActiveSheet = cssActiveSheet;
            htmldoc.SetDocumentState(DocumentState.Building);
            //----------------------------------------------------------------

            TopDownActiveCssTemplate activeTemplate = new TopDownActiveCssTemplate(cssActiveSheet);

            PrepareStylesAndContentOfChildNodes((HtmlElement)htmldoc.RootNode, activeTemplate);
            //----------------------------------------------------------------


            //TODO: review here, we should create cssbox at  document.body?
            CssBox bridgeBox = HtmlHost.CreateBridgeBox(_htmlHost.GetHtmlTextService(), containerElement);

            ((HtmlElement)htmldoc.RootNode).SetPrincipalBox(bridgeBox);//set bridgeBox as principal box of root node
            _htmlHost.UpdateChildBoxes((HtmlRootElement)htmldoc.RootNode, true);
            htmldoc.SetDocumentState(DocumentState.Idle);
            //----------------------------------------------------------------
            //SetTextSelectionStyle(htmlCont, cssData);
            return(bridgeBox);
        }
コード例 #2
0
        void BuildCssBoxTree(MyHtmlContainer htmlCont, CssActiveSheet cssData)
        {
            var rootBox = this.htmlhost.GetRenderTreeBuilder().BuildCssRenderTree(
                this.currentDoc,
                cssData,
                null);

            htmlCont.RootCssBox = rootBox;
        }
コード例 #3
0
 void CloneActiveCssSheetOnce()
 {
     if (!isCloneOnce)
     {
         //clone
         activeSheet = activeSheet.Clone();
         isCloneOnce = true;
     }
 }
コード例 #4
0
        public CssBox BuildCssRenderTree2(
            LayoutFarm.WebDom.Impl.HtmlDocument htmldoc,
            CssActiveSheet cssActiveSheet)
        {
            htmldoc.CssActiveSheet = cssActiveSheet;
            htmldoc.SetDocumentState(DocumentState.Building);
            TopDownActiveCssTemplate activeTemplate = new TopDownActiveCssTemplate(cssActiveSheet);

            PrepareStylesAndContentOfChildNodes((HtmlElement)htmldoc.RootNode, activeTemplate);
            //TODO: review here, we should create cssbox at document.body?
            CssBox rootBox = HtmlHost.CreateIsolateBox(_htmlHost.GetHtmlTextService());

            ((HtmlElement)htmldoc.RootNode).SetPrincipalBox(rootBox);
            _htmlHost.UpdateChildBoxes((HtmlRootElement)htmldoc.RootNode, true);
            htmldoc.SetDocumentState(DocumentState.Idle);
            return(rootBox);
        }
コード例 #5
0
 public TopDownActiveCssTemplate(CssActiveSheet activeSheet)
 {
     _activeSheet = activeSheet;
     _specLevels.Add(new BoxSpecLevel(0));
 }
コード例 #6
0
        void SetHtml(LayoutFarm.HtmlBoxes.MyHtmlContainer htmlContainer, string html, CssActiveSheet cssData)
        {
            //-----------------------------------------------------------------
            var htmldoc = this.currentDoc =
                LayoutFarm.Composers.WebDocumentParser.ParseDocument(
                    new WebDom.Parser.TextSource(html.ToCharArray()));
            //build rootbox from htmldoc
            var rootBox = this.htmlhost.GetRenderTreeBuilder().BuildCssRenderTree(htmldoc,
                                                                                  cssData,
                                                                                  null);

            htmlContainer.WebDocument = htmldoc;
            htmlContainer.RootCssBox  = rootBox;
        }