| Index: Source/core/page/FrameView.cpp
|
| diff --git a/Source/core/page/FrameView.cpp b/Source/core/page/FrameView.cpp
|
| index 15389b0e919cce3bce83e0cdb1651a9223c04154..061fb96189efb2928a1d49923e90f5b519b4fbea 100644
|
| --- a/Source/core/page/FrameView.cpp
|
| +++ b/Source/core/page/FrameView.cpp
|
| @@ -155,7 +155,7 @@ FrameView::FrameView(Frame* frame)
|
| : m_frame(frame)
|
| , m_canHaveScrollbars(true)
|
| , m_slowRepaintObjectCount(0)
|
| - , m_layoutTimer(this, &FrameView::layoutTimerFired)
|
| + , m_layoutIsScheduledWithEmbedder(false)
|
| , m_layoutRoot(0)
|
| , m_inSynchronousPostLayout(false)
|
| , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired)
|
| @@ -247,7 +247,7 @@ void FrameView::reset()
|
| m_contentIsOpaque = false;
|
| m_borderX = 30;
|
| m_borderY = 30;
|
| - m_layoutTimer.stop();
|
| + unscheduleRelayout();
|
| m_layoutRoot = 0;
|
| m_delayedLayout = false;
|
| m_doFullRepaint = true;
|
| @@ -691,7 +691,7 @@ void FrameView::updateCompositingLayersAfterStyleChange()
|
| return;
|
|
|
| // If we expect to update compositing after an incipient layout, don't do so here.
|
| - if (m_doingPreLayoutStyleUpdate || layoutPending() || renderView->needsLayout())
|
| + if (m_doingPreLayoutStyleUpdate || layoutIsScheduledWithEmbedder() || renderView->needsLayout())
|
| return;
|
|
|
| // This call will make sure the cached hasAcceleratedCompositing is updated from the pref
|
| @@ -816,7 +816,7 @@ bool FrameView::isSoftwareRenderable() const
|
|
|
| RenderObject* FrameView::layoutRoot(bool onlyDuringLayout) const
|
| {
|
| - return onlyDuringLayout && layoutPending() ? 0 : m_layoutRoot;
|
| + return onlyDuringLayout && layoutIsScheduledWithEmbedder() ? 0 : m_layoutRoot;
|
| }
|
|
|
| static inline void collectFrameViewChildren(FrameView* frameView, Vector<RefPtr<FrameView> >& frameViews)
|
| @@ -882,7 +882,7 @@ void FrameView::layout(bool allowSubtree)
|
| // Every scroll that happens during layout is programmatic.
|
| TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true);
|
|
|
| - m_layoutTimer.stop();
|
| + unscheduleRelayout();
|
| m_delayedLayout = false;
|
| m_setNeedsLayoutWasDeferred = false;
|
|
|
| @@ -1875,6 +1875,13 @@ void FrameView::layoutTimerFired(Timer<FrameView>*)
|
| layout();
|
| }
|
|
|
| +void FrameView::scheduleLayoutWithEmbedder()
|
| +{
|
| + // FIXME: Right now we're hijacking the scheduleAnimation codepath.
|
| + scheduleAnimation();
|
| + m_layoutIsScheduledWithEmbedder = true;
|
| +}
|
| +
|
| void FrameView::scheduleRelayout()
|
| {
|
| ASSERT(m_frame->view() == this);
|
| @@ -1896,14 +1903,7 @@ void FrameView::scheduleRelayout()
|
| if (m_frame->ownerRenderer() && frame()->document()->shouldDisplaySeamlesslyWithParent())
|
| m_frame->ownerRenderer()->setNeedsLayout(true, MarkContainingBlockChain);
|
|
|
| - int delay = m_frame->document()->minimumLayoutDelay();
|
| - if (m_layoutTimer.isActive() && m_delayedLayout && !delay)
|
| - unscheduleRelayout();
|
| - if (m_layoutTimer.isActive())
|
| - return;
|
| -
|
| - m_delayedLayout = delay != 0;
|
| - m_layoutTimer.startOneShot(delay * 0.001);
|
| + scheduleLayoutWithEmbedder();
|
| }
|
|
|
| static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* descendant)
|
| @@ -1926,7 +1926,7 @@ void FrameView::scheduleRelayoutOfSubtree(RenderObject* relayoutRoot)
|
| return;
|
| }
|
|
|
| - if (layoutPending() || !m_layoutSchedulingEnabled) {
|
| + if (layoutIsScheduledWithEmbedder() || !m_layoutSchedulingEnabled) {
|
| if (m_layoutRoot != relayoutRoot) {
|
| if (isObjectAncestorContainerOf(m_layoutRoot, relayoutRoot)) {
|
| // Keep the current root
|
| @@ -1952,14 +1952,13 @@ void FrameView::scheduleRelayoutOfSubtree(RenderObject* relayoutRoot)
|
| m_layoutRoot = relayoutRoot;
|
| ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
|
| InspectorInstrumentation::didInvalidateLayout(m_frame.get());
|
| - m_delayedLayout = delay != 0;
|
| - m_layoutTimer.startOneShot(delay * 0.001);
|
| + scheduleLayoutWithEmbedder();
|
| }
|
| }
|
|
|
| -bool FrameView::layoutPending() const
|
| +bool FrameView::layoutIsScheduledWithEmbedder() const
|
| {
|
| - return m_layoutTimer.isActive();
|
| + return m_layoutIsScheduledWithEmbedder;
|
| }
|
|
|
| bool FrameView::needsLayout() const
|
| @@ -1971,7 +1970,7 @@ bool FrameView::needsLayout() const
|
| return false;
|
|
|
| RenderView* renderView = this->renderView();
|
| - return layoutPending()
|
| + return layoutIsScheduledWithEmbedder()
|
| || (renderView && renderView->needsLayout())
|
| || m_layoutRoot
|
| || (m_deferSetNeedsLayouts && m_setNeedsLayoutWasDeferred);
|
| @@ -1990,15 +1989,15 @@ void FrameView::setNeedsLayout()
|
|
|
| void FrameView::unscheduleRelayout()
|
| {
|
| - if (!m_layoutTimer.isActive())
|
| - return;
|
| -
|
| - m_layoutTimer.stop();
|
| - m_delayedLayout = false;
|
| + // FIXME: We should just remove this method.
|
| + m_layoutIsScheduledWithEmbedder = false;
|
| }
|
|
|
| void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime)
|
| {
|
| + // The Animation timer is also used for scheduling layouts.
|
| + updateLayoutAndStyleIfNeededRecursive();
|
| +
|
| for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree()->traverseNext()) {
|
| frame->view()->serviceScrollAnimations();
|
| if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
|
| @@ -2987,6 +2986,7 @@ void FrameView::updateLayoutAndStyleIfNeededRecursive()
|
|
|
| m_frame->document()->updateStyleIfNeeded();
|
|
|
| + unscheduleRelayout();
|
| if (needsLayout())
|
| layout();
|
|
|
|
|