private void AddNewLayout(Element htmlElement, RenderLayout currentLayout) { var layout = new RenderLayout { Element = htmlElement as HTMLElement, CssRule = _binderElementStyle.Bind(htmlElement as HTMLElement).FirstOrDefault() }; if (layout.CssRule != null && currentLayout.CssRule != null) { var parentStyle = currentLayout.CssRule.Style; var currentStyle = layout.CssRule.Style; layout.CssRule.Style = MergeStyle(parentStyle, currentStyle); } if (layout.CssRule == null) { layout.CssRule = currentLayout.CssRule; } _compositor.CompositeApply(layout); BuildRenderStructure(layout); currentLayout.AddLayout(layout); }
private void TransformHtmlToRender() { var htmlRoots = _document.ChildNodes.Select(x => x as HTMLElement).ToList(); LayoutRoot = new RenderLayout(); foreach (var element in htmlRoots) { LayoutRoot.Element = null; LayoutRoot.Layouts.Add(new RenderLayout { Element = element }); } BuildRenderStructure(LayoutRoot); }
private void BuildRenderStructure(RenderLayout prevLayout) { foreach (var currentLayout in prevLayout.Layouts) { foreach (var htmlElement in currentLayout.Element.Children) { AddNewLayout(htmlElement, currentLayout); } } if (prevLayout.Layouts.Count == 0 && prevLayout.Element.ChildElementCount != 0) { foreach (var htmlElement in prevLayout.Element.Children) { AddNewLayout(htmlElement, prevLayout); } } }
public void CompositeApply(RenderLayout layout) { Console.WriteLine(layout); }
public RenderTree() { LayoutRoot = null; _compositor = new RenderCompositor(_window); }
public void AddLayout(RenderLayout layout) { layout.Parent = this; Layouts.Add(layout); }