Bug 1290335: Reuse the OverflowChangedTracker between both restyle managers. r=heycam

MozReview-Commit-ID: objnqfecZD
This commit is contained in:
Emilio Cobos Álvarez 2016-08-01 18:32:06 -07:00
Родитель 5011eb626b
Коммит 789c630dba
8 изменённых файлов: 22 добавлений и 35 удалений

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

@ -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,

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

@ -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;

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

@ -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);

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

@ -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

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

@ -167,6 +167,11 @@ RestyleManagerHandle::Ptr::SetObservingRefreshDriver(bool aObserving)
FORWARD(SetObservingRefreshDriver, (aObserving));
}
void
RestyleManagerHandle::Ptr::NotifyDestroyingFrame(nsIFrame* aFrame)
{
FORWARD(NotifyDestroyingFrame, (aFrame));
}
} // namespace mozilla

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

@ -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

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

@ -75,7 +75,6 @@ public:
nsresult ReparentStyleContext(nsIFrame* aFrame);
nsresult ProcessRestyledFrames(nsStyleChangeList& aChangeList);
void FlushOverflowChangedTracker();
bool HasPendingRestyles() { return !mModifiedElements.IsEmpty(); }

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

@ -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);
}