diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index f5d61ba7ae9..c4aaa6582b5 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 ad40891d7bb..65ecbe3b217 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?"); + } } } }