[LayoutReloaded] Decouple formatting state and context lifetime.
[WebKit-https.git] / Tools / LayoutReloaded / FormattingState / FloatingState.js
index 17ad1a23e4d28611d6bf481274387b4aa5d45f88..e75498a53d58cfc389ce3bded55959832c1197f6 100644 (file)
  */
 
 class FloatingState {
  */
 
 class FloatingState {
-    constructor(formattingState) {
-        this.m_formattingState = formattingState;
+    constructor(parentFormattingState) {
+        this.m_parentFormattingState = parentFormattingState;
         this.m_leftFloatingBoxStack = new Array();
         this.m_rightFloatingBoxStack = new Array();
         this.m_lastFloating = null;
     }
 
         this.m_leftFloatingBoxStack = new Array();
         this.m_rightFloatingBoxStack = new Array();
         this.m_lastFloating = null;
     }
 
-    addFloating(floatingBox) {
-        // Convert floating box to absolute.
-        let floatingDisplayBox = this.formattingContext().displayBox(floatingBox).clone();
-        floatingDisplayBox.setRect(this.formattingContext().absoluteMarginBox(floatingBox));
-        this.m_lastFloating = floatingDisplayBox;
-        if (Utils.isFloatingLeft(floatingBox)) {
-            this.m_leftFloatingBoxStack.push(floatingDisplayBox);
+    addFloating(layoutBox, displayBox) {
+        this.m_lastFloating = displayBox;
+        if (Utils.isFloatingLeft(layoutBox)) {
+            this.m_leftFloatingBoxStack.push(displayBox);
             return;
         }
             return;
         }
-        this.m_rightFloatingBoxStack.push(floatingDisplayBox);
+        this.m_rightFloatingBoxStack.push(displayBox);
     }
 
     leftFloatingStack() {
     }
 
     leftFloatingStack() {
@@ -55,7 +52,7 @@ class FloatingState {
         return this.m_lastFloating;
     }
 
         return this.m_lastFloating;
     }
 
-    formattingContext() {
-        return this.m_formattingState.formattingContext();
+    formattingState() {
+        return this.m_parentFormattingState;
     }
 }
     }
 }