diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 8a5152c01495..d778e148a42d 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -658,33 +658,6 @@ nsIPresShell::GetVerifyReflowEnable() return gVerifyReflowEnabled; } -void -PresShell::AddInvalidateHiddenPresShellObserver(nsRefreshDriver *aDriver) -{ - if (!mHiddenInvalidationObserverRefreshDriver && !mIsDestroying && !mHaveShutDown) { - aDriver->AddPresShellToInvalidateIfHidden(this); - mHiddenInvalidationObserverRefreshDriver = aDriver; - } -} - -void -nsIPresShell::InvalidatePresShellIfHidden() -{ - if (!IsVisible() && mPresContext) { - mPresContext->NotifyInvalidation(0); - } - mHiddenInvalidationObserverRefreshDriver = nullptr; -} - -void -nsIPresShell::CancelInvalidatePresShellIfHidden() -{ - if (mHiddenInvalidationObserverRefreshDriver) { - mHiddenInvalidationObserverRefreshDriver->RemovePresShellToInvalidateIfHidden(this); - mHiddenInvalidationObserverRefreshDriver = nullptr; - } -} - void nsIPresShell::SetVerifyReflowEnable(bool aEnabled) { @@ -771,7 +744,6 @@ nsIPresShell::nsIPresShell() : mFrameConstructor(nullptr) , mViewManager(nullptr) , mFrameManager(nullptr) - , mHiddenInvalidationObserverRefreshDriver(nullptr) #ifdef ACCESSIBILITY , mDocAccessible(nullptr) #endif @@ -1368,9 +1340,6 @@ PresShell::Destroy() // before we destroy the frame manager, since apparently frame destruction // sometimes spins the event queue when plug-ins are involved(!). rd->RemoveLayoutFlushObserver(this); - if (mHiddenInvalidationObserverRefreshDriver) { - mHiddenInvalidationObserverRefreshDriver->RemovePresShellToInvalidateIfHidden(this); - } if (rd->GetPresContext() == GetPresContext()) { rd->RevokeViewManagerFlush(); @@ -3710,7 +3679,6 @@ public: NS_IMETHOD Notify(nsITimer* aTimer) final { mShell->SetNextPaintCompressed(); - mShell->AddInvalidateHiddenPresShellObserver(mShell->GetPresContext()->RefreshDriver()); mShell->ScheduleViewManagerFlush(); return NS_OK; } diff --git a/layout/base/PresShell.h b/layout/base/PresShell.h index 4f624e050904..e54b516a2607 100644 --- a/layout/base/PresShell.h +++ b/layout/base/PresShell.h @@ -378,8 +378,6 @@ public: size_t *aPresContextSize) override; size_t SizeOfTextRuns(mozilla::MallocSizeOf aMallocSizeOf) const; - virtual void AddInvalidateHiddenPresShellObserver(nsRefreshDriver *aDriver) override; - // This data is stored as a content property (nsGkAtoms::scrolling) on // mContentToScrollTo when we have a pending ScrollIntoView. struct ScrollIntoViewData { diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 2acfd7370b6e..85d93961fd8c 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -1596,12 +1596,6 @@ public: mFontSizeInflationEnabledIsDirty = true; } - virtual void AddInvalidateHiddenPresShellObserver(nsRefreshDriver *aDriver) = 0; - - void InvalidatePresShellIfHidden(); - void CancelInvalidatePresShellIfHidden(); - - ////////////////////////////////////////////////////////////////////////////// // Approximate frame visibility tracking public API. ////////////////////////////////////////////////////////////////////////////// @@ -1761,10 +1755,6 @@ protected: // GetRootFrame() can be inlined: nsFrameManagerBase* mFrameManager; mozilla::WeakPtr mForwardingContainer; - nsRefreshDriver* MOZ_UNSAFE_REF("These two objects hold weak references " - "to each other, and the validity of this " - "member is ensured by the logic in nsIPresShell.") - mHiddenInvalidationObserverRefreshDriver; #ifdef ACCESSIBILITY mozilla::a11y::DocAccessible* mDocAccessible; #endif diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 944fd7ae3e3f..c89a721a1143 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -267,7 +267,6 @@ nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType) mPendingMediaFeatureValuesChanged(false), mPrefChangePendingNeedsReflow(false), mIsEmulatingMedia(false), - mAllInvalidated(false), mIsGlyph(false), mUsesRootEMUnits(false), mUsesExChUnits(false), @@ -1556,9 +1555,6 @@ nsPresContext::Detach() { SetContainer(nullptr); SetLinkHandler(nullptr); - if (mShell) { - mShell->CancelInvalidatePresShellIfHidden(); - } } bool @@ -2448,14 +2444,6 @@ nsPresContext::MayHavePaintEventListenerInSubDocument() return result; } -void -nsPresContext::NotifyInvalidation(uint32_t aFlags) -{ - nsIFrame* rootFrame = PresShell()->FrameManager()->GetRootFrame(); - NotifyInvalidation(rootFrame->GetVisualOverflowRect(), aFlags); - mAllInvalidated = true; -} - void nsPresContext::NotifyInvalidation(const nsIntRect& aRect, uint32_t aFlags) { @@ -2488,10 +2476,6 @@ nsPresContext::NotifyInvalidation(const nsRect& aRect, uint32_t aFlags) // even cheaper by providing a more efficient // nsPIDOMWindow::GetListenerManager. - if (mAllInvalidated) { - return; - } - nsPresContext* pc; for (pc = this; pc; pc = pc->GetParentPresContext()) { if (pc->mFireAfterPaintEvents) @@ -2631,7 +2615,6 @@ nsPresContext::NotifyDidPaintForSubtree(uint32_t aFlags, uint64_t aTransactionId if (aFlags & nsIPresShell::PAINT_LAYERS) { mUndeliveredInvalidateRequestsBeforeLastPaint.TakeFrom( &mInvalidateRequestsSinceLastPaint); - mAllInvalidated = false; } if (aFlags & nsIPresShell::PAINT_COMPOSITE) { nsCOMPtr ev = diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 3ee155435eb8..1cfd8c3331a8 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -971,7 +971,6 @@ public: // and, if necessary, synchronously rebuilding all style data. void EnsureSafeToHandOutCSSRules(); - void NotifyInvalidation(uint32_t aFlags); void NotifyInvalidation(const nsRect& aRect, uint32_t aFlags); // aRect is in device pixels void NotifyInvalidation(const nsIntRect& aRect, uint32_t aFlags); @@ -991,7 +990,6 @@ public: void ClearMozAfterPaintEvents() { mInvalidateRequestsSinceLastPaint.mRequests.Clear(); mUndeliveredInvalidateRequestsBeforeLastPaint.mRequests.Clear(); - mAllInvalidated = false; } /** @@ -1399,9 +1397,6 @@ protected: unsigned mPendingMediaFeatureValuesChanged : 1; unsigned mPrefChangePendingNeedsReflow : 1; unsigned mIsEmulatingMedia : 1; - // True if the requests in mInvalidateRequestsSinceLastPaint cover the - // entire viewport - unsigned mAllInvalidated : 1; // Are we currently drawing an SVG glyph? unsigned mIsGlyph : 1; diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index ce273254c79e..d840f607415d 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -1184,10 +1184,6 @@ nsRefreshDriver::~nsRefreshDriver() mRootRefresh->RemoveRefreshObserver(this, FlushType::Style); mRootRefresh = nullptr; } - for (nsIPresShell* shell : mPresShellsToInvalidateIfHidden) { - shell->InvalidatePresShellIfHidden(); - } - mPresShellsToInvalidateIfHidden.Clear(); } // Method for testing. See nsIDOMWindowUtils.advanceTimeAndRefresh @@ -2005,11 +2001,6 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime) } } - for (nsIPresShell* shell : mPresShellsToInvalidateIfHidden) { - shell->InvalidatePresShellIfHidden(); - } - mPresShellsToInvalidateIfHidden.Clear(); - bool notifyGC = false; if (mViewManagerFlushIsPending) { RefPtr timelines = TimelineConsumers::Get(); diff --git a/layout/base/nsRefreshDriver.h b/layout/base/nsRefreshDriver.h index 492a5a6830f8..54bc739d8b84 100644 --- a/layout/base/nsRefreshDriver.h +++ b/layout/base/nsRefreshDriver.h @@ -190,16 +190,6 @@ public: bool IsLayoutFlushObserver(nsIPresShell* aShell) { return mLayoutFlushObservers.Contains(aShell); } - bool AddPresShellToInvalidateIfHidden(nsIPresShell* aShell) { - NS_ASSERTION(!mPresShellsToInvalidateIfHidden.Contains(aShell), - "Double-adding style flush observer"); - bool appended = mPresShellsToInvalidateIfHidden.AppendElement(aShell) != nullptr; - EnsureTimerStarted(); - return appended; - } - void RemovePresShellToInvalidateIfHidden(nsIPresShell* aShell) { - mPresShellsToInvalidateIfHidden.RemoveElement(aShell); - } /** * Remember whether our presshell's view manager needs a flush @@ -485,7 +475,6 @@ private: AutoTArray mStyleFlushObservers; AutoTArray mLayoutFlushObservers; - AutoTArray mPresShellsToInvalidateIfHidden; // nsTArray on purpose, because we want to be able to swap. nsTArray mFrameRequestCallbackDocs; nsTArray mThrottledFrameRequestCallbackDocs; diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index f3661b6e904f..e187d904dd70 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -6181,10 +6181,6 @@ SchedulePaintInternal(nsIFrame* aFrame, nsIFrame::PaintType aType = nsIFrame::PA if (aType == nsIFrame::PAINT_DEFAULT) { displayRoot->AddStateBits(NS_FRAME_UPDATE_LAYER_TREE); } - nsIPresShell* shell = aFrame->PresContext()->PresShell(); - if (shell) { - shell->AddInvalidateHiddenPresShellObserver(pres->RefreshDriver()); - } } static void InvalidateFrameInternal(nsIFrame *aFrame, bool aHasDisplayItem = true)