Bug 1468020 - Don't layerize filter and mask items. r?mstange
This restricts the active-item-detection code to wrap lists and
perspective items because other wrapper items are not supported yet.
MozReview-Commit-ID: JuirkAId7Kk
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -898,34 +898,42 @@ HasActiveChildren(const nsDisplayList& a
// This function decides whether we want to treat this item as "active", which means
// that it's a container item which we will turn into a WebRender StackingContext, or
// whether we treat it as "inactive" and include it inside the parent blob image.
//
// We can't easily use GetLayerState because it wants a bunch of layers related information.
static bool
IsItemProbablyActive(nsDisplayItem* aItem, nsDisplayListBuilder* aDisplayListBuilder)
{
- if (aItem->GetType() == DisplayItemType::TYPE_TRANSFORM) {
+ switch (aItem->GetType()) {
+ case DisplayItemType::TYPE_TRANSFORM: {
nsDisplayTransform* transformItem = static_cast<nsDisplayTransform*>(aItem);
Matrix4x4Flagged t = transformItem->GetTransform();
Matrix t2d;
bool is2D = t.Is2D(&t2d);
GP("active: %d\n", transformItem->MayBeAnimated(aDisplayListBuilder));
return transformItem->MayBeAnimated(aDisplayListBuilder) || !is2D || HasActiveChildren(*transformItem->GetChildren(), aDisplayListBuilder);
- } else if (aItem->GetType() == DisplayItemType::TYPE_OPACITY) {
+ }
+ case DisplayItemType::TYPE_OPACITY: {
nsDisplayOpacity* opacityItem = static_cast<nsDisplayOpacity*>(aItem);
bool active = opacityItem->NeedsActiveLayer(aDisplayListBuilder, opacityItem->Frame());
GP("active: %d\n", active);
return active || HasActiveChildren(*opacityItem->GetChildren(), aDisplayListBuilder);
}
- // TODO: handle other items?
- if (aItem->GetChildren()) {
- return HasActiveChildren(*aItem->GetChildren(), aDisplayListBuilder);;
+ case DisplayItemType::TYPE_WRAP_LIST:
+ case DisplayItemType::TYPE_PERSPECTIVE: {
+ if (aItem->GetChildren()) {
+ return HasActiveChildren(*aItem->GetChildren(), aDisplayListBuilder);
+ }
+ return false;
}
- return false;
+ default:
+ // TODO: handle other items?
+ return false;
+ }
}
// If we have an item we need to make sure it matches the current group
// otherwise it means the item switched groups and we need to invalidate
// it and recreate the data.
static BlobItemData*
GetBlobItemDataForGroup(nsDisplayItem* aItem, DIGroup* aGroup)
{