Bug 1258904 - Part 2: nsDisplay(Opacity|Transform)::GetLayerState should return LAYER_ACTIVE_FORCE if they have async animations to avoid flattening the layers.
MozReview-Commit-ID: 16QtFJBX97W
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -4357,18 +4357,21 @@ nsDisplayOpacity::GetLayerState(nsDispla
// If we only created this item so that we'd get correct nsDisplayEventRegions for child
// frames, then force us to inactive to avoid unnecessary layerization changes for content
// that won't ever be painted.
if (mForEventsOnly) {
MOZ_ASSERT(mOpacity == 0);
return LAYER_INACTIVE;
}
- if (NeedsActiveLayer(aBuilder))
- return LAYER_ACTIVE;
+ if (NeedsActiveLayer(aBuilder)) {
+ // Returns LAYER_ACTIVE_FORCE to avoid flatterning the layer for async
+ // animations.
+ return LAYER_ACTIVE_FORCE;
+ }
return RequiredLayerStateForChildren(aBuilder, aManager, aParameters, mList, GetAnimatedGeometryRoot());
}
bool
nsDisplayOpacity::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) {
// Our children are translucent so we should not allow them to subtract
@@ -5950,18 +5953,21 @@ nsDisplayTransform::GetLayerState(nsDisp
const ContainerLayerParameters& aParameters) {
// If the transform is 3d, the layer takes part in preserve-3d
// sorting, or the layer is a separator then we *always* want this
// to be an active layer.
if (!GetTransform().Is2D() || mFrame->Combines3DTransformWithAncestors() ||
mIsTransformSeparator) {
return LAYER_ACTIVE_FORCE;
}
+
if (MayBeAnimated(aBuilder)) {
- return LAYER_ACTIVE;
+ // Returns LAYER_ACTIVE_FORCE to avoid flatterning the layer for async
+ // animations.
+ return LAYER_ACTIVE_FORCE;
}
const nsStyleDisplay* disp = mFrame->StyleDisplay();
if ((disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_TRANSFORM)) {
return LAYER_ACTIVE;
}
// Expect the child display items to have this frame as their animated