Bug 1389433 - Fix the offset of the fallback image for layers-free. r=mtseng draft
authorEthan Lin <ethlin@mozilla.com>
Mon, 14 Aug 2017 16:10:21 +0800
changeset 645794 60819eea74a804da7b3f0e1b42536f67894387b8
parent 645674 3bfcbdf5c6c381d5a8febb5c209e27a69fb89f9b
child 726024 40c48bddabb3e5583f7c0b7bb05ae6d6d38c7007
push id73885
push userbmo:ethlin@mozilla.com
push dateMon, 14 Aug 2017 08:14:25 +0000
reviewersmtseng
bugs1389433
milestone57.0a1
Bug 1389433 - Fix the offset of the fallback image for layers-free. r=mtseng Originally we use the nsDisplayItem::ToReferenceFrame() to get the offset. But the function doesn't consider some style effects. We should take the top-left corner of the display item bounds as the offset. MozReview-Commit-ID: LiPcA0vjoD7
gfx/layers/wr/WebRenderLayerManager.cpp
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -432,19 +432,18 @@ WebRenderLayerManager::GenerateFallbackD
       PixelCastJustification::WebRenderHasUnitResolution);
 
   LayerIntSize imageSize = RoundedToInt(bounds.Size());
   aImageRect = LayerRect(LayerPoint(0, 0), LayerSize(imageSize));
   if (imageSize.width == 0 || imageSize.height == 0) {
     return nullptr;
   }
 
-  nsPoint shift = clippedBounds.TopLeft() - itemBounds.TopLeft();
   aOffset = ViewAs<LayerPixel>(
-      LayoutDevicePoint::FromAppUnits(aItem->ToReferenceFrame() + shift, appUnitsPerDevPixel),
+      LayoutDevicePoint::FromAppUnits(clippedBounds.TopLeft(), appUnitsPerDevPixel),
       PixelCastJustification::WebRenderHasUnitResolution);
 
   nsRegion invalidRegion;
   nsAutoPtr<nsDisplayItemGeometry> geometry = fallbackData->GetGeometry();
 
   if (geometry) {
     nsRect invalid;
     if (aItem->IsInvalid(invalid)) {