diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index 69d76baa84bf..89a83ec7344f 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -105,12 +105,6 @@ RestyleManager::RestyleManager(nsPresContext* aPresContext) mPendingRestyles.Init(this); } -void -RestyleManager::NotifyDestroyingFrame(nsIFrame* aFrame) -{ - mOverflowChangedTracker.RemoveFrame(aFrame); -} - void RestyleManager::RestyleElement(Element* aElement, nsIFrame* aPrimaryFrame, diff --git a/layout/base/RestyleManager.h b/layout/base/RestyleManager.h index 7123cd607bc4..63081592648e 100644 --- a/layout/base/RestyleManager.h +++ b/layout/base/RestyleManager.h @@ -57,10 +57,6 @@ private: public: NS_INLINE_DECL_REFCOUNTING(mozilla::RestyleManager) - // Should be called when a frame is going to be destroyed and - // WillDestroyFrameTree hasn't been called yet. - void NotifyDestroyingFrame(nsIFrame* aFrame); - // Forwarded nsIDocumentObserver method, to handle restyling (and // passing the notification to the frame). nsresult ContentStateChanged(nsIContent* aContent, @@ -395,11 +391,6 @@ public: PostRestyleEventInternal(true); } - void FlushOverflowChangedTracker() - { - mOverflowChangedTracker.Flush(); - } - #ifdef DEBUG static nsCString ChangeHintToString(nsChangeHint aHint); #endif @@ -519,8 +510,6 @@ private: nsChangeHint mRebuildAllExtraHint; nsRestyleHint mRebuildAllRestyleHint; - OverflowChangedTracker mOverflowChangedTracker; - // The total number of animation flushes by this frame constructor. // Used to keep the layer and animation manager in sync. uint64_t mAnimationGeneration; diff --git a/layout/base/RestyleManagerBase.h b/layout/base/RestyleManagerBase.h index 457561283425..f77d291de735 100644 --- a/layout/base/RestyleManagerBase.h +++ b/layout/base/RestyleManagerBase.h @@ -7,13 +7,13 @@ #ifndef mozilla_RestyleManagerBase_h #define mozilla_RestyleManagerBase_h +#include "mozilla/OverflowChangedTracker.h" #include "nsChangeHint.h" class nsStyleChangeList; namespace mozilla { -class OverflowChangedTracker; class ServoRestyleManager; class RestyleManager; @@ -54,6 +54,16 @@ public: static void DebugVerifyStyleTree(nsIFrame* aFrame); #endif + void FlushOverflowChangedTracker() { + mOverflowChangedTracker.Flush(); + } + + // Should be called when a frame is going to be destroyed and + // WillDestroyFrameTree hasn't been called yet. + void NotifyDestroyingFrame(nsIFrame* aFrame) { + mOverflowChangedTracker.RemoveFrame(aFrame); + } + protected: void ContentStateChangedInternal(Element* aElement, EventStates aStateMask, @@ -103,11 +113,13 @@ private: // True if we're already waiting for a refresh notification. bool mObservingRefreshDriver; +protected: + OverflowChangedTracker mOverflowChangedTracker; + /** * These are protected static methods that help with the change hint * processing bits of the restyle managers. */ -protected: static nsIFrame* GetNearestAncestorFrame(nsIContent* aContent); diff --git a/layout/base/RestyleManagerHandle.h b/layout/base/RestyleManagerHandle.h index d9d3acc5aa7b..8daf0f140d3d 100644 --- a/layout/base/RestyleManagerHandle.h +++ b/layout/base/RestyleManagerHandle.h @@ -140,6 +140,7 @@ public: inline void SetObservingRefreshDriver(bool aObserving); inline nsresult ProcessRestyledFrames(nsStyleChangeList& aChangeList); inline void FlushOverflowChangedTracker(); + inline void NotifyDestroyingFrame(nsIFrame* aFrame); private: // Stores a pointer to an RestyleManager or a ServoRestyleManager. The least diff --git a/layout/base/RestyleManagerHandleInlines.h b/layout/base/RestyleManagerHandleInlines.h index 6fc2c8ffaa0f..d3cf078c0182 100644 --- a/layout/base/RestyleManagerHandleInlines.h +++ b/layout/base/RestyleManagerHandleInlines.h @@ -167,6 +167,11 @@ RestyleManagerHandle::Ptr::SetObservingRefreshDriver(bool aObserving) FORWARD(SetObservingRefreshDriver, (aObserving)); } +void +RestyleManagerHandle::Ptr::NotifyDestroyingFrame(nsIFrame* aFrame) +{ + FORWARD(NotifyDestroyingFrame, (aFrame)); +} } // namespace mozilla diff --git a/layout/base/ServoRestyleManager.cpp b/layout/base/ServoRestyleManager.cpp index 47011cffbce7..b5b7a1392b34 100644 --- a/layout/base/ServoRestyleManager.cpp +++ b/layout/base/ServoRestyleManager.cpp @@ -367,17 +367,8 @@ ServoRestyleManager::SnapshotForElement(Element* aElement) nsresult ServoRestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) { - // XXX Hook the overflow tracker somewhere. - OverflowChangedTracker overflowChangedTracker; return base_type::ProcessRestyledFrames(aChangeList, *PresContext(), - overflowChangedTracker); -} - -void -ServoRestyleManager::FlushOverflowChangedTracker() -{ - MOZ_CRASH("stylo: ServoRestyleManager::FlushOverflowChangedTracker " - "not implemented for Servo-backed style system"); + mOverflowChangedTracker); } } // namespace mozilla diff --git a/layout/base/ServoRestyleManager.h b/layout/base/ServoRestyleManager.h index 1ca976f0ded2..2811051c0a98 100644 --- a/layout/base/ServoRestyleManager.h +++ b/layout/base/ServoRestyleManager.h @@ -75,7 +75,6 @@ public: nsresult ReparentStyleContext(nsIFrame* aFrame); nsresult ProcessRestyledFrames(nsStyleChangeList& aChangeList); - void FlushOverflowChangedTracker(); bool HasPendingRestyles() { return !mModifiedElements.IsEmpty(); } diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 8e6d2671b58c..d0bb7589eb7f 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -1611,11 +1611,7 @@ nsCSSFrameConstructor::NotifyDestroyingFrame(nsIFrame* aFrame) CountersDirty(); } - // stylo: ServoRestyleManager does not need to be notified of frames being - // destroyed. - if (mozilla::RestyleManager* geckoRM = RestyleManager()->GetAsGecko()) { - geckoRM->NotifyDestroyingFrame(aFrame); - } + RestyleManager()->NotifyDestroyingFrame(aFrame); nsFrameManager::NotifyDestroyingFrame(aFrame); }