mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 10:15:41 +00:00
Bug 1240073 - Use the transformed frame as the AGR for active transform so that FrameLayerBuilder knows that they can move independently. r=tnikkel
--HG-- extra : rebase_source : c36898d675d6b1a80701c5accd174a1454b51e71
This commit is contained in:
parent
5f9099964c
commit
68e4717417
@ -5060,6 +5060,7 @@ void
|
||||
nsDisplayTransform::SetReferenceFrameToAncestor(nsDisplayListBuilder* aBuilder)
|
||||
{
|
||||
mAnimatedGeometryRootForChildren = mAnimatedGeometryRoot;
|
||||
mAnimatedGeometryRootForScrollMetadata = mAnimatedGeometryRoot;
|
||||
if (mFrame == aBuilder->RootReferenceFrame()) {
|
||||
return;
|
||||
}
|
||||
@ -5081,7 +5082,15 @@ nsDisplayTransform::SetReferenceFrameToAncestor(nsDisplayListBuilder* aBuilder)
|
||||
// frame, which is our AGR, not the parent AGR.
|
||||
mAnimatedGeometryRoot = mAnimatedGeometryRootForChildren;
|
||||
} else if (mAnimatedGeometryRoot->mParentAGR) {
|
||||
mAnimatedGeometryRoot = 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;
|
||||
}
|
||||
}
|
||||
mVisibleRect = aBuilder->GetDirtyRect() + mToReferenceFrame;
|
||||
}
|
||||
@ -5772,8 +5781,13 @@ already_AddRefed<Layer> nsDisplayTransform::BuildLayer(nsDisplayListBuilder *aBu
|
||||
this, mFrame,
|
||||
eCSSProperty_transform);
|
||||
if (ShouldPrerender(aBuilder)) {
|
||||
container->SetUserData(nsIFrame::LayerIsPrerenderedDataKey(),
|
||||
/*the value is irrelevant*/nullptr);
|
||||
if (MayBeAnimated(aBuilder)) {
|
||||
// Only allow async updates to the transform if we're an animated layer, since that's what
|
||||
// triggers us to set the correct AGR in the constructor and makes sure FrameLayerBuilder
|
||||
// won't compute occlusions for this layer.
|
||||
container->SetUserData(nsIFrame::LayerIsPrerenderedDataKey(),
|
||||
/*the value is irrelevant*/nullptr);
|
||||
}
|
||||
container->SetContentFlags(container->GetContentFlags() | Layer::CONTENT_MAY_CHANGE_TRANSFORM);
|
||||
} else {
|
||||
container->RemoveUserData(nsIFrame::LayerIsPrerenderedDataKey());
|
||||
@ -5782,6 +5796,21 @@ already_AddRefed<Layer> nsDisplayTransform::BuildLayer(nsDisplayListBuilder *aBu
|
||||
return container.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayTransform::MayBeAnimated(nsDisplayListBuilder* aBuilder)
|
||||
{
|
||||
// Here we check if the *post-transform* bounds of this item are big enough
|
||||
// to justify an active layer.
|
||||
if (ActiveLayerTracker::IsStyleAnimated(aBuilder, mFrame, eCSSProperty_transform) &&
|
||||
!IsItemTooSmallForActiveLayer(this))
|
||||
return true;
|
||||
if (EffectCompositor::HasAnimationsForCompositor(mFrame,
|
||||
eCSSProperty_transform)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
nsDisplayItem::LayerState
|
||||
nsDisplayTransform::GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
@ -5793,13 +5822,7 @@ nsDisplayTransform::GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
mIsTransformSeparator) {
|
||||
return LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
// Here we check if the *post-transform* bounds of this item are big enough
|
||||
// to justify an active layer.
|
||||
if (ActiveLayerTracker::IsStyleAnimated(aBuilder, mFrame, eCSSProperty_transform) &&
|
||||
!IsItemTooSmallForActiveLayer(this))
|
||||
return LAYER_ACTIVE;
|
||||
if (EffectCompositor::HasAnimationsForCompositor(mFrame,
|
||||
eCSSProperty_transform)) {
|
||||
if (MayBeAnimated(aBuilder)) {
|
||||
return LAYER_ACTIVE;
|
||||
}
|
||||
|
||||
|
@ -3956,6 +3956,10 @@ public:
|
||||
return nsDisplayItem::ReferenceFrameForChildren();
|
||||
}
|
||||
|
||||
AnimatedGeometryRoot* AnimatedGeometryRootForScrollMetadata() const override {
|
||||
return mAnimatedGeometryRootForScrollMetadata;
|
||||
}
|
||||
|
||||
virtual const nsRect& GetVisibleRectForChildren() const override
|
||||
{
|
||||
return mChildrenVisibleRect;
|
||||
@ -4103,6 +4107,8 @@ public:
|
||||
bool aLogAnimations = false);
|
||||
bool CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder) override;
|
||||
|
||||
bool MayBeAnimated(nsDisplayListBuilder* aBuilder);
|
||||
|
||||
/**
|
||||
* This will return if it's possible for this element to be prerendered.
|
||||
* This should never return false if we're going to prerender.
|
||||
@ -4192,6 +4198,7 @@ private:
|
||||
Matrix4x4 mTransformPreserves3D;
|
||||
ComputeTransformFunction mTransformGetter;
|
||||
AnimatedGeometryRoot* mAnimatedGeometryRootForChildren;
|
||||
AnimatedGeometryRoot* mAnimatedGeometryRootForScrollMetadata;
|
||||
nsRect mChildrenVisibleRect;
|
||||
uint32_t mIndex;
|
||||
nsRect mBounds;
|
||||
|
Loading…
Reference in New Issue
Block a user