| Index: Source/core/frame/FrameView.cpp
|
| diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
|
| index d0648ac7b1866531a539650d47a35fac35983920..0914c7bea778b20027844f74b3ab34050c89f095 100644
|
| --- a/Source/core/frame/FrameView.cpp
|
| +++ b/Source/core/frame/FrameView.cpp
|
| @@ -104,6 +104,31 @@ static RenderLayer::UpdateLayerPositionsFlags updateLayerPositionFlags(RenderLay
|
| return flags;
|
| }
|
|
|
| +class FrameViewLayoutStateMaintainer {
|
| + WTF_MAKE_NONCOPYABLE(FrameViewLayoutStateMaintainer);
|
| +public:
|
| + FrameViewLayoutStateMaintainer(RenderObject& root)
|
| + : m_view(*root.view())
|
| + , m_disabled(m_view.frameView()->isSubtreeLayout() && m_view.shouldDisableLayoutStateForSubtree(root))
|
| + {
|
| + if (m_view.frameView()->isSubtreeLayout())
|
| + m_view.pushLayoutState(root);
|
| + if (m_disabled)
|
| + m_view.disableLayoutState();
|
| + }
|
| +
|
| + ~FrameViewLayoutStateMaintainer()
|
| + {
|
| + if (m_disabled)
|
| + m_view.enableLayoutState();
|
| + if (m_view.frameView()->isSubtreeLayout())
|
| + m_view.popLayoutState();
|
| + }
|
| +private:
|
| + RenderView& m_view;
|
| + bool m_disabled;
|
| +};
|
| +
|
| FrameView::FrameView(Frame* frame)
|
| : m_frame(frame)
|
| , m_canHaveScrollbars(true)
|
| @@ -766,17 +791,10 @@ void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLay
|
| // FIXME: The 300 other lines in layout() probably belong in other helper functions
|
| // so that a single human could understand what layout() is actually doing.
|
|
|
| - {
|
| - bool disableLayoutState = false;
|
| - if (inSubtreeLayout) {
|
| - RenderView* view = rootForThisLayout->view();
|
| - disableLayoutState = view->shouldDisableLayoutStateForSubtree(rootForThisLayout);
|
| - view->pushLayoutState(rootForThisLayout);
|
| - }
|
| - LayoutStateDisabler layoutStateDisabler(disableLayoutState ? rootForThisLayout->view() : 0);
|
| -
|
| - forceLayoutParentViewIfNeeded();
|
| + FrameViewLayoutStateMaintainer statePusher(*rootForThisLayout);
|
| + forceLayoutParentViewIfNeeded();
|
|
|
| + {
|
| // Text Autosizing requires two-pass layout which is incompatible with partial layout.
|
| // If enabled, only do partial layout for the second layout.
|
| // FIXME (crbug.com/256657): Do not do two layouts for text autosizing.
|
| @@ -796,9 +814,6 @@ void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLay
|
| gatherDebugLayoutRects(rootForThisLayout);
|
| }
|
|
|
| - if (inSubtreeLayout)
|
| - rootForThisLayout->view()->popLayoutState(rootForThisLayout);
|
| -
|
| lifecycle().advanceTo(DocumentLifecycle::AfterPerformLayout);
|
| }
|
|
|
|
|