[LayoutReloaded] Decouple formatting state and context lifetime.
[WebKit-https.git] / Tools / LayoutReloaded / FormattingState / InlineFormattingState.js
index 784005ba58226d0dab6ddd0df7abf2706df6c5d2..b9a874e363fce7059c35b9f6158b42e5a9758477 100644 (file)
 class InlineFormattingState extends FormattingState {
     constructor(formattingRoot, layoutState) {
         super(layoutState, formattingRoot);
-        this._setFormattingContext(new InlineFormattingContext(this));
+        // If the block container box that initiates this inline formatting contex also establishes a block context, create a new float for us.
+        if (this.formattingRoot().establishesBlockFormattingContext())
+            this.m_floatingState = new FloatingState(this);
+        else {
+            // TODO: use parent formatting context's floating state.
+        }
+        this.m_lines = new Array();
+    }
+
+    lines() {
+        return this.m_lines;
+    }
+
+    appendLine(line) {
+        this.m_lines.push(line);
     }
 }