--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -243,16 +243,22 @@ struct Grouper
DIGroup* aGroup, nsDisplayList* aList,
const StackingContextHelper& aSc);
// Builds a group of display items without promoting anything to active.
void ConstructGroupInsideInactive(WebRenderCommandBuilder* aCommandBuilder,
wr::DisplayListBuilder& aBuilder,
wr::IpcResourceUpdateQueue& aResources,
DIGroup* aGroup, nsDisplayList* aList,
const StackingContextHelper& aSc);
+ // Helper method for processing a single inactive item
+ void ConstructItemInsideInactive(WebRenderCommandBuilder* aCommandBuilder,
+ wr::DisplayListBuilder& aBuilder,
+ wr::IpcResourceUpdateQueue& aResources,
+ DIGroup* aGroup, nsDisplayItem* aItem,
+ const StackingContextHelper& aSc);
~Grouper() {
}
};
// Returns whether this is an item for which complete invalidation was
// reliant on LayerTreeInvalidation in the pre-webrender world.
static bool
IsContainerLayerItem(nsDisplayItem* aItem)
@@ -967,17 +973,16 @@ Grouper::ConstructGroups(nsDisplayListBu
DIGroup* aGroup, nsDisplayList* aList,
const StackingContextHelper& aSc)
{
DIGroup* currentGroup = aGroup;
nsDisplayItem* item = aList->GetBottom();
nsDisplayItem* startOfCurrentGroup = item;
while (item) {
- nsDisplayList* children = item->GetChildren();
if (IsItemProbablyActive(item, mDisplayListBuilder)) {
currentGroup->EndGroup(aCommandBuilder->mManager, aDisplayListBuilder, aBuilder, aResources, this, startOfCurrentGroup, item);
mClipManager.BeginItem(item, aSc);
sIndent++;
// Note: this call to CreateWebRenderCommands can recurse back into
// this function.
bool createdWRCommands =
item->CreateWebRenderCommands(aBuilder, aResources, aSc, aCommandBuilder->mManager,
@@ -1015,41 +1020,18 @@ Grouper::ConstructGroups(nsDisplayListBu
groupData->mFollowingGroup.mScale = currentGroup->mScale;
groupData->mFollowingGroup.mResidualOffset = currentGroup->mResidualOffset;
groupData->mFollowingGroup.mPaintRect = currentGroup->mPaintRect;
currentGroup = &groupData->mFollowingGroup;
startOfCurrentGroup = item->GetAbove();
} else { // inactive item
-
- if (item->GetType() == DisplayItemType::TYPE_TRANSFORM) {
- nsDisplayTransform* transformItem = static_cast<nsDisplayTransform*>(item);
- const Matrix4x4Flagged& t = transformItem->GetTransform();
- Matrix t2d;
- bool is2D = t.Is2D(&t2d);
- MOZ_RELEASE_ASSERT(is2D, "Non-2D transforms should be treated as active");
-
- // Save the current transform.
- Matrix m = mTransform;
-
- GP("t2d: %f %f\n", t2d._31, t2d._32);
- mTransform.PreMultiply(t2d);
- GP("mTransform: %f %f\n", mTransform._31, mTransform._32);
- ConstructGroupInsideInactive(aCommandBuilder, aBuilder, aResources, currentGroup, children, aSc);
-
- mTransform = m; // restore it
- } else if (children) {
- ConstructGroupInsideInactive(aCommandBuilder, aBuilder, aResources, currentGroup, children, aSc);
- }
-
- GP("Including %s of %d\n", item->Name(), currentGroup->mDisplayItems.Count());
-
- BlobItemData* data = GetBlobItemDataForGroup(item, currentGroup);
- currentGroup->ComputeGeometryChange(item, data, mTransform, mDisplayListBuilder); // we compute the geometry change here because we have the transform around still
+ ConstructItemInsideInactive(aCommandBuilder, aBuilder, aResources,
+ currentGroup, item, aSc);
}
item = item->GetAbove();
}
currentGroup->EndGroup(aCommandBuilder->mManager, aDisplayListBuilder, aBuilder, aResources, this, startOfCurrentGroup, nullptr);
}
@@ -1057,50 +1039,58 @@ Grouper::ConstructGroups(nsDisplayListBu
// into a single group.
void
Grouper::ConstructGroupInsideInactive(WebRenderCommandBuilder* aCommandBuilder,
wr::DisplayListBuilder& aBuilder,
wr::IpcResourceUpdateQueue& aResources,
DIGroup* aGroup, nsDisplayList* aList,
const StackingContextHelper& aSc)
{
- DIGroup* currentGroup = aGroup;
-
nsDisplayItem* item = aList->GetBottom();
while (item) {
- nsDisplayList* children = item->GetChildren();
-
- if (item->GetType() == DisplayItemType::TYPE_TRANSFORM) {
- nsDisplayTransform* transformItem = static_cast<nsDisplayTransform*>(item);
- const Matrix4x4Flagged& t = transformItem->GetTransform();
- Matrix t2d;
- bool is2D = t.Is2D(&t2d);
- MOZ_RELEASE_ASSERT(is2D, "Non-2D transforms should be treated as active");
-
- Matrix m = mTransform;
-
- GP("t2d: %f %f\n", t2d._31, t2d._32);
- mTransform.PreMultiply(t2d);
- GP("mTransform: %f %f\n", mTransform._31, mTransform._32);
- ConstructGroupInsideInactive(aCommandBuilder, aBuilder, aResources, currentGroup, children, aSc);
-
- mTransform = m;
- } else if (children) {
- ConstructGroupInsideInactive(aCommandBuilder, aBuilder, aResources, currentGroup, children, aSc);
- }
-
- GP("Including %s of %d\n", item->Name(), currentGroup->mDisplayItems.Count());
-
- BlobItemData* data = GetBlobItemDataForGroup(item, currentGroup);
- currentGroup->ComputeGeometryChange(item, data, mTransform, mDisplayListBuilder); // we compute the geometry change here because we have the transform around still
-
+ ConstructItemInsideInactive(aCommandBuilder, aBuilder, aResources,
+ aGroup, item, aSc);
item = item->GetAbove();
}
}
+void
+Grouper::ConstructItemInsideInactive(WebRenderCommandBuilder* aCommandBuilder,
+ wr::DisplayListBuilder& aBuilder,
+ wr::IpcResourceUpdateQueue& aResources,
+ DIGroup* aGroup, nsDisplayItem* aItem,
+ const StackingContextHelper& aSc)
+{
+ nsDisplayList* children = aItem->GetChildren();
+
+ if (aItem->GetType() == DisplayItemType::TYPE_TRANSFORM) {
+ nsDisplayTransform* transformItem = static_cast<nsDisplayTransform*>(aItem);
+ const Matrix4x4Flagged& t = transformItem->GetTransform();
+ Matrix t2d;
+ bool is2D = t.Is2D(&t2d);
+ MOZ_RELEASE_ASSERT(is2D, "Non-2D transforms should be treated as active");
+
+ Matrix m = mTransform;
+
+ GP("t2d: %f %f\n", t2d._31, t2d._32);
+ mTransform.PreMultiply(t2d);
+ GP("mTransform: %f %f\n", mTransform._31, mTransform._32);
+ ConstructGroupInsideInactive(aCommandBuilder, aBuilder, aResources, aGroup, children, aSc);
+
+ mTransform = m;
+ } else if (children) {
+ ConstructGroupInsideInactive(aCommandBuilder, aBuilder, aResources, aGroup, children, aSc);
+ }
+
+ GP("Including %s of %d\n", aItem->Name(), aGroup->mDisplayItems.Count());
+
+ BlobItemData* data = GetBlobItemDataForGroup(aItem, aGroup);
+ aGroup->ComputeGeometryChange(aItem, data, mTransform, mDisplayListBuilder); // we compute the geometry change here because we have the transform around still
+}
+
/* This is just a copy of nsRect::ScaleToOutsidePixels with an offset added in.
* The offset is applied just before the rounding. It's in the scaled space. */
static mozilla::gfx::IntRect
ScaleToOutsidePixelsOffset(nsRect aRect, float aXScale, float aYScale,
nscoord aAppUnitsPerPixel, LayerPoint aOffset)
{
mozilla::gfx::IntRect rect;
rect.SetNonEmptyBox(NSToIntFloor(NSAppUnitsToFloatPixels(aRect.x,