| Index: Source/core/frame/FrameView.cpp
|
| diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
|
| index 5ba5aaacbe776088e6e637df1fdf009f2a55d276..06c32baa3e5059411a64be7e28b4fc0f730f04b2 100644
|
| --- a/Source/core/frame/FrameView.cpp
|
| +++ b/Source/core/frame/FrameView.cpp
|
| @@ -223,10 +223,8 @@ void FrameView::reset()
|
| m_contentIsOpaque = false;
|
| m_hasPendingLayout = false;
|
| m_layoutSubtreeRoot = 0;
|
| - m_delayedLayout = false;
|
| m_doFullRepaint = true;
|
| m_layoutSchedulingEnabled = true;
|
| - m_inPerformLayout = false;
|
| m_canRepaintDuringPerformLayout = false;
|
| m_doingPreLayoutStyleUpdate = false;
|
| m_inSynchronousPostLayout = false;
|
| @@ -498,7 +496,6 @@ void FrameView::adjustViewSize()
|
| const IntRect rect = renderView->documentRect();
|
| const IntSize& size = rect.size();
|
| ScrollView::setScrollOrigin(IntPoint(-rect.x(), -rect.y()), !m_frame->document()->printing(), size == contentsSize());
|
| -
|
| setContentsSize(size);
|
| }
|
|
|
| @@ -778,6 +775,7 @@ inline void FrameView::forceLayoutParentViewIfNeeded()
|
| void FrameView::performPreLayoutTasks()
|
| {
|
| TRACE_EVENT0("webkit", "FrameView::performPreLayoutTasks");
|
| + lifecycle().advanceTo(DocumentLifecycle::InPreLayout);
|
|
|
| // Don't schedule more layouts, we're in one.
|
| TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
|
| @@ -790,6 +788,8 @@ void FrameView::performPreLayoutTasks()
|
| }
|
|
|
| Document* document = m_frame->document();
|
| +
|
| + // FIXME: Should we move this code to FrameView::setContentsSize?
|
| document->notifyResizeForViewportUnits();
|
|
|
| // Viewport-dependent media queries may cause us to need completely different style information.
|
| @@ -812,15 +812,15 @@ void FrameView::performPreLayoutTasks()
|
| // the layout beats any sort of style recalc update that needs to occur.
|
| TemporaryChange<bool> changeDoingPreLayoutStyleUpdate(m_doingPreLayoutStyleUpdate, true);
|
| document->updateStyleIfNeeded();
|
| + lifecycle().advanceTo(DocumentLifecycle::StyleClean);
|
| }
|
|
|
| void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLayout)
|
| {
|
| - ASSERT(!m_inPerformLayout);
|
| -
|
| TRACE_EVENT0("webkit", "FrameView::performLayout");
|
|
|
| - TemporaryChange<bool> changeInPerformLayout(m_inPerformLayout, true);
|
| + ASSERT(!isInPerformLayout());
|
| + lifecycle().advanceTo(DocumentLifecycle::InPerformLayout);
|
|
|
| // performLayout is the actual guts of layout().
|
| // FIXME: The 300 other lines in layout() probably belong in other helper functions
|
| @@ -857,6 +857,8 @@ void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLay
|
|
|
| if (inSubtreeLayout)
|
| rootForThisLayout->view()->popLayoutState(rootForThisLayout);
|
| +
|
| + lifecycle().advanceTo(DocumentLifecycle::AfterPerformLayout);
|
| }
|
|
|
| void FrameView::scheduleOrPerformPostLayoutTasks()
|
| @@ -892,10 +894,7 @@ void FrameView::layout(bool allowSubtree)
|
| ASSERT(m_frame->view() == this);
|
| ASSERT(m_frame->page());
|
|
|
| - if (m_inPerformLayout)
|
| - return;
|
| -
|
| - if (!m_frame->document()->isActive())
|
| + if (isInPerformLayout() || !lifecycle().isActive())
|
| return;
|
|
|
| ASSERT(!partialLayout().isStopping());
|
| @@ -910,12 +909,10 @@ void FrameView::layout(bool allowSubtree)
|
| TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true);
|
|
|
| m_hasPendingLayout = false;
|
| - m_delayedLayout = false;
|
| + DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::LayoutClean);
|
|
|
| - // we shouldn't enter layout() while painting
|
| - ASSERT(!isPainting());
|
| - if (isPainting())
|
| - return;
|
| + // We shouldn't enter layout() while painting
|
| + RELEASE_ASSERT(!isPainting());
|
|
|
| // Store the current maximal outline size to use when computing the old/new
|
| // outline rects for repainting.
|
| @@ -946,6 +943,9 @@ void FrameView::layout(bool allowSubtree)
|
|
|
| bool isPartialLayout = partialLayout().isPartialLayout();
|
|
|
| + if (isPartialLayout)
|
| + lifecycleScope.setFinalState(DocumentLifecycle::StyleClean);
|
| +
|
| FontCachePurgePreventer fontCachePurgePreventer;
|
| RenderLayer* layer;
|
| {
|
| @@ -1160,6 +1160,11 @@ void FrameView::repaintTree(RenderObject* root)
|
| resetScrollbarDamage();
|
| }
|
|
|
| +DocumentLifecycle& FrameView::lifecycle() const
|
| +{
|
| + return m_frame->document()->lifecycle();
|
| +}
|
| +
|
| void FrameView::gatherDebugLayoutRects(RenderObject* layoutRoot)
|
| {
|
| bool isTracing;
|
| @@ -1808,13 +1813,6 @@ void FrameView::scheduleRelayout()
|
| return;
|
| InspectorInstrumentation::didInvalidateLayout(m_frame.get());
|
|
|
| - int delay = m_frame->document()->minimumLayoutDelay();
|
| - if (m_hasPendingLayout && m_delayedLayout && !delay)
|
| - unscheduleRelayout();
|
| - if (m_hasPendingLayout)
|
| - return;
|
| -
|
| - m_delayedLayout = delay != 0;
|
| m_hasPendingLayout = true;
|
| scheduleAnimation();
|
| }
|
| @@ -1861,11 +1859,9 @@ void FrameView::scheduleRelayoutOfSubtree(RenderObject* relayoutRoot)
|
| }
|
| }
|
| } else if (m_layoutSchedulingEnabled) {
|
| - int delay = m_frame->document()->minimumLayoutDelay();
|
| m_layoutSubtreeRoot = relayoutRoot;
|
| ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->container()->needsLayout());
|
| InspectorInstrumentation::didInvalidateLayout(m_frame.get());
|
| - m_delayedLayout = delay != 0;
|
| m_hasPendingLayout = true;
|
| scheduleAnimation();
|
| }
|
| @@ -1876,6 +1872,11 @@ bool FrameView::layoutPending() const
|
| return m_hasPendingLayout;
|
| }
|
|
|
| +bool FrameView::isInPerformLayout() const
|
| +{
|
| + return lifecycle().state() == DocumentLifecycle::InPerformLayout;
|
| +}
|
| +
|
| bool FrameView::needsLayout() const
|
| {
|
| // This can return true in cases where the document does not have a body yet.
|
| @@ -1894,15 +1895,6 @@ void FrameView::setNeedsLayout()
|
| renderView->setNeedsLayout();
|
| }
|
|
|
| -void FrameView::unscheduleRelayout()
|
| -{
|
| - if (!m_hasPendingLayout)
|
| - return;
|
| -
|
| - m_hasPendingLayout = false;
|
| - m_delayedLayout = false;
|
| -}
|
| -
|
| void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime)
|
| {
|
| for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree().traverseNext()) {
|
| @@ -2331,7 +2323,7 @@ void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rec
|
| IntRect dirtyRect = rect;
|
| dirtyRect.moveBy(scrollbar->location());
|
|
|
| - if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && m_inPerformLayout) {
|
| + if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && isInPerformLayout()) {
|
| if (scrollbar == verticalScrollbar()) {
|
| m_verticalBarDamage = dirtyRect;
|
| m_hasVerticalBarDamage = true;
|
|
|