Bug 1248913 - Make nsDisplayBlendContainer active or inactive based on its contents. r?mattwoodrow
MozReview-Commit-ID: GN0084Rrmlm
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -4012,16 +4012,25 @@ RequiredLayerStateForChildren(nsDisplayL
LayerState result = LAYER_INACTIVE;
for (nsDisplayItem* i = aList.GetBottom(); i; i = i->GetAbove()) {
if (result == LAYER_INACTIVE &&
i->GetAnimatedGeometryRoot() != aExpectedAnimatedGeometryRootForChildren) {
result = LAYER_ACTIVE;
}
LayerState state = i->GetLayerState(aBuilder, aManager, aParameters);
+ if (state == LAYER_ACTIVE && i->GetType() == nsDisplayItem::TYPE_BLEND_MODE) {
+ // nsDisplayBlendMode always returns LAYER_ACTIVE to ensure that the
+ // blending operation happens in the intermediate surface of its parent
+ // display item (usually an nsDisplayBlendContainer). But this does not
+ // mean that it needs all its ancestor display items to become active.
+ // So we ignore its layer state and look at its children instead.
+ state = RequiredLayerStateForChildren(aBuilder, aManager, aParameters,
+ *i->GetSameCoordinateSystemChildren(), i->GetAnimatedGeometryRoot());
+ }
if ((state == LAYER_ACTIVE || state == LAYER_ACTIVE_FORCE) &&
state > result) {
result = state;
}
if (state == LAYER_ACTIVE_EMPTY && state > result) {
result = LAYER_ACTIVE_FORCE;
}
if (state == LAYER_NONE) {
@@ -4453,17 +4462,17 @@ nsDisplayBlendContainer::BuildLayer(nsDi
return container.forget();
}
LayerState
nsDisplayBlendContainer::GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aParameters)
{
- return mozilla::LAYER_ACTIVE;
+ return RequiredLayerStateForChildren(aBuilder, aManager, aParameters, mList, GetAnimatedGeometryRoot());
}
bool nsDisplayBlendContainer::TryMerge(nsDisplayItem* aItem) {
if (aItem->GetType() != TYPE_BLEND_CONTAINER)
return false;
// items for the same content element should be merged into a single
// compositing group
// aItem->GetUnderlyingFrame() returns non-null because it's nsDisplayOpacity