From b18c3838c63c8caacf23652cc4d77c97ca6c398d Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sat, 11 Sep 2010 13:24:50 -0500 Subject: [PATCH] Bug 594267. Don't call WillPaint on hidden documents. r=bzbarsky a=roc --- layout/base/nsPresShell.cpp | 6 +++--- view/src/nsViewManager.cpp | 12 +++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index f5d61ba7ae95..c4aaa6582b5c 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -7189,9 +7189,9 @@ PresShell::ShouldIgnoreInvalidation() NS_IMETHODIMP_(void) PresShell::WillPaint(PRBool aWillSendDidPaint) { - // Don't bother doing anything if some viewmanager in our tree is - // painting while we still have painting suppressed. - if (mPaintingSuppressed) { + // Don't bother doing anything if some viewmanager in our tree is painting + // while we still have painting suppressed or we are not active. + if (mPaintingSuppressed || !mIsActive) { return; } diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp index ad40891d7bb2..65ecbe3b2172 100644 --- a/view/src/nsViewManager.cpp +++ b/view/src/nsViewManager.cpp @@ -1659,11 +1659,13 @@ nsViewManager::CallWillPaintOnObservers(PRBool aWillSendDidPaint) nsViewManager* vm = (nsViewManager*)gViewManagers->ElementAt(index); if (vm->RootViewManager() == this) { // One of our kids. - nsCOMPtr obs = vm->GetViewObserver(); - if (obs) { - obs->WillPaint(aWillSendDidPaint); - NS_ASSERTION(mUpdateBatchCnt == savedUpdateBatchCnt, - "Observer did not end view batch?"); + if (vm->mRootView && vm->mRootView->IsEffectivelyVisible()) { + nsCOMPtr obs = vm->GetViewObserver(); + if (obs) { + obs->WillPaint(aWillSendDidPaint); + NS_ASSERTION(mUpdateBatchCnt == savedUpdateBatchCnt, + "Observer did not end view batch?"); + } } } }