[LayoutReloaded] Decouple formatting state and context lifetime.
[WebKit-https.git] / Tools / LayoutReloaded / FormattingState / InlineFormattingState.js
index e67a9b94ca19b43f63add96f05f6fc9254f4b480..b9a874e363fce7059c35b9f6158b42e5a9758477 100644 (file)
  */
 
 class InlineFormattingState extends FormattingState {
  */
 
 class InlineFormattingState extends FormattingState {
-    constructor(formattingRoot, layoutContext) {
-        super(layoutContext);
-        this._setFormattingContext(new InlineFormattingContext(formattingRoot, this));
+    constructor(formattingRoot, layoutState) {
+        super(layoutState, formattingRoot);
+        // 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);
     }
 }
     }
 }