Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
                }
            }
        }
Пример #4
0
 public void CompositeApply(RenderLayout layout)
 {
     Console.WriteLine(layout);
 }
Пример #5
0
 public RenderTree()
 {
     LayoutRoot  = null;
     _compositor = new RenderCompositor(_window);
 }
Пример #6
0
 public void AddLayout(RenderLayout layout)
 {
     layout.Parent = this;
     Layouts.Add(layout);
 }