| Index: Source/core/rendering/RenderView.h
|
| diff --git a/Source/core/rendering/RenderView.h b/Source/core/rendering/RenderView.h
|
| index a3b2e9dce17c16b03dc51b3f84d22b126735dcfa..9c0a4bc4fc0be2d8b47a25bbf535e8f27f56ea2d 100644
|
| --- a/Source/core/rendering/RenderView.h
|
| +++ b/Source/core/rendering/RenderView.h
|
| @@ -232,9 +232,9 @@ private:
|
| return false;
|
| }
|
|
|
| - void layoutContent(const LayoutState&);
|
| + void layoutContent();
|
| #ifndef NDEBUG
|
| - void checkLayoutState(const LayoutState&);
|
| + void checkLayoutState();
|
| #endif
|
|
|
| void positionDialog(RenderBox*);
|
| @@ -245,6 +245,7 @@ private:
|
|
|
| friend class LayoutStateMaintainer;
|
| friend class LayoutStateDisabler;
|
| + friend class RootLayoutStateScope;
|
|
|
| bool shouldUsePrintingLayout() const;
|
|
|
| @@ -273,6 +274,27 @@ private:
|
|
|
| DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderView, isRenderView());
|
|
|
| +class RootLayoutStateScope {
|
| +public:
|
| + explicit RootLayoutStateScope(RenderView& view)
|
| + : m_view(view)
|
| + {
|
| + ASSERT(!m_view.m_layoutState);
|
| + initializeLayoutState();
|
| + m_view.m_layoutState = &m_rootLayoutState;
|
| + }
|
| +
|
| + ~RootLayoutStateScope()
|
| + {
|
| + ASSERT(m_view.m_layoutState == &m_rootLayoutState);
|
| + m_view.m_layoutState = 0;
|
| + }
|
| +private:
|
| + void initializeLayoutState();
|
| + RenderView& m_view;
|
| + LayoutState m_rootLayoutState;
|
| +};
|
| +
|
| // Stack-based class to assist with LayoutState push/pop
|
| class LayoutStateMaintainer {
|
| WTF_MAKE_NONCOPYABLE(LayoutStateMaintainer);
|
| @@ -300,6 +322,8 @@ public:
|
|
|
| ~LayoutStateMaintainer()
|
| {
|
| + if (m_didStart)
|
| + pop();
|
| ASSERT(m_didStart == m_didEnd); // if this fires, it means that someone did a push(), but forgot to pop().
|
| }
|
|
|
| @@ -313,23 +337,21 @@ public:
|
| m_didStart = true;
|
| }
|
|
|
| + bool didPush() const { return m_didStart; }
|
| +
|
| +private:
|
| void pop()
|
| {
|
| - if (m_didStart) {
|
| - ASSERT(!m_didEnd);
|
| - if (m_didCreateLayoutState) {
|
| - m_view.popLayoutState();
|
| - if (m_disabled)
|
| - m_view.enableLayoutState();
|
| - }
|
| -
|
| - m_didEnd = true;
|
| + ASSERT(m_didStart && !m_didEnd);
|
| + if (m_didCreateLayoutState) {
|
| + m_view.popLayoutState();
|
| + if (m_disabled)
|
| + m_view.enableLayoutState();
|
| }
|
| - }
|
|
|
| - bool didPush() const { return m_didStart; }
|
| + m_didEnd = true;
|
| + }
|
|
|
| -private:
|
| RenderView& m_view;
|
| bool m_disabled : 1; // true if the offset and clip part of layoutState is disabled
|
| bool m_didStart : 1; // true if we did a push or disable
|
|
|