From 59218b978b70b3f9fc1d12e9c27c2988ad2a23a7 Mon Sep 17 00:00:00 2001 From: Morris Tseng Date: Thu, 26 Jun 2014 20:16:00 +0200 Subject: [PATCH] Bug 1029982 - Set mNeedLayoutFlush and mNeedStyleFlush back to true when flush failed. r=dbaron,roc --- layout/base/nsPresShell.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index d1b4b868959e..ef2ab3d6f4ed 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -4137,6 +4137,8 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush) NS_ASSERTION(!isSafeToFlush || mViewManager, "Must have view manager"); // Make sure the view manager stays alive. nsRefPtr viewManagerDeathGrip = mViewManager; + bool didStyleFlush = false; + bool didLayoutFlush = false; if (isSafeToFlush && mViewManager) { // Processing pending notifications can kill us, and some callers only // hold weak refs when calling FlushPendingNotifications(). :( @@ -4226,6 +4228,8 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush) mPresContext->RestyleManager()->ProcessPendingRestyles(); } + didStyleFlush = true; + // There might be more pending constructors now, but we're not going to // worry about them. They can't be triggered during reflow, so we should @@ -4233,6 +4237,7 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush) if (flushType >= (mSuppressInterruptibleReflows ? Flush_Layout : Flush_InterruptibleLayout) && !mIsDestroying) { + didLayoutFlush = true; mFrameConstructor->RecalcQuotesAndCounters(); mViewManager->FlushDelayedResize(true); if (ProcessReflowCommands(flushType < Flush_Layout) && mContentToScrollTo) { @@ -4243,11 +4248,6 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush) mContentToScrollTo = nullptr; } } - } else if (!mIsDestroying && mSuppressInterruptibleReflows && - flushType == Flush_InterruptibleLayout) { - // We suppressed this flush, but the document thinks it doesn't - // need to flush anymore. Let it know what's really going on. - mDocument->SetNeedLayoutFlush(); } if (flushType >= Flush_Layout) { @@ -4256,6 +4256,19 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush) } } } + + if (!didStyleFlush && flushType >= Flush_Style && !mIsDestroying) { + mDocument->SetNeedStyleFlush(); + } + + if (!didLayoutFlush && !mIsDestroying && + (flushType >= + (mSuppressInterruptibleReflows ? Flush_Layout : Flush_InterruptibleLayout))) { + // We suppressed this flush due to mSuppressInterruptibleReflows or + // !isSafeToFlush, but the document thinks it doesn't + // need to flush anymore. Let it know what's really going on. + mDocument->SetNeedLayoutFlush(); + } } void