зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1413833 - Cap the number of modified frames that we track to avoid the overhead getting too large. r=miko
--HG-- extra : rebase_source : cc26dd15613b9bbe6ca199d21817cbed16143dfe
This commit is contained in:
Родитель
49b155a761
Коммит
09ea8a23b0
|
@ -7324,26 +7324,6 @@ nsLayoutUtils::GetDisplayRootFrame(nsIFrame* aFrame)
|
|||
}
|
||||
}
|
||||
|
||||
/* static */ nsIFrame*
|
||||
nsLayoutUtils::GetViewportFrame(nsIFrame* aFrame)
|
||||
{
|
||||
nsIFrame* f = aFrame;
|
||||
|
||||
for (;;) {
|
||||
MOZ_ASSERT(f);
|
||||
if (f->Type() == LayoutFrameType::Viewport) {
|
||||
return f;
|
||||
}
|
||||
|
||||
nsIFrame* parent = GetCrossDocParentFrame(f);
|
||||
if (!parent) {
|
||||
return f;
|
||||
}
|
||||
|
||||
f = parent;
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ nsIFrame*
|
||||
nsLayoutUtils::GetReferenceFrame(nsIFrame* aFrame)
|
||||
{
|
||||
|
|
|
@ -2018,11 +2018,6 @@ public:
|
|||
*/
|
||||
static nsIFrame* GetDisplayRootFrame(nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Find the nearest viewport frame that is an ancestor of the given frame.
|
||||
*/
|
||||
static nsIFrame* GetViewportFrame(nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Get the reference frame that would be used when constructing a
|
||||
* display item for this frame. Rather than using their own frame
|
||||
|
|
|
@ -990,22 +990,43 @@ nsIFrame::MarkNeedsDisplayItemRebuild()
|
|||
return;
|
||||
}
|
||||
|
||||
nsIFrame* viewport = nsLayoutUtils::GetViewportFrame(this);
|
||||
MOZ_ASSERT(viewport);
|
||||
nsIFrame* rootFrame = PresContext()->PresShell()->GetRootFrame();
|
||||
MOZ_ASSERT(rootFrame);
|
||||
|
||||
if (rootFrame->IsFrameModified()) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<WeakFrame>* modifiedFrames =
|
||||
viewport->GetProperty(nsIFrame::ModifiedFrameList());
|
||||
rootFrame->GetProperty(nsIFrame::ModifiedFrameList());
|
||||
|
||||
if (!modifiedFrames) {
|
||||
modifiedFrames = new std::vector<WeakFrame>();
|
||||
viewport->SetProperty(nsIFrame::ModifiedFrameList(), modifiedFrames);
|
||||
rootFrame->SetProperty(nsIFrame::ModifiedFrameList(), modifiedFrames);
|
||||
}
|
||||
|
||||
if (this == rootFrame) {
|
||||
// If this is the root frame, then marking us as needing a display
|
||||
// item rebuild implies the same for all our descendents. Clear them
|
||||
// all out to reduce the number of WeakFrames we keep around.
|
||||
for (nsIFrame* f : *modifiedFrames) {
|
||||
if (f) {
|
||||
f->SetFrameIsModified(false);
|
||||
}
|
||||
}
|
||||
modifiedFrames->clear();
|
||||
} else if (modifiedFrames->size() > gfxPrefs::LayoutRebuildFrameLimit()) {
|
||||
// If the list starts getting too big, then just mark the root frame
|
||||
// as needing a rebuild.
|
||||
rootFrame->MarkNeedsDisplayItemRebuild();
|
||||
return;
|
||||
}
|
||||
|
||||
modifiedFrames->emplace_back(this);
|
||||
|
||||
// TODO: this is a bit of a hack. We are using ModifiedFrameList property to
|
||||
// decide whether we are trying to reuse the display list.
|
||||
if (displayRoot != viewport &&
|
||||
if (displayRoot != rootFrame &&
|
||||
!displayRoot->HasProperty(nsIFrame::ModifiedFrameList())) {
|
||||
displayRoot->SetProperty(nsIFrame::ModifiedFrameList(),
|
||||
new std::vector<WeakFrame>());
|
||||
|
|
Загрузка…
Ссылка в новой задаче