Bug 1029982 - Set mNeedLayoutFlush and mNeedStyleFlush back to true when flush failed. r=dbaron,roc

This commit is contained in:
Morris Tseng 2014-06-26 20:16:00 +02:00
Родитель 821c5897ee
Коммит 59218b978b
1 изменённых файлов: 18 добавлений и 5 удалений

Просмотреть файл

@ -4137,6 +4137,8 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush)
NS_ASSERTION(!isSafeToFlush || mViewManager, "Must have view manager"); NS_ASSERTION(!isSafeToFlush || mViewManager, "Must have view manager");
// Make sure the view manager stays alive. // Make sure the view manager stays alive.
nsRefPtr<nsViewManager> viewManagerDeathGrip = mViewManager; nsRefPtr<nsViewManager> viewManagerDeathGrip = mViewManager;
bool didStyleFlush = false;
bool didLayoutFlush = false;
if (isSafeToFlush && mViewManager) { if (isSafeToFlush && mViewManager) {
// Processing pending notifications can kill us, and some callers only // Processing pending notifications can kill us, and some callers only
// hold weak refs when calling FlushPendingNotifications(). :( // hold weak refs when calling FlushPendingNotifications(). :(
@ -4226,6 +4228,8 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush)
mPresContext->RestyleManager()->ProcessPendingRestyles(); mPresContext->RestyleManager()->ProcessPendingRestyles();
} }
didStyleFlush = true;
// There might be more pending constructors now, but we're not going to // 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 // 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) && if (flushType >= (mSuppressInterruptibleReflows ? Flush_Layout : Flush_InterruptibleLayout) &&
!mIsDestroying) { !mIsDestroying) {
didLayoutFlush = true;
mFrameConstructor->RecalcQuotesAndCounters(); mFrameConstructor->RecalcQuotesAndCounters();
mViewManager->FlushDelayedResize(true); mViewManager->FlushDelayedResize(true);
if (ProcessReflowCommands(flushType < Flush_Layout) && mContentToScrollTo) { if (ProcessReflowCommands(flushType < Flush_Layout) && mContentToScrollTo) {
@ -4243,11 +4248,6 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush)
mContentToScrollTo = nullptr; 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) { 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 void