Bug 1330375 - P1: Helper for checking for ancestor of dirty reflow root. r=emilio,heycam,rwood

Including refactoring mDirtyRoots into nsIPresShell to avoid virtual call.

MozReview-Commit-ID: KxST8FMsZl9

--HG--
extra : rebase_source : 1be1a8065815bb1e67293c7839c6e9189fc693bc
This commit is contained in:
Dan Glastonbury 2018-07-19 14:18:53 +10:00
Родитель 838fba45cb
Коммит 165882c3b0
3 изменённых файлов: 26 добавлений и 3 удалений

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

@ -4563,6 +4563,27 @@ PresShell::NotifyCounterStylesAreDirty()
mFrameConstructor->NotifyCounterStylesAreDirty();
}
bool
nsIPresShell::FrameIsAncestorOfDirtyRoot(nsIFrame* aFrame) const
{
MOZ_ASSERT(aFrame);
// Look for a path from any dirty roots to aFrame, following GetParent().
// This check mirrors what FrameNeedsReflow() would have done if the reflow
// root didn't get in the way.
for (nsIFrame* dirtyFrame : mDirtyRoots) {
while (dirtyFrame) {
if (dirtyFrame == aFrame) {
return true;
}
dirtyFrame = dirtyFrame->GetParent();
}
}
return false;
}
void
PresShell::ReconstructFrames()
{

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

@ -784,9 +784,6 @@ private:
// we finish reflowing mCurrentReflowRoot.
nsTHashtable<nsPtrHashKey<nsIFrame> > mFramesToDirty;
// Reflow roots that need to be reflowed.
nsTArray<nsIFrame*> mDirtyRoots;
nsTArray<nsAutoPtr<DelayedEvent> > mDelayedEvents;
private:
nsIFrame* mCurrentEventFrame;

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

@ -503,6 +503,8 @@ public:
virtual void NotifyCounterStylesAreDirty() = 0;
bool FrameIsAncestorOfDirtyRoot(nsIFrame* aFrame) const;
/**
* Destroy the frames for aElement, and reconstruct them asynchronously if
* needed.
@ -1761,6 +1763,9 @@ protected:
// A hash table of heap allocated weak frames.
nsTHashtable<nsPtrHashKey<WeakFrame>> mWeakFrames;
// Reflow roots that need to be reflowed.
nsTArray<nsIFrame*> mDirtyRoots;
#ifdef MOZ_GECKO_PROFILER
// These two fields capture call stacks of any changes that require a restyle
// or a reflow. Only the first change per restyle / reflow is recorded (the