зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1416448 - Don't update the ASR during merging for an empty container item, since we can't compute the ASR of the contents. r=miko
This commit is contained in:
Родитель
53892cd491
Коммит
3af1439f69
|
@ -283,17 +283,21 @@ RetainedDisplayListBuilder::IncrementSubDocPresShellPaintCount(nsDisplayItem* aI
|
|||
}
|
||||
|
||||
void UpdateASR(nsDisplayItem* aItem,
|
||||
const ActiveScrolledRoot* aContainerASR)
|
||||
Maybe<const ActiveScrolledRoot*>& aContainerASR)
|
||||
{
|
||||
if (!aContainerASR) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsDisplayWrapList* wrapList = aItem->AsDisplayWrapList();
|
||||
if (!wrapList) {
|
||||
aItem->SetActiveScrolledRoot(aContainerASR);
|
||||
aItem->SetActiveScrolledRoot(aContainerASR.value());
|
||||
return;
|
||||
}
|
||||
|
||||
wrapList->SetActiveScrolledRoot(
|
||||
ActiveScrolledRoot::PickAncestor(wrapList->GetFrameActiveScrolledRoot(),
|
||||
aContainerASR));
|
||||
aContainerASR.value()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -347,22 +351,20 @@ void
|
|||
RetainedDisplayListBuilder::MergeDisplayLists(nsDisplayList* aNewList,
|
||||
nsDisplayList* aOldList,
|
||||
nsDisplayList* aOutList,
|
||||
const ActiveScrolledRoot** aOutContainerASR)
|
||||
Maybe<const ActiveScrolledRoot*>& aOutContainerASR)
|
||||
{
|
||||
nsDisplayList merged(&mBuilder);
|
||||
const ActiveScrolledRoot* containerASR = nullptr;
|
||||
|
||||
const auto UseItem = [&](nsDisplayItem* aItem) {
|
||||
const ActiveScrolledRoot* itemClipASR =
|
||||
aItem->GetClipChain() ? aItem->GetClipChain()->mASR : nullptr;
|
||||
|
||||
const ActiveScrolledRoot* finiteBoundsASR = ActiveScrolledRoot::PickDescendant(
|
||||
itemClipASR, aItem->GetActiveScrolledRoot());
|
||||
if (merged.IsEmpty()) {
|
||||
containerASR = finiteBoundsASR;
|
||||
if (!aOutContainerASR) {
|
||||
aOutContainerASR = Some(finiteBoundsASR);
|
||||
} else {
|
||||
containerASR =
|
||||
ActiveScrolledRoot::PickAncestor(containerASR, finiteBoundsASR);
|
||||
aOutContainerASR =
|
||||
Some(ActiveScrolledRoot::PickAncestor(aOutContainerASR.value(), finiteBoundsASR));
|
||||
}
|
||||
|
||||
merged.AppendToTop(aItem);
|
||||
|
@ -412,9 +414,9 @@ RetainedDisplayListBuilder::MergeDisplayLists(nsDisplayList* aNewList,
|
|||
|
||||
if (oldItem->GetChildren()) {
|
||||
MOZ_ASSERT(newItem->GetChildren());
|
||||
const ActiveScrolledRoot* containerASRForChildren;
|
||||
Maybe<const ActiveScrolledRoot*> containerASRForChildren;
|
||||
MergeDisplayLists(newItem->GetChildren(), oldItem->GetChildren(),
|
||||
oldItem->GetChildren(), &containerASRForChildren);
|
||||
oldItem->GetChildren(), containerASRForChildren);
|
||||
UpdateASR(oldItem, containerASRForChildren);
|
||||
oldItem->UpdateBounds(&mBuilder);
|
||||
}
|
||||
|
@ -432,9 +434,9 @@ RetainedDisplayListBuilder::MergeDisplayLists(nsDisplayList* aNewList,
|
|||
// ensure that we find and remove any invalidated items.
|
||||
if (old->GetChildren()) {
|
||||
nsDisplayList empty(&mBuilder);
|
||||
const ActiveScrolledRoot* containerASRForChildren;
|
||||
Maybe<const ActiveScrolledRoot*> containerASRForChildren;
|
||||
MergeDisplayLists(&empty, old->GetChildren(),
|
||||
old->GetChildren(), &containerASRForChildren);
|
||||
old->GetChildren(), containerASRForChildren);
|
||||
UpdateASR(old, containerASRForChildren);
|
||||
old->UpdateBounds(&mBuilder);
|
||||
}
|
||||
|
@ -462,9 +464,9 @@ RetainedDisplayListBuilder::MergeDisplayLists(nsDisplayList* aNewList,
|
|||
if (!IsAnyAncestorModified(old->FrameForInvalidation()) &&
|
||||
old->GetChildren()) {
|
||||
MOZ_ASSERT(newItem->GetChildren());
|
||||
const ActiveScrolledRoot* containerASRForChildren;
|
||||
Maybe<const ActiveScrolledRoot*> containerASRForChildren;
|
||||
MergeDisplayLists(newItem->GetChildren(), old->GetChildren(),
|
||||
newItem->GetChildren(), &containerASRForChildren);
|
||||
newItem->GetChildren(), containerASRForChildren);
|
||||
UpdateASR(newItem, containerASRForChildren);
|
||||
newItem->UpdateBounds(&mBuilder);
|
||||
}
|
||||
|
@ -489,10 +491,10 @@ RetainedDisplayListBuilder::MergeDisplayLists(nsDisplayList* aNewList,
|
|||
// Passing an empty new display list as an argument skips the merging
|
||||
// loop above and jumps back here.
|
||||
nsDisplayList empty(&mBuilder);
|
||||
const ActiveScrolledRoot* containerASRForChildren;
|
||||
Maybe<const ActiveScrolledRoot*> containerASRForChildren;
|
||||
|
||||
MergeDisplayLists(&empty, old->GetChildren(),
|
||||
old->GetChildren(), &containerASRForChildren);
|
||||
old->GetChildren(), containerASRForChildren);
|
||||
UpdateASR(old, containerASRForChildren);
|
||||
old->UpdateBounds(&mBuilder);
|
||||
}
|
||||
|
@ -506,9 +508,6 @@ RetainedDisplayListBuilder::MergeDisplayLists(nsDisplayList* aNewList,
|
|||
}
|
||||
|
||||
aOutList->AppendToTop(&merged);
|
||||
if (aOutContainerASR) {
|
||||
*aOutContainerASR = containerASR;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -850,7 +849,8 @@ RetainedDisplayListBuilder::AttemptPartialUpdate(nscolor aBackstop)
|
|||
// are not visible anymore) from the old list.
|
||||
// TODO: Optimization opportunity. In this case, MergeDisplayLists()
|
||||
// unnecessarily creates a hashtable of the old items.
|
||||
MergeDisplayLists(&modifiedDL, &mList, &mList, nullptr);
|
||||
Maybe<const ActiveScrolledRoot*> dummy;
|
||||
MergeDisplayLists(&modifiedDL, &mList, &mList, dummy);
|
||||
|
||||
//printf_stderr("Painting --- Merged list:\n");
|
||||
//nsFrame::PrintDisplayList(&mBuilder, mList);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#define RETAINEDDISPLAYLISTBUILDER_H_
|
||||
|
||||
#include "nsDisplayList.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
|
||||
struct RetainedDisplayListBuilder {
|
||||
RetainedDisplayListBuilder(nsIFrame* aReferenceFrame,
|
||||
|
@ -35,7 +36,7 @@ private:
|
|||
void MergeDisplayLists(nsDisplayList* aNewList,
|
||||
nsDisplayList* aOldList,
|
||||
nsDisplayList* aOutList,
|
||||
const mozilla::ActiveScrolledRoot** aOutContainerASR = nullptr);
|
||||
mozilla::Maybe<const mozilla::ActiveScrolledRoot*>& aOutContainerASR);
|
||||
|
||||
bool ComputeRebuildRegion(nsTArray<nsIFrame*>& aModifiedFrames,
|
||||
nsRect* aOutDirty,
|
||||
|
|
Загрузка…
Ссылка в новой задаче