Bug 1568227. Render blobs at visibleRect.x,y instead of 0,0. r=nical

Differential Revision: https://phabricator.services.mozilla.com/D45322

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jeff Muizelaar 2019-09-10 15:12:05 +00:00
Родитель 6223028546
Коммит b74d61d223
1 изменённых файлов: 14 добавлений и 7 удалений

Просмотреть файл

@ -2047,6 +2047,7 @@ static bool PaintByLayer(nsDisplayItem* aItem,
static bool PaintItemByDrawTarget(nsDisplayItem* aItem, gfx::DrawTarget* aDT,
const LayoutDevicePoint& aOffset,
const IntRect& visibleRect,
nsDisplayListBuilder* aDisplayListBuilder,
const RefPtr<BasicLayerManager>& aManager,
const gfx::Size& aScale,
@ -2055,7 +2056,7 @@ static bool PaintItemByDrawTarget(nsDisplayItem* aItem, gfx::DrawTarget* aDT,
bool isInvalidated = false;
// XXX Why is this ClearRect() needed?
aDT->ClearRect(Rect(aDT->GetRect()));
aDT->ClearRect(Rect(visibleRect));
RefPtr<gfxContext> context = gfxContext::CreateOrNull(aDT);
MOZ_ASSERT(context);
@ -2100,15 +2101,14 @@ static bool PaintItemByDrawTarget(nsDisplayItem* aItem, gfx::DrawTarget* aDT,
// which isn't very useful.
if (aHighlight) {
aDT->SetTransform(gfx::Matrix());
aDT->FillRect(Rect(aDT->GetRect()),
gfx::ColorPattern(aHighlight.value()));
aDT->FillRect(Rect(visibleRect), gfx::ColorPattern(aHighlight.value()));
}
if (aItem->Frame()->PresContext()->GetPaintFlashing() && isInvalidated) {
aDT->SetTransform(gfx::Matrix());
float r = float(rand()) / float(RAND_MAX);
float g = float(rand()) / float(RAND_MAX);
float b = float(rand()) / float(RAND_MAX);
aDT->FillRect(Rect(aDT->GetRect()),
aDT->FillRect(Rect(visibleRect),
gfx::ColorPattern(gfx::Color(r, g, b, 0.5)));
}
}
@ -2195,7 +2195,7 @@ WebRenderCommandBuilder::GenerateFallbackData(
if (dtSize.IsEmpty()) {
return nullptr;
}
// Display item bounds should be unscaled
aImageRect = dtRect / layerScale;
nsDisplayItemGeometry* geometry = fallbackData->mGeometry;
@ -2276,8 +2276,11 @@ WebRenderCommandBuilder::GenerateFallbackData(
fallbackData->mBasicLayerManager =
new BasicLayerManager(BasicLayerManager::BLM_INACTIVE);
}
// aOffset is (0, 0) because blobs don't want to normalize their
// coordinates
bool isInvalidated = PaintItemByDrawTarget(
aItem, dt, LayoutDevicePoint(0, 0), aDisplayListBuilder,
aItem, dt, LayoutDevicePoint(0, 0),
/*aVisibleRect: */ dtRect.ToUnknownRect(), aDisplayListBuilder,
fallbackData->mBasicLayerManager, scale, highlight);
if (!isInvalidated) {
if (!aItem->GetBuildingRect().IsEqualInterior(
@ -2346,8 +2349,12 @@ WebRenderCommandBuilder::GenerateFallbackData(
fallbackData->mBasicLayerManager =
new BasicLayerManager(mManager->GetWidget());
}
// aOffset is applied because this case is a "real" image and not a
// blob
isInvalidated = PaintItemByDrawTarget(
aItem, dt, aImageRect.TopLeft(), aDisplayListBuilder,
aItem, dt,
/*aOffset: */ aImageRect.TopLeft(),
/*aVisibleRect: */ dt->GetRect(), aDisplayListBuilder,
fallbackData->mBasicLayerManager, scale, highlight);
}