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
--- 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)) {