/// <summary> /// consume /// </summary> /// <param name="another"></param> public void Combine(CssActiveSheet another) { MergeContent(this.rulesForClassName, another.rulesForClassName); MergeContent(this.rulesForAll, another.rulesForAll); MergeContent(this.rulesForElementId, another.rulesForElementId); MergeContent(this.rulesForPsedoClass, another.rulesForPsedoClass); MergeContent(this.rulesForTagName, another.rulesForTagName); }
public VgVisualDoc CreateVgVisualDoc(VgDocument svgdoc, VgVisualDocHost docHost) { // //reset some value _containerWidth = 500; _containerHeight = 500; _emHeight = 17; _waitingList.Clear(); // _svgdoc = svgdoc; _activeSheet1 = svgdoc.CssActiveSheet; _vgVisualDoc = new VgVisualDoc(docHost); _defsList = _vgVisualDoc._defsList; _styleList = _vgVisualDoc._styleList; _registeredElemsById = _vgVisualDoc._registeredElemsById; //--------------------------- //create visual tree for svg nodes SvgElement rootElem = svgdoc.Root; VgVisualElement vgVisualRootElem = new VgVisualElement(WellknownSvgElementName.RootSvg, null, _vgVisualDoc); _vgVisualDoc.VgRootElem = vgVisualRootElem;//** int childCount = rootElem.ChildCount; for (int i = 0; i < childCount; ++i) { CreateSvgVisualElement(vgVisualRootElem, rootElem.GetChild(i)); } //resolve int j = _waitingList.Count; BuildDefinitionNodes(); for (int i = 0; i < j; ++i) { //resolve VgUseVisualElement useNodeVisElem = (VgUseVisualElement)_waitingList[i]; if (useNodeVisElem.HRefSvgRenderElement == null) { //resolve SvgUseSpec useSpec = (SvgUseSpec)useNodeVisElem._visualSpec; if (_registeredElemsById.TryGetValue(useSpec.Href.Value, out VgVisualElement result)) { useNodeVisElem.HRefSvgRenderElement = result; } else { } } } return(_vgVisualDoc); }
void CloneActiveCssSheetOnce() { if (!isCloneOnce) { //clone activeSheet = activeSheet.Clone(); isCloneOnce = true; } }
public CssActiveSheet Clone() { CssActiveSheet newclone = new CssActiveSheet(); newclone.rulesForTagName = CloneNew(this.rulesForTagName); newclone.rulesForClassName = CloneNew(this.rulesForClassName); newclone.rulesForElementId = CloneNew(this.rulesForElementId); newclone.rulesForPsedoClass = CloneNew(this.rulesForPsedoClass); newclone.rulesForAll = CloneNew(this.rulesForAll); #if DEBUG newclone.dbugOriginal = this; #endif return(newclone); }
public CssActiveSheet Clone() { CssActiveSheet newclone = new CssActiveSheet(); newclone.rulesForTagName = CloneNew(this.rulesForTagName); newclone.rulesForClassName = CloneNew(this.rulesForClassName); newclone.rulesForElementId = CloneNew(this.rulesForElementId); newclone.rulesForPsedoClass = CloneNew(this.rulesForPsedoClass); newclone.rulesForAll = CloneNew(this.rulesForAll); #if DEBUG newclone.dbugOriginal = this; #endif return newclone; }
public CssBox BuildCssRenderTree2( LayoutFarm.WebDom.Impl.HtmlDocument htmldoc, CssActiveSheet cssActiveSheet, RootGraphic rootgfx) { 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(TextServices.IFonts, rootgfx); ((HtmlElement)htmldoc.RootNode).SetPrincipalBox(rootBox); htmlHost.UpdateChildBoxes((HtmlRootElement)htmldoc.RootNode, true); htmldoc.SetDocumentState(DocumentState.Idle); return rootBox; }
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); //---------------------------------------------------------------- RootGraphic rootgfx = (containerElement != null) ? containerElement.Root : null; //TODO: review here, we should create cssbox at document.body? CssBox bridgeBox = HtmlHost.CreateBridgeBox(TextServices.IFonts, containerElement, rootgfx); ((HtmlElement)htmldoc.RootNode).SetPrincipalBox(bridgeBox); htmlHost.UpdateChildBoxes((HtmlRootElement)htmldoc.RootNode, true); htmldoc.SetDocumentState(DocumentState.Idle); //---------------------------------------------------------------- //SetTextSelectionStyle(htmlCont, cssData); return bridgeBox; }
public TopDownActiveCssTemplate(CssActiveSheet activeSheet) { this.activeSheet = activeSheet; specLevels.Add(new BoxSpecLevel(0)); }
void BuildCssBoxTree(MyHtmlContainer htmlCont, CssActiveSheet cssData) { var rootBox = this.htmlhost.GetRenderTreeBuilder().BuildCssRenderTree( this.currentDoc, cssData, null); htmlCont.RootCssBox = rootBox; }
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; }