Title: [230134] trunk/Tools
Revision
230134
Author
[email protected]
Date
2018-03-31 16:39:06 -0700 (Sat, 31 Mar 2018)

Log Message

[LayoutReloaded] Add tree context to Display.Box
https://bugs.webkit.org/show_bug.cgi?id=184211

Reviewed by Antti Koivisto.

This is preparation for using the Display.Box tree to resolve absolute coordinates.

* LayoutReloaded/DisplayTree/Box.js:
(Display.Box):
(Display.Box.prototype.setParent):
(Display.Box.prototype.setNextSibling):
(Display.Box.prototype.setPreviousSibling):
(Display.Box.prototype.setFirstChild):
(Display.Box.prototype.setLastChild):
(Display.Box.prototype.parent):
(Display.Box.prototype.nextSibling):
(Display.Box.prototype.previousSibling):
(Display.Box.prototype.firstChild):
(Display.Box.prototype.lastChild):
* LayoutReloaded/FormattingState/FormattingState.js:
(FormattingState.prototype.createDisplayBox):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (230133 => 230134)


--- trunk/Tools/ChangeLog	2018-03-31 17:32:37 UTC (rev 230133)
+++ trunk/Tools/ChangeLog	2018-03-31 23:39:06 UTC (rev 230134)
@@ -1,3 +1,27 @@
+2018-03-31  Zalan Bujtas  <[email protected]>
+
+        [LayoutReloaded] Add tree context to Display.Box
+        https://bugs.webkit.org/show_bug.cgi?id=184211
+
+        Reviewed by Antti Koivisto.
+
+        This is preparation for using the Display.Box tree to resolve absolute coordinates.
+
+        * LayoutReloaded/DisplayTree/Box.js:
+        (Display.Box):
+        (Display.Box.prototype.setParent):
+        (Display.Box.prototype.setNextSibling):
+        (Display.Box.prototype.setPreviousSibling):
+        (Display.Box.prototype.setFirstChild):
+        (Display.Box.prototype.setLastChild):
+        (Display.Box.prototype.parent):
+        (Display.Box.prototype.nextSibling):
+        (Display.Box.prototype.previousSibling):
+        (Display.Box.prototype.firstChild):
+        (Display.Box.prototype.lastChild):
+        * LayoutReloaded/FormattingState/FormattingState.js:
+        (FormattingState.prototype.createDisplayBox):
+
 2018-03-30  Ryosuke Niwa  <[email protected]>
 
         Copying a list from Microsoft Word to TinyMCE fails when mso-list is the first property

Modified: trunk/Tools/LayoutReloaded/DisplayTree/Box.js (230133 => 230134)


--- trunk/Tools/LayoutReloaded/DisplayTree/Box.js	2018-03-31 17:32:37 UTC (rev 230133)
+++ trunk/Tools/LayoutReloaded/DisplayTree/Box.js	2018-03-31 23:39:06 UTC (rev 230134)
@@ -29,6 +29,11 @@
     constructor(node) {
         this.m_node = node;
         this.m_rect = new LayoutRect(new LayoutPoint(0, 0), new LayoutSize(0, 0));
+        this.m_parent = null;
+        this.m_nextSibling = null;
+        this.m_previousSibling = null;
+        this.m_firstChild = null;
+        this.m_lastChild = null;
     }
 
     clone() {
@@ -128,4 +133,44 @@
         contentBox.shrinkBy(Utils.computedPaddingBottomRight(this.m_node));
         return contentBox;
     }
+
+    setParent(parent) {
+        this.m_parent = parent;
+    }
+
+    setNextSibling(nextSibling) {
+        this.m_nextSibling = nextSibling;
+    }
+
+    setPreviousSibling(previousSibling) {
+        this.m_previousSibling = previousSibling;
+    }
+
+    setFirstChild(firstChild) {
+        this.m_firstChild = firstChild;
+    }
+
+    setLastChild(lastChild) {
+        this.m_lastChild = lastChild;
+    }
+
+    parent() {
+        return this.m_parent;;
+    }
+
+    nextSibling() {
+        return this.m_nextSibling;
+    }
+
+    previousSibling() {
+        return this.m_previousSibling;
+    }
+
+    firstChild() {
+        return this.m_firstChild;
+    }
+
+    lastChild() {
+        return this.m_lastChild;
+    }
 }

Modified: trunk/Tools/LayoutReloaded/FormattingState/FormattingState.js (230133 => 230134)


--- trunk/Tools/LayoutReloaded/FormattingState/FormattingState.js	2018-03-31 17:32:37 UTC (rev 230133)
+++ trunk/Tools/LayoutReloaded/FormattingState/FormattingState.js	2018-03-31 23:39:06 UTC (rev 230134)
@@ -45,6 +45,17 @@
 
     createDisplayBox(layoutBox) {
         let displayBox = new Display.Box(layoutBox.node());
+        let parentDisplayBox = this.displayBox(layoutBox.containingBlock());
+        displayBox.setParent(parentDisplayBox);
+        if (!parentDisplayBox.firstChild()) {
+            parentDisplayBox.setFirstChild(displayBox);
+            parentDisplayBox.setLastChild(displayBox);
+        } else {
+            let previousSibling = parentDisplayBox.lastChild();
+            previousSibling.setNextSibling(displayBox);
+            displayBox.setPreviousSibling(previousSibling);
+            parentDisplayBox.setLastChild(displayBox);
+        }
         this.m_displayToLayout.set(layoutBox, displayBox);
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to