зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1714138 - Remove AnimatedGeometryRoot. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D124154
This commit is contained in:
Родитель
e060744ad1
Коммит
4588b30e2b
|
@ -77,8 +77,7 @@ static void PrintDisplayItemTo(nsDisplayListBuilder* aBuilder,
|
||||||
|
|
||||||
aStream << nsPrintfCString(
|
aStream << nsPrintfCString(
|
||||||
"%s p=0x%p f=0x%p(%s) key=%d %sbounds(%d,%d,%d,%d) "
|
"%s p=0x%p f=0x%p(%s) key=%d %sbounds(%d,%d,%d,%d) "
|
||||||
"componentAlpha(%d,%d,%d,%d) clip(%s) asr(%s) clipChain(%s)%s "
|
"componentAlpha(%d,%d,%d,%d) clip(%s) asr(%s) clipChain(%s)%s ",
|
||||||
"agr=0x%p",
|
|
||||||
aItem->Name(), aItem, (void*)f, NS_ConvertUTF16toUTF8(contentData).get(),
|
aItem->Name(), aItem, (void*)f, NS_ConvertUTF16toUTF8(contentData).get(),
|
||||||
aItem->GetPerFrameKey(),
|
aItem->GetPerFrameKey(),
|
||||||
(aItem->ZIndex() ? nsPrintfCString("z=%d ", aItem->ZIndex()).get() : ""),
|
(aItem->ZIndex() ? nsPrintfCString("z=%d ", aItem->ZIndex()).get() : ""),
|
||||||
|
@ -86,8 +85,7 @@ static void PrintDisplayItemTo(nsDisplayListBuilder* aBuilder,
|
||||||
component.width, component.height, clip.ToString().get(),
|
component.width, component.height, clip.ToString().get(),
|
||||||
ActiveScrolledRoot::ToString(aItem->GetActiveScrolledRoot()).get(),
|
ActiveScrolledRoot::ToString(aItem->GetActiveScrolledRoot()).get(),
|
||||||
DisplayItemClipChain::ToString(aItem->GetClipChain()).get(),
|
DisplayItemClipChain::ToString(aItem->GetClipChain()).get(),
|
||||||
aItem->IsUniform(aBuilder) ? " uniform" : "",
|
aItem->IsUniform(aBuilder) ? " uniform" : "");
|
||||||
aItem->GetAnimatedGeometryRoot()->mFrame);
|
|
||||||
|
|
||||||
for (auto iter = opaque.RectIter(); !iter.Done(); iter.Next()) {
|
for (auto iter = opaque.RectIter(); !iter.Done(); iter.Next()) {
|
||||||
const nsRect& r = iter.Get();
|
const nsRect& r = iter.Get();
|
||||||
|
|
|
@ -4354,9 +4354,6 @@ nsRect ScrollFrameHelper::RestrictToRootDisplayPort(
|
||||||
bool ScrollFrameHelper::DecideScrollableLayer(
|
bool ScrollFrameHelper::DecideScrollableLayer(
|
||||||
nsDisplayListBuilder* aBuilder, nsRect* aVisibleRect, nsRect* aDirtyRect,
|
nsDisplayListBuilder* aBuilder, nsRect* aVisibleRect, nsRect* aDirtyRect,
|
||||||
bool aSetBase, bool* aDirtyRectHasBeenOverriden) {
|
bool aSetBase, bool* aDirtyRectHasBeenOverriden) {
|
||||||
// Save and check if this changes so we can recompute the current agr.
|
|
||||||
bool oldWillBuildScrollableLayer = mWillBuildScrollableLayer;
|
|
||||||
|
|
||||||
nsIContent* content = mOuter->GetContent();
|
nsIContent* content = mOuter->GetContent();
|
||||||
// For hit testing purposes with fission we want to create a
|
// For hit testing purposes with fission we want to create a
|
||||||
// minimal display port for every scroll frame that could be active. (We only
|
// minimal display port for every scroll frame that could be active. (We only
|
||||||
|
@ -4477,13 +4474,6 @@ bool ScrollFrameHelper::DecideScrollableLayer(
|
||||||
mWillBuildScrollableLayer = usingDisplayPort ||
|
mWillBuildScrollableLayer = usingDisplayPort ||
|
||||||
nsContentUtils::HasScrollgrab(content) ||
|
nsContentUtils::HasScrollgrab(content) ||
|
||||||
mZoomableByAPZ;
|
mZoomableByAPZ;
|
||||||
|
|
||||||
// The cached animated geometry root for the display builder is out of
|
|
||||||
// date if we just introduced a new animated geometry root.
|
|
||||||
if (oldWillBuildScrollableLayer != mWillBuildScrollableLayer) {
|
|
||||||
aBuilder->RecomputeCurrentAnimatedGeometryRoot();
|
|
||||||
}
|
|
||||||
|
|
||||||
return mWillBuildScrollableLayer;
|
return mWillBuildScrollableLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1169,9 +1169,7 @@ bool RetainedDisplayListBuilder::ProcessFrame(
|
||||||
|
|
||||||
// TODO: There is almost certainly a faster way of doing this, probably can be
|
// TODO: There is almost certainly a faster way of doing this, probably can be
|
||||||
// combined with the ancestor walk for TransformFrameRectToAncestor.
|
// combined with the ancestor walk for TransformFrameRectToAncestor.
|
||||||
AnimatedGeometryRoot* agr =
|
nsIFrame* agrFrame = aBuilder->FindAnimatedGeometryRootFrameFor(aFrame);
|
||||||
aBuilder->FindAnimatedGeometryRootFor(aFrame)->GetAsyncAGR();
|
|
||||||
nsIFrame* agrFrame = agr ? agr->mFrame : nullptr;
|
|
||||||
|
|
||||||
CRR_LOG("Processing frame %p with agr %p\n", aFrame, agr->mFrame);
|
CRR_LOG("Processing frame %p with agr %p\n", aFrame, agr->mFrame);
|
||||||
|
|
||||||
|
|
|
@ -619,11 +619,7 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
|
||||||
mCurrentContainerASR(nullptr),
|
mCurrentContainerASR(nullptr),
|
||||||
mCurrentFrame(aReferenceFrame),
|
mCurrentFrame(aReferenceFrame),
|
||||||
mCurrentReferenceFrame(aReferenceFrame),
|
mCurrentReferenceFrame(aReferenceFrame),
|
||||||
mRootAGR(AnimatedGeometryRoot::CreateAGRForFrame(
|
|
||||||
aReferenceFrame, nullptr, true, aRetainingDisplayList)),
|
|
||||||
mCurrentAGR(mRootAGR),
|
|
||||||
mBuildingExtraPagesForPageNum(0),
|
mBuildingExtraPagesForPageNum(0),
|
||||||
mUsedAGRBudget(0),
|
|
||||||
mDirtyRect(-1, -1, -1, -1),
|
mDirtyRect(-1, -1, -1, -1),
|
||||||
mGlassDisplayItem(nullptr),
|
mGlassDisplayItem(nullptr),
|
||||||
mHasGlassItemDuringPartial(false),
|
mHasGlassItemDuringPartial(false),
|
||||||
|
@ -708,9 +704,6 @@ static PresShell* GetFocusedPresShell() {
|
||||||
|
|
||||||
void nsDisplayListBuilder::BeginFrame() {
|
void nsDisplayListBuilder::BeginFrame() {
|
||||||
nsCSSRendering::BeginFrameTreesLocked();
|
nsCSSRendering::BeginFrameTreesLocked();
|
||||||
mCurrentAGR = mRootAGR;
|
|
||||||
mFrameToAnimatedGeometryRootMap.InsertOrUpdate(mReferenceFrame,
|
|
||||||
RefPtr{mRootAGR});
|
|
||||||
|
|
||||||
mIsPaintingToWindow = false;
|
mIsPaintingToWindow = false;
|
||||||
mUseHighQualityScaling = false;
|
mUseHighQualityScaling = false;
|
||||||
|
@ -743,8 +736,6 @@ void nsDisplayListBuilder::BeginFrame() {
|
||||||
void nsDisplayListBuilder::EndFrame() {
|
void nsDisplayListBuilder::EndFrame() {
|
||||||
NS_ASSERTION(!mInInvalidSubtree,
|
NS_ASSERTION(!mInInvalidSubtree,
|
||||||
"Someone forgot to cleanup mInInvalidSubtree!");
|
"Someone forgot to cleanup mInInvalidSubtree!");
|
||||||
mFrameToAnimatedGeometryRootMap.Clear();
|
|
||||||
mAGRBudgetSet.Clear();
|
|
||||||
mActiveScrolledRoots.Clear();
|
mActiveScrolledRoots.Clear();
|
||||||
mEffectsUpdates.Clear();
|
mEffectsUpdates.Clear();
|
||||||
FreeClipChains();
|
FreeClipChains();
|
||||||
|
@ -828,83 +819,6 @@ bool nsDisplayListBuilder::NeedToForceTransparentSurfaceForItem(
|
||||||
return aItem == mGlassDisplayItem;
|
return aItem == mGlassDisplayItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimatedGeometryRoot* nsDisplayListBuilder::WrapAGRForFrame(
|
|
||||||
nsIFrame* aAnimatedGeometryRoot, bool aIsAsync,
|
|
||||||
AnimatedGeometryRoot* aParent /* = nullptr */) {
|
|
||||||
DebugOnly<bool> dummy;
|
|
||||||
MOZ_ASSERT(IsAnimatedGeometryRoot(aAnimatedGeometryRoot, dummy) == AGR_YES);
|
|
||||||
|
|
||||||
RefPtr<AnimatedGeometryRoot> result =
|
|
||||||
mFrameToAnimatedGeometryRootMap.Get(aAnimatedGeometryRoot);
|
|
||||||
if (!result) {
|
|
||||||
MOZ_ASSERT(nsLayoutUtils::IsAncestorFrameCrossDocInProcess(
|
|
||||||
RootReferenceFrame(), aAnimatedGeometryRoot));
|
|
||||||
RefPtr<AnimatedGeometryRoot> parent = aParent;
|
|
||||||
if (!parent) {
|
|
||||||
nsIFrame* parentFrame =
|
|
||||||
nsLayoutUtils::GetCrossDocParentFrameInProcess(aAnimatedGeometryRoot);
|
|
||||||
if (parentFrame) {
|
|
||||||
bool isAsync;
|
|
||||||
nsIFrame* parentAGRFrame =
|
|
||||||
FindAnimatedGeometryRootFrameFor(parentFrame, isAsync);
|
|
||||||
parent = WrapAGRForFrame(parentAGRFrame, isAsync);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result = AnimatedGeometryRoot::CreateAGRForFrame(
|
|
||||||
aAnimatedGeometryRoot, parent, aIsAsync, IsRetainingDisplayList());
|
|
||||||
mFrameToAnimatedGeometryRootMap.InsertOrUpdate(aAnimatedGeometryRoot,
|
|
||||||
RefPtr{result});
|
|
||||||
}
|
|
||||||
MOZ_ASSERT(!aParent || result->mParentAGR == aParent);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
AnimatedGeometryRoot* nsDisplayListBuilder::AnimatedGeometryRootForASR(
|
|
||||||
const ActiveScrolledRoot* aASR) {
|
|
||||||
if (!aASR) {
|
|
||||||
return GetRootAnimatedGeometryRoot();
|
|
||||||
}
|
|
||||||
nsIFrame* scrolledFrame = aASR->mScrollableFrame->GetScrolledFrame();
|
|
||||||
return FindAnimatedGeometryRootFor(scrolledFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
AnimatedGeometryRoot* nsDisplayListBuilder::FindAnimatedGeometryRootFor(
|
|
||||||
nsIFrame* aFrame) {
|
|
||||||
if (!IsPaintingToWindow()) {
|
|
||||||
return mRootAGR;
|
|
||||||
}
|
|
||||||
if (aFrame == mCurrentFrame) {
|
|
||||||
return mCurrentAGR;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<AnimatedGeometryRoot> result =
|
|
||||||
mFrameToAnimatedGeometryRootMap.Get(aFrame);
|
|
||||||
if (result) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isAsync;
|
|
||||||
nsIFrame* agrFrame = FindAnimatedGeometryRootFrameFor(aFrame, isAsync);
|
|
||||||
result = WrapAGRForFrame(agrFrame, isAsync);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
AnimatedGeometryRoot* nsDisplayListBuilder::FindAnimatedGeometryRootFor(
|
|
||||||
nsDisplayItem* aItem) {
|
|
||||||
if (aItem->ShouldFixToViewport(this)) {
|
|
||||||
// Make its active scrolled root be the active scrolled root of
|
|
||||||
// the enclosing viewport, since it shouldn't be scrolled by scrolled
|
|
||||||
// frames in its document. InvalidateFixedBackgroundFramesFromList in
|
|
||||||
// nsGfxScrollFrame will not repaint this item when scrolling occurs.
|
|
||||||
nsIFrame* viewportFrame = nsLayoutUtils::GetClosestFrameOfType(
|
|
||||||
aItem->Frame(), LayoutFrameType::Viewport, RootReferenceFrame());
|
|
||||||
if (viewportFrame) {
|
|
||||||
return FindAnimatedGeometryRootFor(viewportFrame);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return FindAnimatedGeometryRootFor(aItem->Frame());
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsDisplayListBuilder::SetIsRelativeToLayoutViewport() {
|
void nsDisplayListBuilder::SetIsRelativeToLayoutViewport() {
|
||||||
mIsRelativeToLayoutViewport = true;
|
mIsRelativeToLayoutViewport = true;
|
||||||
UpdateShouldBuildAsyncZoomContainer();
|
UpdateShouldBuildAsyncZoomContainer();
|
||||||
|
@ -1266,8 +1180,6 @@ void nsDisplayListBuilder::LeavePresShell(const nsIFrame* aReferenceFrame,
|
||||||
}
|
}
|
||||||
mIsInChromePresContext = pc->IsChrome();
|
mIsInChromePresContext = pc->IsChrome();
|
||||||
} else {
|
} else {
|
||||||
mCurrentAGR = mRootAGR;
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < mFramesMarkedForDisplayIfVisible.Length(); ++i) {
|
for (uint32_t i = 0; i < mFramesMarkedForDisplayIfVisible.Length(); ++i) {
|
||||||
UnmarkFrameForDisplayIfVisible(mFramesMarkedForDisplayIfVisible[i]);
|
UnmarkFrameForDisplayIfVisible(mFramesMarkedForDisplayIfVisible[i]);
|
||||||
}
|
}
|
||||||
|
@ -1629,40 +1541,35 @@ static bool IsStickyFrameActive(nsDisplayListBuilder* aBuilder,
|
||||||
return sf->IsScrollingActive();
|
return sf->IsScrollingActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDisplayListBuilder::AGRState nsDisplayListBuilder::IsAnimatedGeometryRoot(
|
bool nsDisplayListBuilder::IsAnimatedGeometryRoot(nsIFrame* aFrame,
|
||||||
nsIFrame* aFrame, bool& aIsAsync, nsIFrame** aParent) {
|
nsIFrame** aParent) {
|
||||||
// We can return once we know that this frame is an AGR, and we're either
|
|
||||||
// async, or sure that none of the later conditions might make us async.
|
|
||||||
// The exception to this is when IsPaintingToWindow() == false.
|
|
||||||
aIsAsync = false;
|
|
||||||
if (aFrame == mReferenceFrame) {
|
if (aFrame == mReferenceFrame) {
|
||||||
aIsAsync = true;
|
return true;
|
||||||
return AGR_YES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsPaintingToWindow()) {
|
if (!IsPaintingToWindow()) {
|
||||||
if (aParent) {
|
if (aParent) {
|
||||||
*aParent = nsLayoutUtils::GetCrossDocParentFrameInProcess(aFrame);
|
*aParent = nsLayoutUtils::GetCrossDocParentFrameInProcess(aFrame);
|
||||||
}
|
}
|
||||||
return AGR_NO;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIFrame* parent = nsLayoutUtils::GetCrossDocParentFrameInProcess(aFrame);
|
nsIFrame* parent = nsLayoutUtils::GetCrossDocParentFrameInProcess(aFrame);
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
aIsAsync = true;
|
return true;
|
||||||
return AGR_YES;
|
|
||||||
}
|
}
|
||||||
|
*aParent = parent;
|
||||||
|
|
||||||
if (aFrame->StyleDisplay()->mPosition == StylePositionProperty::Sticky &&
|
if (aFrame->StyleDisplay()->mPosition == StylePositionProperty::Sticky &&
|
||||||
IsStickyFrameActive(this, aFrame, parent)) {
|
IsStickyFrameActive(this, aFrame, parent)) {
|
||||||
aIsAsync = true;
|
return true;
|
||||||
return AGR_YES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aFrame->IsTransformed()) {
|
if (aFrame->IsTransformed()) {
|
||||||
aIsAsync = EffectCompositor::HasAnimationsForCompositor(
|
if (EffectCompositor::HasAnimationsForCompositor(
|
||||||
aFrame, DisplayItemType::TYPE_TRANSFORM);
|
aFrame, DisplayItemType::TYPE_TRANSFORM)) {
|
||||||
return AGR_YES;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutFrameType parentType = parent->Type();
|
LayoutFrameType parentType = parent->Type();
|
||||||
|
@ -1671,95 +1578,28 @@ nsDisplayListBuilder::AGRState nsDisplayListBuilder::IsAnimatedGeometryRoot(
|
||||||
nsIScrollableFrame* sf = do_QueryFrame(parent);
|
nsIScrollableFrame* sf = do_QueryFrame(parent);
|
||||||
if (sf->GetScrolledFrame() == aFrame && sf->IsScrollingActive()) {
|
if (sf->GetScrolledFrame() == aFrame && sf->IsScrollingActive()) {
|
||||||
MOZ_ASSERT(!aFrame->IsTransformed());
|
MOZ_ASSERT(!aFrame->IsTransformed());
|
||||||
aIsAsync = sf->IsMaybeAsynchronouslyScrolled();
|
return sf->IsMaybeAsynchronouslyScrolled();
|
||||||
return AGR_YES;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Treat the slider thumb as being as an active scrolled root when it wants
|
return false;
|
||||||
// its own layer so that it can move without repainting.
|
|
||||||
if (parentType == LayoutFrameType::Slider) {
|
|
||||||
auto* sf = static_cast<nsSliderFrame*>(parent)->GetScrollFrame();
|
|
||||||
if (sf && sf->IsScrollingActive()) {
|
|
||||||
return AGR_YES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nsLayoutUtils::IsPopup(aFrame)) {
|
|
||||||
return AGR_YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ActiveLayerTracker::IsOffsetStyleAnimated(aFrame)) {
|
|
||||||
const bool inBudget = AddToAGRBudget(aFrame);
|
|
||||||
if (inBudget) {
|
|
||||||
return AGR_YES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!aFrame->GetParent() &&
|
|
||||||
DisplayPortUtils::ViewportHasDisplayPort(aFrame->PresContext())) {
|
|
||||||
// Viewport frames in a display port need to be animated geometry roots
|
|
||||||
// for background-attachment:fixed elements.
|
|
||||||
return AGR_YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fixed-pos frames are parented by the viewport frame, which has no parent.
|
|
||||||
if (DisplayPortUtils::IsFixedPosFrameInDisplayPort(aFrame)) {
|
|
||||||
return AGR_YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aParent) {
|
|
||||||
*aParent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
return AGR_NO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIFrame* nsDisplayListBuilder::FindAnimatedGeometryRootFrameFor(
|
nsIFrame* nsDisplayListBuilder::FindAnimatedGeometryRootFrameFor(
|
||||||
nsIFrame* aFrame, bool& aIsAsync) {
|
nsIFrame* aFrame) {
|
||||||
MOZ_ASSERT(nsLayoutUtils::IsAncestorFrameCrossDocInProcess(
|
MOZ_ASSERT(nsLayoutUtils::IsAncestorFrameCrossDocInProcess(
|
||||||
RootReferenceFrame(), aFrame));
|
RootReferenceFrame(), aFrame));
|
||||||
nsIFrame* cursor = aFrame;
|
nsIFrame* cursor = aFrame;
|
||||||
while (cursor != RootReferenceFrame()) {
|
while (cursor != RootReferenceFrame()) {
|
||||||
nsIFrame* next;
|
nsIFrame* next;
|
||||||
if (IsAnimatedGeometryRoot(cursor, aIsAsync, &next) == AGR_YES) {
|
if (IsAnimatedGeometryRoot(cursor, &next)) {
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
cursor = next;
|
cursor = next;
|
||||||
}
|
}
|
||||||
// Root frame is always an async agr.
|
|
||||||
aIsAsync = true;
|
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsDisplayListBuilder::RecomputeCurrentAnimatedGeometryRoot() {
|
|
||||||
bool isAsync;
|
|
||||||
if (*mCurrentAGR != mCurrentFrame &&
|
|
||||||
IsAnimatedGeometryRoot(const_cast<nsIFrame*>(mCurrentFrame), isAsync) ==
|
|
||||||
AGR_YES) {
|
|
||||||
AnimatedGeometryRoot* oldAGR = mCurrentAGR;
|
|
||||||
mCurrentAGR = WrapAGRForFrame(const_cast<nsIFrame*>(mCurrentFrame), isAsync,
|
|
||||||
mCurrentAGR);
|
|
||||||
|
|
||||||
// Iterate the AGR cache and look for any objects that reference the old AGR
|
|
||||||
// and check to see if they need to be updated. AGRs can be in the cache
|
|
||||||
// multiple times, so we may end up doing the work multiple times for AGRs
|
|
||||||
// that don't change.
|
|
||||||
for (const RefPtr<AnimatedGeometryRoot>& cached :
|
|
||||||
mFrameToAnimatedGeometryRootMap.Values()) {
|
|
||||||
if (cached->mParentAGR == oldAGR && cached != mCurrentAGR) {
|
|
||||||
// It's possible that this cached AGR struct that has the old AGR as a
|
|
||||||
// parent should instead have mCurrentFrame has a parent.
|
|
||||||
nsIFrame* parent = FindAnimatedGeometryRootFrameFor(*cached, isAsync);
|
|
||||||
MOZ_ASSERT(parent == mCurrentFrame || parent == *oldAGR);
|
|
||||||
if (parent == mCurrentFrame) {
|
|
||||||
cached->mParentAGR = mCurrentAGR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static nsRect ApplyAllClipNonRoundedIntersection(
|
static nsRect ApplyAllClipNonRoundedIntersection(
|
||||||
const DisplayItemClipChain* aClipChain, const nsRect& aRect) {
|
const DisplayItemClipChain* aClipChain, const nsRect& aRect) {
|
||||||
nsRect result = aRect;
|
nsRect result = aRect;
|
||||||
|
@ -1891,7 +1731,6 @@ void nsDisplayListBuilder::AddSizeOfExcludingThis(nsWindowSizes& aSizes) const {
|
||||||
MallocSizeOf mallocSizeOf = aSizes.mState.mMallocSizeOf;
|
MallocSizeOf mallocSizeOf = aSizes.mState.mMallocSizeOf;
|
||||||
n += mDocumentWillChangeBudgets.ShallowSizeOfExcludingThis(mallocSizeOf);
|
n += mDocumentWillChangeBudgets.ShallowSizeOfExcludingThis(mallocSizeOf);
|
||||||
n += mFrameWillChangeBudgets.ShallowSizeOfExcludingThis(mallocSizeOf);
|
n += mFrameWillChangeBudgets.ShallowSizeOfExcludingThis(mallocSizeOf);
|
||||||
n += mAGRBudgetSet.ShallowSizeOfExcludingThis(mallocSizeOf);
|
|
||||||
n += mEffectsUpdates.ShallowSizeOfExcludingThis(mallocSizeOf);
|
n += mEffectsUpdates.ShallowSizeOfExcludingThis(mallocSizeOf);
|
||||||
n += mWindowExcludeGlassRegion.SizeOfExcludingThis(mallocSizeOf);
|
n += mWindowExcludeGlassRegion.SizeOfExcludingThis(mallocSizeOf);
|
||||||
n += mRetainedWindowDraggingRegion.SizeOfExcludingThis(mallocSizeOf);
|
n += mRetainedWindowDraggingRegion.SizeOfExcludingThis(mallocSizeOf);
|
||||||
|
@ -2086,40 +1925,6 @@ void nsDisplayListBuilder::ClearWillChangeBudgets() {
|
||||||
mDocumentWillChangeBudgets.Clear();
|
mDocumentWillChangeBudgets.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
|
||||||
const float gAGRBudgetAreaMultiplier = 0.3;
|
|
||||||
#else
|
|
||||||
const float gAGRBudgetAreaMultiplier = 3.0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool nsDisplayListBuilder::AddToAGRBudget(nsIFrame* aFrame) {
|
|
||||||
if (mAGRBudgetSet.Contains(aFrame)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nsPresContext* presContext =
|
|
||||||
aFrame->PresContext()->GetRootPresContext();
|
|
||||||
if (!presContext) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nsRect area = presContext->GetVisibleArea();
|
|
||||||
const uint32_t budgetLimit =
|
|
||||||
gAGRBudgetAreaMultiplier *
|
|
||||||
nsPresContext::AppUnitsToIntCSSPixels(area.width) *
|
|
||||||
nsPresContext::AppUnitsToIntCSSPixels(area.height);
|
|
||||||
|
|
||||||
const uint32_t cost = GetLayerizationCost(aFrame->GetSize());
|
|
||||||
const bool onBudget = mUsedAGRBudget + cost < budgetLimit;
|
|
||||||
|
|
||||||
if (onBudget) {
|
|
||||||
mUsedAGRBudget += cost;
|
|
||||||
mAGRBudgetSet.Insert(aFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
return onBudget;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsDisplayListBuilder::EnterSVGEffectsContents(
|
void nsDisplayListBuilder::EnterSVGEffectsContents(
|
||||||
nsIFrame* aEffectsFrame, nsDisplayList* aHoistedItemsStorage) {
|
nsIFrame* aEffectsFrame, nsDisplayList* aHoistedItemsStorage) {
|
||||||
MOZ_ASSERT(aHoistedItemsStorage);
|
MOZ_ASSERT(aHoistedItemsStorage);
|
||||||
|
@ -2761,12 +2566,6 @@ nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||||
}
|
}
|
||||||
|
|
||||||
aBuilder->FindReferenceFrameFor(aFrame, &mToReferenceFrame);
|
aBuilder->FindReferenceFrameFor(aFrame, &mToReferenceFrame);
|
||||||
// This can return the wrong result if the item override
|
|
||||||
// ShouldFixToViewport(), the item needs to set it again in its constructor.
|
|
||||||
mAnimatedGeometryRoot = aBuilder->FindAnimatedGeometryRootFor(aFrame);
|
|
||||||
MOZ_ASSERT(nsLayoutUtils::IsAncestorFrameCrossDocInProcess(
|
|
||||||
aBuilder->RootReferenceFrame(), *mAnimatedGeometryRoot),
|
|
||||||
"Bad");
|
|
||||||
NS_ASSERTION(
|
NS_ASSERTION(
|
||||||
aBuilder->GetVisibleRect().width >= 0 || !aBuilder->IsForPainting(),
|
aBuilder->GetVisibleRect().width >= 0 || !aBuilder->IsForPainting(),
|
||||||
"visible rect not set");
|
"visible rect not set");
|
||||||
|
@ -3095,9 +2894,6 @@ nsDisplayBackgroundImage::nsDisplayBackgroundImage(
|
||||||
|
|
||||||
mBounds = GetBoundsInternal(aInitData.builder, aFrameForBounds);
|
mBounds = GetBoundsInternal(aInitData.builder, aFrameForBounds);
|
||||||
if (mShouldFixToViewport) {
|
if (mShouldFixToViewport) {
|
||||||
mAnimatedGeometryRoot =
|
|
||||||
aInitData.builder->FindAnimatedGeometryRootFor(this);
|
|
||||||
|
|
||||||
// Expand the item's visible rect to cover the entire bounds, limited to the
|
// Expand the item's visible rect to cover the entire bounds, limited to the
|
||||||
// viewport rect. This is necessary because the background's clip can move
|
// viewport rect. This is necessary because the background's clip can move
|
||||||
// asynchronously.
|
// asynchronously.
|
||||||
|
@ -5419,14 +5215,6 @@ nsDisplayOwnLayer::nsDisplayOwnLayer(
|
||||||
mForceActive(aForceActive),
|
mForceActive(aForceActive),
|
||||||
mWrAnimationId(0) {
|
mWrAnimationId(0) {
|
||||||
MOZ_COUNT_CTOR(nsDisplayOwnLayer);
|
MOZ_COUNT_CTOR(nsDisplayOwnLayer);
|
||||||
|
|
||||||
// For scroll thumb layers, override the AGR to be the thumb's AGR rather
|
|
||||||
// than the AGR for mFrame (which is the slider frame).
|
|
||||||
if (IsScrollThumbLayer()) {
|
|
||||||
if (nsIFrame* thumbFrame = nsIFrame::GetChildXULBox(mFrame)) {
|
|
||||||
mAnimatedGeometryRoot = aBuilder->FindAnimatedGeometryRootFor(thumbFrame);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsDisplayOwnLayer::IsScrollThumbLayer() const {
|
bool nsDisplayOwnLayer::IsScrollThumbLayer() const {
|
||||||
|
@ -5593,13 +5381,6 @@ nsDisplaySubDocument::nsDisplaySubDocument(nsDisplayListBuilder* aBuilder,
|
||||||
mSubDocFrame(aSubDocFrame) {
|
mSubDocFrame(aSubDocFrame) {
|
||||||
MOZ_COUNT_CTOR(nsDisplaySubDocument);
|
MOZ_COUNT_CTOR(nsDisplaySubDocument);
|
||||||
|
|
||||||
// The SubDocument display item is conceptually outside the viewport frame,
|
|
||||||
// so in cases where the viewport frame is an AGR, the SubDocument's AGR
|
|
||||||
// should be not the viewport frame itself, but its parent AGR.
|
|
||||||
if (*mAnimatedGeometryRoot == mFrame && mAnimatedGeometryRoot->mParentAGR) {
|
|
||||||
mAnimatedGeometryRoot = mAnimatedGeometryRoot->mParentAGR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mSubDocFrame && mSubDocFrame != mFrame) {
|
if (mSubDocFrame && mSubDocFrame != mFrame) {
|
||||||
mSubDocFrame->AddDisplayItem(this);
|
mSubDocFrame->AddDisplayItem(this);
|
||||||
}
|
}
|
||||||
|
@ -5693,7 +5474,6 @@ nsDisplayFixedPosition::nsDisplayFixedPosition(
|
||||||
mContainerASR(aContainerASR),
|
mContainerASR(aContainerASR),
|
||||||
mIsFixedBackground(false) {
|
mIsFixedBackground(false) {
|
||||||
MOZ_COUNT_CTOR(nsDisplayFixedPosition);
|
MOZ_COUNT_CTOR(nsDisplayFixedPosition);
|
||||||
Init(aBuilder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDisplayFixedPosition::nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder,
|
nsDisplayFixedPosition::nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder,
|
||||||
|
@ -5704,14 +5484,6 @@ nsDisplayFixedPosition::nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder,
|
||||||
mContainerASR(nullptr), // XXX maybe this should be something?
|
mContainerASR(nullptr), // XXX maybe this should be something?
|
||||||
mIsFixedBackground(true) {
|
mIsFixedBackground(true) {
|
||||||
MOZ_COUNT_CTOR(nsDisplayFixedPosition);
|
MOZ_COUNT_CTOR(nsDisplayFixedPosition);
|
||||||
Init(aBuilder);
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsDisplayFixedPosition::Init(nsDisplayListBuilder* aBuilder) {
|
|
||||||
mAnimatedGeometryRootForScrollMetadata = mAnimatedGeometryRoot;
|
|
||||||
if (ShouldFixToViewport(aBuilder)) {
|
|
||||||
mAnimatedGeometryRoot = aBuilder->FindAnimatedGeometryRootFor(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollableLayerGuid::ViewID nsDisplayFixedPosition::GetScrollTargetId() {
|
ScrollableLayerGuid::ViewID nsDisplayFixedPosition::GetScrollTargetId() {
|
||||||
|
@ -6249,8 +6021,6 @@ nsDisplayTransform::nsDisplayTransform(nsDisplayListBuilder* aBuilder,
|
||||||
const nsRect& aChildrenBuildingRect)
|
const nsRect& aChildrenBuildingRect)
|
||||||
: nsPaintedDisplayItem(aBuilder, aFrame),
|
: nsPaintedDisplayItem(aBuilder, aFrame),
|
||||||
mTransform(Some(Matrix4x4())),
|
mTransform(Some(Matrix4x4())),
|
||||||
mAnimatedGeometryRootForChildren(mAnimatedGeometryRoot),
|
|
||||||
mAnimatedGeometryRootForScrollMetadata(mAnimatedGeometryRoot),
|
|
||||||
mChildrenBuildingRect(aChildrenBuildingRect),
|
mChildrenBuildingRect(aChildrenBuildingRect),
|
||||||
mPrerenderDecision(PrerenderDecision::No),
|
mPrerenderDecision(PrerenderDecision::No),
|
||||||
mIsTransformSeparator(true),
|
mIsTransformSeparator(true),
|
||||||
|
@ -6265,8 +6035,6 @@ nsDisplayTransform::nsDisplayTransform(nsDisplayListBuilder* aBuilder,
|
||||||
const nsRect& aChildrenBuildingRect,
|
const nsRect& aChildrenBuildingRect,
|
||||||
PrerenderDecision aPrerenderDecision)
|
PrerenderDecision aPrerenderDecision)
|
||||||
: nsPaintedDisplayItem(aBuilder, aFrame),
|
: nsPaintedDisplayItem(aBuilder, aFrame),
|
||||||
mAnimatedGeometryRootForChildren(mAnimatedGeometryRoot),
|
|
||||||
mAnimatedGeometryRootForScrollMetadata(mAnimatedGeometryRoot),
|
|
||||||
mChildrenBuildingRect(aChildrenBuildingRect),
|
mChildrenBuildingRect(aChildrenBuildingRect),
|
||||||
mPrerenderDecision(aPrerenderDecision),
|
mPrerenderDecision(aPrerenderDecision),
|
||||||
mIsTransformSeparator(false),
|
mIsTransformSeparator(false),
|
||||||
|
@ -6282,8 +6050,6 @@ nsDisplayTransform::nsDisplayTransform(nsDisplayListBuilder* aBuilder,
|
||||||
const nsRect& aChildrenBuildingRect,
|
const nsRect& aChildrenBuildingRect,
|
||||||
decltype(WithTransformGetter))
|
decltype(WithTransformGetter))
|
||||||
: nsPaintedDisplayItem(aBuilder, aFrame),
|
: nsPaintedDisplayItem(aBuilder, aFrame),
|
||||||
mAnimatedGeometryRootForChildren(mAnimatedGeometryRoot),
|
|
||||||
mAnimatedGeometryRootForScrollMetadata(mAnimatedGeometryRoot),
|
|
||||||
mChildrenBuildingRect(aChildrenBuildingRect),
|
mChildrenBuildingRect(aChildrenBuildingRect),
|
||||||
mPrerenderDecision(PrerenderDecision::No),
|
mPrerenderDecision(PrerenderDecision::No),
|
||||||
mIsTransformSeparator(false),
|
mIsTransformSeparator(false),
|
||||||
|
@ -6314,32 +6080,6 @@ void nsDisplayTransform::SetReferenceFrameToAncestor(
|
||||||
nsIFrame* outerFrame = nsLayoutUtils::GetCrossDocParentFrameInProcess(mFrame);
|
nsIFrame* outerFrame = nsLayoutUtils::GetCrossDocParentFrameInProcess(mFrame);
|
||||||
const nsIFrame* referenceFrame = aBuilder->FindReferenceFrameFor(outerFrame);
|
const nsIFrame* referenceFrame = aBuilder->FindReferenceFrameFor(outerFrame);
|
||||||
mToReferenceFrame = mFrame->GetOffsetToCrossDoc(referenceFrame);
|
mToReferenceFrame = mFrame->GetOffsetToCrossDoc(referenceFrame);
|
||||||
|
|
||||||
if (DisplayPortUtils::IsFixedPosFrameInDisplayPort(mFrame)) {
|
|
||||||
// This is an odd special case. If we are both IsFixedPosFrameInDisplayPort
|
|
||||||
// and transformed that we are our own AGR parent.
|
|
||||||
// We want our frame to be our AGR because FrameLayerBuilder uses our AGR to
|
|
||||||
// determine if we are inside a fixed pos subtree. If we use the outer AGR
|
|
||||||
// from outside the fixed pos subtree FLB can't tell that we are fixed pos.
|
|
||||||
mAnimatedGeometryRoot = mAnimatedGeometryRootForChildren;
|
|
||||||
} else if (mFrame->StyleDisplay()->mPosition ==
|
|
||||||
StylePositionProperty::Sticky &&
|
|
||||||
IsStickyFrameActive(aBuilder, mFrame, nullptr)) {
|
|
||||||
// Similar to the IsFixedPosFrameInDisplayPort case we are our own AGR.
|
|
||||||
// We are inside the sticky position, so our AGR is the sticky positioned
|
|
||||||
// frame, which is our AGR, not the parent AGR.
|
|
||||||
mAnimatedGeometryRoot = mAnimatedGeometryRootForChildren;
|
|
||||||
} else if (mAnimatedGeometryRoot->mParentAGR) {
|
|
||||||
mAnimatedGeometryRootForScrollMetadata = mAnimatedGeometryRoot->mParentAGR;
|
|
||||||
if (!MayBeAnimated(aBuilder)) {
|
|
||||||
// If we're an animated transform then we want the same AGR as our
|
|
||||||
// children so that FrameLayerBuilder knows that this layer moves with the
|
|
||||||
// transform and won't compute occlusions. If we're not animated then use
|
|
||||||
// our parent AGR so that inactive transform layers can go in the same
|
|
||||||
// PaintedLayer as surrounding content.
|
|
||||||
mAnimatedGeometryRoot = mAnimatedGeometryRoot->mParentAGR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsDisplayTransform::Init(nsDisplayListBuilder* aBuilder,
|
void nsDisplayTransform::Init(nsDisplayListBuilder* aBuilder,
|
||||||
|
@ -7608,8 +7348,6 @@ nsDisplayPerspective::nsDisplayPerspective(nsDisplayListBuilder* aBuilder,
|
||||||
mList.AppendToTop(aList);
|
mList.AppendToTop(aList);
|
||||||
MOZ_ASSERT(mList.Count() == 1);
|
MOZ_ASSERT(mList.Count() == 1);
|
||||||
MOZ_ASSERT(mList.GetTop()->GetType() == DisplayItemType::TYPE_TRANSFORM);
|
MOZ_ASSERT(mList.GetTop()->GetType() == DisplayItemType::TYPE_TRANSFORM);
|
||||||
mAnimatedGeometryRoot = aBuilder->FindAnimatedGeometryRootFor(
|
|
||||||
mFrame->GetClosestFlattenedTreeAncestorPrimaryFrame());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsDisplayPerspective::Paint(nsDisplayListBuilder* aBuilder,
|
void nsDisplayPerspective::Paint(nsDisplayListBuilder* aBuilder,
|
||||||
|
@ -8904,7 +8642,6 @@ nsDisplayListBuilder::AutoBuildingDisplayList::AutoBuildingDisplayList(
|
||||||
mPrevAdditionalOffset(aBuilder->mAdditionalOffset),
|
mPrevAdditionalOffset(aBuilder->mAdditionalOffset),
|
||||||
mPrevVisibleRect(aBuilder->mVisibleRect),
|
mPrevVisibleRect(aBuilder->mVisibleRect),
|
||||||
mPrevDirtyRect(aBuilder->mDirtyRect),
|
mPrevDirtyRect(aBuilder->mDirtyRect),
|
||||||
mPrevAGR(aBuilder->mCurrentAGR),
|
|
||||||
mPrevCompositorHitTestInfo(aBuilder->mCompositorHitTestInfo),
|
mPrevCompositorHitTestInfo(aBuilder->mCompositorHitTestInfo),
|
||||||
mPrevAncestorHasApzAwareEventHandler(
|
mPrevAncestorHasApzAwareEventHandler(
|
||||||
aBuilder->mAncestorHasApzAwareEventHandler),
|
aBuilder->mAncestorHasApzAwareEventHandler),
|
||||||
|
@ -8921,21 +8658,6 @@ nsDisplayListBuilder::AutoBuildingDisplayList::AutoBuildingDisplayList(
|
||||||
aForChild, &aBuilder->mCurrentOffsetToReferenceFrame);
|
aForChild, &aBuilder->mCurrentOffsetToReferenceFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isAsync;
|
|
||||||
mCurrentAGRState = aBuilder->IsAnimatedGeometryRoot(aForChild, isAsync);
|
|
||||||
|
|
||||||
if (aBuilder->mCurrentFrame == aForChild->GetParent()) {
|
|
||||||
if (mCurrentAGRState == AGR_YES) {
|
|
||||||
aBuilder->mCurrentAGR =
|
|
||||||
aBuilder->WrapAGRForFrame(aForChild, isAsync, aBuilder->mCurrentAGR);
|
|
||||||
}
|
|
||||||
} else if (aBuilder->mCurrentFrame != aForChild) {
|
|
||||||
aBuilder->mCurrentAGR = aBuilder->FindAnimatedGeometryRootFor(aForChild);
|
|
||||||
}
|
|
||||||
|
|
||||||
MOZ_ASSERT(nsLayoutUtils::IsAncestorFrameCrossDocInProcess(
|
|
||||||
aBuilder->RootReferenceFrame(), *aBuilder->mCurrentAGR));
|
|
||||||
|
|
||||||
// If aForChild is being visited from a frame other than it's ancestor frame,
|
// If aForChild is being visited from a frame other than it's ancestor frame,
|
||||||
// mInInvalidSubtree will need to be recalculated the slow way.
|
// mInInvalidSubtree will need to be recalculated the slow way.
|
||||||
if (aForChild == mPrevFrame || GetAncestorFor(aForChild) == mPrevFrame) {
|
if (aForChild == mPrevFrame || GetAncestorFor(aForChild) == mPrevFrame) {
|
||||||
|
|
|
@ -152,97 +152,6 @@ enum class DisplayListArenaObjectId {
|
||||||
* reference frame for their frame subtrees.
|
* reference frame for their frame subtrees.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a frame that is considered to have (or will have) "animated
|
|
||||||
* geometry" for itself and descendant frames.
|
|
||||||
*
|
|
||||||
* For example the scrolled frames of scrollframes which are actively being
|
|
||||||
* scrolled fall into this category. Frames with certain CSS properties that are
|
|
||||||
* being animated (e.g. 'left'/'top' etc) are also placed in this category.
|
|
||||||
* Frames with different active geometry roots are in different PaintedLayers,
|
|
||||||
* so that we can animate the geometry root by changing its transform (either on
|
|
||||||
* the main thread or in the compositor).
|
|
||||||
*
|
|
||||||
* nsDisplayListBuilder constructs a tree of these (for fast traversals) and
|
|
||||||
* assigns one for each display item.
|
|
||||||
*
|
|
||||||
* The animated geometry root for a display item is required to be a descendant
|
|
||||||
* (or equal to) the item's ReferenceFrame(), which means that we will fall back
|
|
||||||
* to returning aItem->ReferenceFrame() when we can't find another animated
|
|
||||||
* geometry root.
|
|
||||||
*
|
|
||||||
* The animated geometry root isn't strongly defined for a frame as transforms
|
|
||||||
* and background-attachment:fixed can cause it to vary between display items
|
|
||||||
* for a given frame.
|
|
||||||
*/
|
|
||||||
struct AnimatedGeometryRoot {
|
|
||||||
static already_AddRefed<AnimatedGeometryRoot> CreateAGRForFrame(
|
|
||||||
nsIFrame* aFrame, AnimatedGeometryRoot* aParent, bool aIsAsync,
|
|
||||||
bool aIsRetained) {
|
|
||||||
RefPtr<AnimatedGeometryRoot> result;
|
|
||||||
if (aIsRetained) {
|
|
||||||
result = aFrame->GetProperty(AnimatedGeometryRootCache());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result) {
|
|
||||||
result->mParentAGR = aParent;
|
|
||||||
result->mIsAsync = aIsAsync;
|
|
||||||
} else {
|
|
||||||
result = new AnimatedGeometryRoot(aFrame, aParent, aIsAsync, aIsRetained);
|
|
||||||
}
|
|
||||||
return result.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
operator nsIFrame*() { return mFrame; }
|
|
||||||
|
|
||||||
nsIFrame* operator->() const { return mFrame; }
|
|
||||||
|
|
||||||
AnimatedGeometryRoot* GetAsyncAGR() {
|
|
||||||
AnimatedGeometryRoot* agr = this;
|
|
||||||
while (!agr->mIsAsync && agr->mParentAGR) {
|
|
||||||
agr = agr->mParentAGR;
|
|
||||||
}
|
|
||||||
return agr;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_INLINE_DECL_REFCOUNTING(AnimatedGeometryRoot)
|
|
||||||
|
|
||||||
nsIFrame* mFrame;
|
|
||||||
RefPtr<AnimatedGeometryRoot> mParentAGR;
|
|
||||||
bool mIsAsync;
|
|
||||||
bool mIsRetained;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
static void DetachAGR(AnimatedGeometryRoot* aAGR) {
|
|
||||||
aAGR->mFrame = nullptr;
|
|
||||||
aAGR->mParentAGR = nullptr;
|
|
||||||
NS_RELEASE(aAGR);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(AnimatedGeometryRootCache,
|
|
||||||
AnimatedGeometryRoot, DetachAGR)
|
|
||||||
|
|
||||||
AnimatedGeometryRoot(nsIFrame* aFrame, AnimatedGeometryRoot* aParent,
|
|
||||||
bool aIsAsync, bool aIsRetained)
|
|
||||||
: mFrame(aFrame),
|
|
||||||
mParentAGR(aParent),
|
|
||||||
mIsAsync(aIsAsync),
|
|
||||||
mIsRetained(aIsRetained) {
|
|
||||||
MOZ_ASSERT(mParentAGR || mIsAsync,
|
|
||||||
"The root AGR should always be treated as an async AGR.");
|
|
||||||
if (mIsRetained) {
|
|
||||||
NS_ADDREF(this);
|
|
||||||
aFrame->SetProperty(AnimatedGeometryRootCache(), this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
~AnimatedGeometryRoot() {
|
|
||||||
if (mFrame && mIsRetained) {
|
|
||||||
mFrame->RemoveProperty(AnimatedGeometryRootCache());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An active scrolled root (ASR) is similar to an animated geometry root (AGR).
|
* An active scrolled root (ASR) is similar to an animated geometry root (AGR).
|
||||||
* The differences are:
|
* The differences are:
|
||||||
|
@ -395,13 +304,6 @@ class nsDisplayListBuilder {
|
||||||
bool mAllowAsyncAnimation;
|
bool mAllowAsyncAnimation;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* A frame can be in one of three states of AGR.
|
|
||||||
* AGR_NO means the frame is not an AGR for now.
|
|
||||||
* AGR_YES means the frame is an AGR for now.
|
|
||||||
*/
|
|
||||||
enum AGRState { AGR_NO, AGR_YES };
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using ViewID = layers::ScrollableLayerGuid::ViewID;
|
using ViewID = layers::ScrollableLayerGuid::ViewID;
|
||||||
|
|
||||||
|
@ -655,11 +557,6 @@ class nsDisplayListBuilder {
|
||||||
return mCurrentOffsetToReferenceFrame;
|
return mCurrentOffsetToReferenceFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimatedGeometryRoot* GetCurrentAnimatedGeometryRoot() { return mCurrentAGR; }
|
|
||||||
AnimatedGeometryRoot* GetRootAnimatedGeometryRoot() { return mRootAGR; }
|
|
||||||
|
|
||||||
void RecomputeCurrentAnimatedGeometryRoot();
|
|
||||||
|
|
||||||
void Check() { mPool.Check(); }
|
void Check() { mPool.Check(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1085,8 +982,6 @@ class nsDisplayListBuilder {
|
||||||
mBuilder->mCurrentOffsetToReferenceFrame += aOffset;
|
mBuilder->mCurrentOffsetToReferenceFrame += aOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsAnimatedGeometryRoot() const { return mCurrentAGRState == AGR_YES; }
|
|
||||||
|
|
||||||
void RestoreBuildingInvisibleItemsValue() {
|
void RestoreBuildingInvisibleItemsValue() {
|
||||||
mBuilder->mBuildingInvisibleItems = mPrevBuildingInvisibleItems;
|
mBuilder->mBuildingInvisibleItems = mPrevBuildingInvisibleItems;
|
||||||
}
|
}
|
||||||
|
@ -1097,7 +992,6 @@ class nsDisplayListBuilder {
|
||||||
mBuilder->mCurrentOffsetToReferenceFrame = mPrevOffset;
|
mBuilder->mCurrentOffsetToReferenceFrame = mPrevOffset;
|
||||||
mBuilder->mVisibleRect = mPrevVisibleRect;
|
mBuilder->mVisibleRect = mPrevVisibleRect;
|
||||||
mBuilder->mDirtyRect = mPrevDirtyRect;
|
mBuilder->mDirtyRect = mPrevDirtyRect;
|
||||||
mBuilder->mCurrentAGR = mPrevAGR;
|
|
||||||
mBuilder->mAncestorHasApzAwareEventHandler =
|
mBuilder->mAncestorHasApzAwareEventHandler =
|
||||||
mPrevAncestorHasApzAwareEventHandler;
|
mPrevAncestorHasApzAwareEventHandler;
|
||||||
mBuilder->mBuildingInvisibleItems = mPrevBuildingInvisibleItems;
|
mBuilder->mBuildingInvisibleItems = mPrevBuildingInvisibleItems;
|
||||||
|
@ -1108,14 +1002,12 @@ class nsDisplayListBuilder {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsDisplayListBuilder* mBuilder;
|
nsDisplayListBuilder* mBuilder;
|
||||||
AGRState mCurrentAGRState;
|
|
||||||
const nsIFrame* mPrevFrame;
|
const nsIFrame* mPrevFrame;
|
||||||
const nsIFrame* mPrevReferenceFrame;
|
const nsIFrame* mPrevReferenceFrame;
|
||||||
nsPoint mPrevOffset;
|
nsPoint mPrevOffset;
|
||||||
Maybe<nsPoint> mPrevAdditionalOffset;
|
Maybe<nsPoint> mPrevAdditionalOffset;
|
||||||
nsRect mPrevVisibleRect;
|
nsRect mPrevVisibleRect;
|
||||||
nsRect mPrevDirtyRect;
|
nsRect mPrevDirtyRect;
|
||||||
RefPtr<AnimatedGeometryRoot> mPrevAGR;
|
|
||||||
gfx::CompositorHitTestInfo mPrevCompositorHitTestInfo;
|
gfx::CompositorHitTestInfo mPrevCompositorHitTestInfo;
|
||||||
bool mPrevAncestorHasApzAwareEventHandler;
|
bool mPrevAncestorHasApzAwareEventHandler;
|
||||||
bool mPrevBuildingInvisibleItems;
|
bool mPrevBuildingInvisibleItems;
|
||||||
|
@ -1692,13 +1584,6 @@ class nsDisplayListBuilder {
|
||||||
return mBuildingExtraPagesForPageNum;
|
return mBuildingExtraPagesForPageNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a convenience function to ease the transition until AGRs and ASRs
|
|
||||||
* are unified.
|
|
||||||
*/
|
|
||||||
AnimatedGeometryRoot* AnimatedGeometryRootForASR(
|
|
||||||
const ActiveScrolledRoot* aASR);
|
|
||||||
|
|
||||||
bool HitTestIsForVisibility() const { return mVisibleThreshold.isSome(); }
|
bool HitTestIsForVisibility() const { return mVisibleThreshold.isSome(); }
|
||||||
|
|
||||||
float VisibilityThreshold() const {
|
float VisibilityThreshold() const {
|
||||||
|
@ -1797,48 +1682,25 @@ class nsDisplayListBuilder {
|
||||||
nsDisplayList* mList;
|
nsDisplayList* mList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the nearest ancestor frame to aFrame that is considered to have
|
||||||
|
* (or will have) animated geometry. This can return aFrame.
|
||||||
|
*/
|
||||||
|
nsIFrame* FindAnimatedGeometryRootFrameFor(nsIFrame* aFrame);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, nsIFrame* aFrame,
|
bool MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, nsIFrame* aFrame,
|
||||||
const nsRect& aVisibleRect,
|
const nsRect& aVisibleRect,
|
||||||
const nsRect& aDirtyRect);
|
const nsRect& aDirtyRect);
|
||||||
|
|
||||||
|
friend class nsDisplayBackgroundImage;
|
||||||
|
friend struct RetainedDisplayListBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether a frame acts as an animated geometry root, optionally
|
* Returns whether a frame acts as an animated geometry root, optionally
|
||||||
* returning the next ancestor to check.
|
* returning the next ancestor to check.
|
||||||
*/
|
*/
|
||||||
AGRState IsAnimatedGeometryRoot(nsIFrame* aFrame, bool& aIsAsync,
|
bool IsAnimatedGeometryRoot(nsIFrame* aFrame, nsIFrame** aParent = nullptr);
|
||||||
nsIFrame** aParent = nullptr);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the nearest ancestor frame to aFrame that is considered to have
|
|
||||||
* (or will have) animated geometry. This can return aFrame.
|
|
||||||
*/
|
|
||||||
nsIFrame* FindAnimatedGeometryRootFrameFor(nsIFrame* aFrame, bool& aIsAsync);
|
|
||||||
|
|
||||||
friend class nsDisplayCanvasBackgroundImage;
|
|
||||||
friend class nsDisplayBackgroundImage;
|
|
||||||
friend class nsDisplayFixedPosition;
|
|
||||||
friend class nsDisplayPerspective;
|
|
||||||
AnimatedGeometryRoot* FindAnimatedGeometryRootFor(nsDisplayItem* aItem);
|
|
||||||
|
|
||||||
friend class nsDisplayItem;
|
|
||||||
friend class nsDisplayOwnLayer;
|
|
||||||
friend struct RetainedDisplayListBuilder;
|
|
||||||
AnimatedGeometryRoot* FindAnimatedGeometryRootFor(nsIFrame* aFrame);
|
|
||||||
|
|
||||||
AnimatedGeometryRoot* WrapAGRForFrame(
|
|
||||||
nsIFrame* aAnimatedGeometryRoot, bool aIsAsync,
|
|
||||||
AnimatedGeometryRoot* aParent = nullptr);
|
|
||||||
|
|
||||||
nsTHashMap<nsIFrame*, RefPtr<AnimatedGeometryRoot>>
|
|
||||||
mFrameToAnimatedGeometryRootMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the current frame to the AGR budget if possible and remember
|
|
||||||
* the outcome. Subsequent calls will return the same value as
|
|
||||||
* returned here.
|
|
||||||
*/
|
|
||||||
bool AddToAGRBudget(nsIFrame* aFrame);
|
|
||||||
|
|
||||||
struct PresShellState {
|
struct PresShellState {
|
||||||
PresShell* mPresShell;
|
PresShell* mPresShell;
|
||||||
|
@ -1902,9 +1764,6 @@ class nsDisplayListBuilder {
|
||||||
|
|
||||||
Maybe<nsPoint> mAdditionalOffset;
|
Maybe<nsPoint> mAdditionalOffset;
|
||||||
|
|
||||||
RefPtr<AnimatedGeometryRoot> mRootAGR;
|
|
||||||
RefPtr<AnimatedGeometryRoot> mCurrentAGR;
|
|
||||||
|
|
||||||
// will-change budget tracker
|
// will-change budget tracker
|
||||||
typedef uint32_t DocumentWillChangeBudget;
|
typedef uint32_t DocumentWillChangeBudget;
|
||||||
nsTHashMap<nsPtrHashKey<const nsPresContext>, DocumentWillChangeBudget>
|
nsTHashMap<nsPtrHashKey<const nsPresContext>, DocumentWillChangeBudget>
|
||||||
|
@ -1917,11 +1776,6 @@ class nsDisplayListBuilder {
|
||||||
|
|
||||||
uint8_t mBuildingExtraPagesForPageNum;
|
uint8_t mBuildingExtraPagesForPageNum;
|
||||||
|
|
||||||
// Area of animated geometry root budget already allocated
|
|
||||||
uint32_t mUsedAGRBudget;
|
|
||||||
// Set of frames already counted in budget
|
|
||||||
nsTHashSet<nsIFrame*> mAGRBudgetSet;
|
|
||||||
|
|
||||||
nsTHashMap<nsPtrHashKey<dom::RemoteBrowser>, dom::EffectsInfo>
|
nsTHashMap<nsPtrHashKey<dom::RemoteBrowser>, dom::EffectsInfo>
|
||||||
mEffectsUpdates;
|
mEffectsUpdates;
|
||||||
|
|
||||||
|
@ -2390,7 +2244,6 @@ class nsDisplayItem : public nsDisplayItemLink {
|
||||||
mPerFrameIndex(aOther.mPerFrameIndex),
|
mPerFrameIndex(aOther.mPerFrameIndex),
|
||||||
mBuildingRect(aOther.mBuildingRect),
|
mBuildingRect(aOther.mBuildingRect),
|
||||||
mToReferenceFrame(aOther.mToReferenceFrame),
|
mToReferenceFrame(aOther.mToReferenceFrame),
|
||||||
mAnimatedGeometryRoot(aOther.mAnimatedGeometryRoot),
|
|
||||||
mActiveScrolledRoot(aOther.mActiveScrolledRoot),
|
mActiveScrolledRoot(aOther.mActiveScrolledRoot),
|
||||||
mClipChain(aOther.mClipChain) {
|
mClipChain(aOther.mClipChain) {
|
||||||
MOZ_COUNT_CTOR(nsDisplayItem);
|
MOZ_COUNT_CTOR(nsDisplayItem);
|
||||||
|
@ -2808,17 +2661,6 @@ class nsDisplayItem : public nsDisplayItemLink {
|
||||||
*/
|
*/
|
||||||
virtual const nsIFrame* ReferenceFrameForChildren() const { return nullptr; }
|
virtual const nsIFrame* ReferenceFrameForChildren() const { return nullptr; }
|
||||||
|
|
||||||
AnimatedGeometryRoot* GetAnimatedGeometryRoot() const {
|
|
||||||
MOZ_ASSERT(mAnimatedGeometryRoot,
|
|
||||||
"Must have cached AGR before accessing it!");
|
|
||||||
return mAnimatedGeometryRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual struct AnimatedGeometryRoot* AnimatedGeometryRootForScrollMetadata()
|
|
||||||
const {
|
|
||||||
return GetAnimatedGeometryRoot();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if this display item (or any children) contains content that might
|
* Checks if this display item (or any children) contains content that might
|
||||||
* be rendered with component alpha (e.g. subpixel antialiasing). Returns the
|
* be rendered with component alpha (e.g. subpixel antialiasing). Returns the
|
||||||
|
@ -2953,7 +2795,6 @@ class nsDisplayItem : public nsDisplayItemLink {
|
||||||
// Result of ToReferenceFrame(mFrame), if mFrame is non-null
|
// Result of ToReferenceFrame(mFrame), if mFrame is non-null
|
||||||
nsPoint mToReferenceFrame;
|
nsPoint mToReferenceFrame;
|
||||||
|
|
||||||
RefPtr<AnimatedGeometryRoot> mAnimatedGeometryRoot;
|
|
||||||
RefPtr<const ActiveScrolledRoot> mActiveScrolledRoot;
|
RefPtr<const ActiveScrolledRoot> mActiveScrolledRoot;
|
||||||
RefPtr<const DisplayItemClipChain> mClipChain;
|
RefPtr<const DisplayItemClipChain> mClipChain;
|
||||||
|
|
||||||
|
@ -5660,8 +5501,6 @@ class nsDisplayFixedPosition : public nsDisplayOwnLayer {
|
||||||
nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder,
|
nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder,
|
||||||
const nsDisplayFixedPosition& aOther)
|
const nsDisplayFixedPosition& aOther)
|
||||||
: nsDisplayOwnLayer(aBuilder, aOther),
|
: nsDisplayOwnLayer(aBuilder, aOther),
|
||||||
mAnimatedGeometryRootForScrollMetadata(
|
|
||||||
aOther.mAnimatedGeometryRootForScrollMetadata),
|
|
||||||
mContainerASR(aOther.mContainerASR),
|
mContainerASR(aOther.mContainerASR),
|
||||||
mIsFixedBackground(aOther.mIsFixedBackground) {
|
mIsFixedBackground(aOther.mIsFixedBackground) {
|
||||||
MOZ_COUNT_CTOR(nsDisplayFixedPosition);
|
MOZ_COUNT_CTOR(nsDisplayFixedPosition);
|
||||||
|
@ -5685,10 +5524,6 @@ class nsDisplayFixedPosition : public nsDisplayOwnLayer {
|
||||||
return mIsFixedBackground;
|
return mIsFixedBackground;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimatedGeometryRoot* AnimatedGeometryRootForScrollMetadata() const override {
|
|
||||||
return mAnimatedGeometryRootForScrollMetadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CreateWebRenderCommands(
|
bool CreateWebRenderCommands(
|
||||||
wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources,
|
wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources,
|
||||||
const StackingContextHelper& aSc,
|
const StackingContextHelper& aSc,
|
||||||
|
@ -5702,10 +5537,8 @@ class nsDisplayFixedPosition : public nsDisplayOwnLayer {
|
||||||
// For background-attachment:fixed
|
// For background-attachment:fixed
|
||||||
nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||||
nsDisplayList* aList);
|
nsDisplayList* aList);
|
||||||
void Init(nsDisplayListBuilder* aBuilder);
|
|
||||||
ViewID GetScrollTargetId();
|
ViewID GetScrollTargetId();
|
||||||
|
|
||||||
RefPtr<AnimatedGeometryRoot> mAnimatedGeometryRootForScrollMetadata;
|
|
||||||
RefPtr<const ActiveScrolledRoot> mContainerASR;
|
RefPtr<const ActiveScrolledRoot> mContainerASR;
|
||||||
bool mIsFixedBackground;
|
bool mIsFixedBackground;
|
||||||
|
|
||||||
|
@ -6268,10 +6101,6 @@ class nsDisplayTransform : public nsPaintedDisplayItem {
|
||||||
return nsPaintedDisplayItem::ReferenceFrameForChildren();
|
return nsPaintedDisplayItem::ReferenceFrameForChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimatedGeometryRoot* AnimatedGeometryRootForScrollMetadata() const override {
|
|
||||||
return mAnimatedGeometryRootForScrollMetadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nsRect& GetBuildingRectForChildren() const override {
|
const nsRect& GetBuildingRectForChildren() const override {
|
||||||
return mChildrenBuildingRect;
|
return mChildrenBuildingRect;
|
||||||
}
|
}
|
||||||
|
@ -6510,8 +6339,6 @@ class nsDisplayTransform : public nsPaintedDisplayItem {
|
||||||
mutable Maybe<Matrix4x4Flagged> mInverseTransform;
|
mutable Maybe<Matrix4x4Flagged> mInverseTransform;
|
||||||
// Accumulated transform of ancestors on the preserves-3d chain.
|
// Accumulated transform of ancestors on the preserves-3d chain.
|
||||||
UniquePtr<Matrix4x4> mTransformPreserves3D;
|
UniquePtr<Matrix4x4> mTransformPreserves3D;
|
||||||
RefPtr<AnimatedGeometryRoot> mAnimatedGeometryRootForChildren;
|
|
||||||
RefPtr<AnimatedGeometryRoot> mAnimatedGeometryRootForScrollMetadata;
|
|
||||||
nsRect mChildrenBuildingRect;
|
nsRect mChildrenBuildingRect;
|
||||||
mutable RetainedDisplayList mChildren;
|
mutable RetainedDisplayList mChildren;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче