[LayoutReloaded] Introduce FormattingState (Block/Inline/etc)
[WebKit-https.git] / Tools / LayoutReloaded / LayoutContext.js
index a7ce85e..b989a8a 100644 (file)
 
 class LayoutContext {
     constructor() {
+        this.m_layoutStates = new Map();
     }
 
     layout(formattingRoot) {
-        let formattingContext = this._createFormattingContext(formattingRoot);
-        formattingContext.layout();
+        let formattingState = this._createFormattingState(formattingRoot);
+        this.m_layoutStates.set(formattingRoot, formattingState);
+        formattingState.formattingContext().layout();
     }
 
-    _createFormattingContext(formattingRoot) {
+    _createFormattingState(formattingRoot) {
         ASSERT(formattingRoot.establishesFormattingContext());
         if (formattingRoot.establishesBlockFormattingContext())
-            return new BlockFormattingContext(formattingRoot, this);
+            return new BlockFormattingState(formattingRoot, this);
         if (formattingRoot.establishesInlineFormattingContext())
-            return new InlineFormattingContext(formattingRoot, this);
+            return new InlineFormattingState(formattingRoot, this);
         ASSERT_NOT_REACHED();
         return null;
     }