[LayoutReloaded] Move Display.Box handling from FormattingContext to FormattingState
[WebKit-https.git] / Tools / LayoutReloaded / FormattingState / FormattingState.js
index b97666f..66e4a8d 100644 (file)
@@ -27,6 +27,7 @@ class FormattingState {
     constructor(layoutContext) {
         this.m_layoutContext = layoutContext;
         this.m_formattingContext = null;
+        this.m_displayToLayout = new Map();
     }
 
     formattingContext() {
@@ -37,6 +38,18 @@ class FormattingState {
         return this.m_layoutContext;
     }
 
+    createDisplayBox(layoutBox) {
+        let displayBox = new Display.Box(layoutBox.node());
+        this.m_displayToLayout.set(layoutBox, displayBox);
+        // This is temporary.
+        layoutBox.setDisplayBox(displayBox);
+    }
+
+    displayBox(layoutBox) {
+        ASSERT(layoutBox);
+        return layoutBox.displayBox();
+    }
+
     _setFormattingContext(formattingContext) {
         this.m_formattingContext = formattingContext;
     }