Bug 1451458. Make sure we always clear items on size change. r=mstange draft
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Wed, 11 Apr 2018 13:06:04 -0400
changeset 780628 7bf770ce33630c3ca6b137f809553997b967f606
parent 780481 d7d2f08e051c3c355d41dc5c1ce1bd3ca55a43b9
push id106049
push userbmo:jmuizelaar@mozilla.com
push dateWed, 11 Apr 2018 17:08:39 +0000
reviewersmstange
bugs1451458
milestone61.0a1
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.
gfx/layers/wr/WebRenderCommandBuilder.cpp
--- 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;