Bug 1416076 - We should set visible rect to display item before computing visibility. r=mattwoodrow
authorEthan Lin <ethlin@mozilla.com>
Mon, 13 Nov 2017 15:48:01 +0800
changeset 436410 b468a6f584f858967dc342cd5d28bec7db17aa77
parent 436409 28164096fde24ee2b534a91454202f6610ecaba7
child 436411 a89b42b23213ce0f87a615adbfe8fa9b6a330c0d
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
reviewersmattwoodrow
bugs1416076
milestone59.0a1
Bug 1416076 - We should set visible rect to display item before computing visibility. r=mattwoodrow MozReview-Commit-ID: HngrLGSS6St
gfx/layers/wr/WebRenderCommandBuilder.cpp
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -480,31 +480,30 @@ WebRenderCommandBuilder::GenerateFallbac
 
   RefPtr<WebRenderFallbackData> fallbackData = CreateOrRecycleWebRenderUserData<WebRenderFallbackData>(aItem);
 
   bool snap;
   nsRect itemBounds = aItem->GetBounds(aDisplayListBuilder, &snap);
 
   // Blob images will only draw the visible area of the blob so we don't need to clip
   // them here and can just rely on the webrender clipping.
-  bool useClipBounds = true;
   nsRect paintBounds = itemBounds;
   if (useBlobImage) {
     paintBounds = itemBounds;
-    useClipBounds = false;
   } else {
     paintBounds = aItem->GetClippedBounds(aDisplayListBuilder);
   }
 
   // nsDisplayItem::Paint() may refer the variables that come from ComputeVisibility().
-  // So we should call RecomputeVisibility() before painting. e.g.: nsDisplayBoxShadowInner
+  // So we should call ComputeVisibility() before painting. e.g.: nsDisplayBoxShadowInner
   // uses mVisibleRegion in Paint() and mVisibleRegion is computed in
   // nsDisplayBoxShadowInner::ComputeVisibility().
-  nsRegion visibleRegion(itemBounds);
-  aItem->RecomputeVisibility(aDisplayListBuilder, &visibleRegion, useClipBounds);
+  nsRegion visibleRegion(paintBounds);
+  aItem->SetVisibleRect(paintBounds, false);
+  aItem->ComputeVisibility(aDisplayListBuilder, &visibleRegion);
 
   const int32_t appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
   LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(paintBounds, appUnitsPerDevPixel);
 
   gfx::Size scale = aSc.GetInheritedScale();
   gfx::Size oldScale = fallbackData->GetScale();
   // This scale determination should probably be done using
   // ChooseScaleAndSetTransform but for now we just fake it.