[LayoutState cleanup] LayoutContext should own the stack of LayoutState objects
[WebKit-https.git] / Source / WebCore / page / LayoutContext.h
index 61a36e3..78ccd0d 100644 (file)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include "LayoutUnit.h"
 #include "Timer.h"
 
 #include <wtf/WeakPtr.h>
@@ -35,8 +36,11 @@ class Document;
 class Frame;
 class FrameView;
 class LayoutScope;
+class LayoutSize;
 class LayoutState;
 class RenderBlockFlow;
+class RenderBox;
+class RenderObject;
 class RenderElement;
 class RenderView;
     
@@ -92,9 +96,9 @@ public:
     void pushLayoutState(RenderElement&);
     bool pushLayoutStateForPaginationIfNeeded(RenderBlockFlow&);
     void popLayoutState(RenderObject&);
-    LayoutState* layoutState() const { return m_layoutState.get(); }
+    LayoutState* layoutState() const;
     // Returns true if layoutState should be used for its cached offset and clip.
-    bool isPaintOffsetCacheEnabled() const { return !m_paintOffsetCacheDisableCount && m_layoutState; }
+    bool isPaintOffsetCacheEnabled() const { return !m_paintOffsetCacheDisableCount && layoutState(); }
 #ifndef NDEBUG
     void checkLayoutState();
 #endif
@@ -106,6 +110,7 @@ public:
 #if !ASSERT_DISABLED
     bool layoutDeltaMatches(const LayoutSize& delta);
 #endif
+    using LayoutStateStack = Vector<std::unique_ptr<LayoutState>>;
 
 private:
     friend class LayoutScope;
@@ -166,7 +171,7 @@ private:
     unsigned m_disableSetNeedsLayoutCount { 0 };
     int m_layoutDisallowedCount { 0 };
     WeakPtr<RenderElement> m_subtreeLayoutRoot;
-    std::unique_ptr<LayoutState> m_layoutState;
+    LayoutStateStack m_layoutStateStack;
     unsigned m_paintOffsetCacheDisableCount { 0 };
 };