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); }
void BuildCssBoxTree(MyHtmlContainer htmlCont, CssActiveSheet cssData) { var rootBox = this.htmlhost.GetRenderTreeBuilder().BuildCssRenderTree( this.currentDoc, cssData, null); htmlCont.RootCssBox = rootBox; }
void CloneActiveCssSheetOnce() { if (!isCloneOnce) { //clone activeSheet = activeSheet.Clone(); isCloneOnce = true; } }
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); }
public TopDownActiveCssTemplate(CssActiveSheet activeSheet) { _activeSheet = activeSheet; _specLevels.Add(new BoxSpecLevel(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; }