private DrawableNode PrecalculateMeasures(CoreUIDomNode node, DrawableNode closestBlockParent) { var drawable = new DrawableNode { OriginalNode = node, ClosestBlockParent = closestBlockParent, }; var nodeAsElement = node as CoreUIDomElement; var childrensClosestBlockParent = closestBlockParent; if (nodeAsElement != null) { drawable.Style = new Style(nodeAsElement.Style); if (nodeAsElement.Style.Display == DisplayStyle.Block) { childrensClosestBlockParent = drawable; } } // Do the pre-calculation here. var children = node.Children.Where(child => { var element = child as CoreUIDomElement; return(element == null || element.Style.Display != DisplayStyle.None); }).Select(child => PrecalculateMeasures(child, childrensClosestBlockParent)); foreach (var child in children) { drawable.Add(child); } return(drawable); }
public DrawableNode Add(DrawableNode node) { if (node == this) { throw new InvalidOperationException("Adding a node to itself can cause infinite recursion!"); } node.Parent = this; _children.Add(node); return(this); }
internal DrawableNode CalculateDrawableDom(CoreUIDomDocument document) { var documentNode = new DrawableNode { PartialDrawBox = new PartialDrawBox(document.DrawBox), OriginalNode = document, }; var drawableNode = PrecalculateMeasures(document.Body, documentNode); drawableNode = CompleteMeasures(drawableNode); drawableNode = CalculatePositions(drawableNode); drawableNode = Reflow(drawableNode); return(drawableNode); }
private DrawableNode Reflow(DrawableNode drawableTree) { throw new NotImplementedException(); }
private DrawableNode CalculatePositions(DrawableNode drawableTree) { throw new NotImplementedException(); }
private DrawableNode CompleteMeasures(DrawableNode drawableTree) { throw new NotImplementedException(); }