Bug 1451458. Make sure we always clear items on size change. r=mstange
This changes the code around mFollowing group size changes to match
the code in DoGroupingForDisplayList. Specifically, it makes sure
we always ClearItems() on size changes even if we don't have a key.
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -915,31 +915,30 @@ Grouper::ConstructGroups(WebRenderComman
RefPtr<WebRenderGroupData> groupData =
aCommandBuilder->CreateOrRecycleWebRenderUserData<WebRenderGroupData>(item);
// Initialize groupData->mFollowingGroup
// TODO: compute the group bounds post-grouping, so that they can be
// tighter for just the sublist that made it into this group.
// We want to ensure the tight bounds are still clipped by area
// that we're building the display list for.
- if (groupData->mFollowingGroup.mKey) {
- if (!groupData->mFollowingGroup.mGroupBounds.IsEqualEdges(currentGroup->mGroupBounds) ||
- groupData->mFollowingGroup.mScale != currentGroup->mScale ||
- groupData->mFollowingGroup.mAppUnitsPerDevPixel != currentGroup->mAppUnitsPerDevPixel) {
- if (groupData->mFollowingGroup.mAppUnitsPerDevPixel != currentGroup->mAppUnitsPerDevPixel) {
- printf("app unit change following: %d %d\n", groupData->mFollowingGroup.mAppUnitsPerDevPixel, currentGroup->mAppUnitsPerDevPixel);
- }
- // The group changed size
- GP("Inner group size change\n");
+ if (!groupData->mFollowingGroup.mGroupBounds.IsEqualEdges(currentGroup->mGroupBounds) ||
+ groupData->mFollowingGroup.mScale != currentGroup->mScale ||
+ groupData->mFollowingGroup.mAppUnitsPerDevPixel != currentGroup->mAppUnitsPerDevPixel) {
+ if (groupData->mFollowingGroup.mAppUnitsPerDevPixel != currentGroup->mAppUnitsPerDevPixel) {
+ GP("app unit change following: %d %d\n", groupData->mFollowingGroup.mAppUnitsPerDevPixel, currentGroup->mAppUnitsPerDevPixel);
+ }
+ // The group changed size
+ GP("Inner group size change\n");
+ groupData->mFollowingGroup.ClearItems();
+ if (groupData->mFollowingGroup.mKey) {
+ IntSize size = currentGroup->mGroupBounds.Size().ScaleToNearestPixels(currentGroup->mScale.width, currentGroup->mScale.height, mAppUnitsPerDevPixel);
+ groupData->mFollowingGroup.mInvalidRect = IntRect(IntPoint(0, 0), size);
aCommandBuilder->mManager->AddImageKeyForDiscard(groupData->mFollowingGroup.mKey.value());
groupData->mFollowingGroup.mKey = Nothing();
- groupData->mFollowingGroup.ClearItems();
-
- IntSize size = currentGroup->mGroupBounds.Size().ScaleToNearestPixels(currentGroup->mScale.width, currentGroup->mScale.height, mAppUnitsPerDevPixel);
- groupData->mFollowingGroup.mInvalidRect = IntRect(IntPoint(0, 0), size);
}
}
groupData->mFollowingGroup.mGroupBounds = currentGroup->mGroupBounds;
groupData->mFollowingGroup.mAppUnitsPerDevPixel = currentGroup->mAppUnitsPerDevPixel;
groupData->mFollowingGroup.mGroupOffset = currentGroup->mGroupOffset;
groupData->mFollowingGroup.mScale = currentGroup->mScale;
currentGroup = &groupData->mFollowingGroup;