зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1761002 - Restore the clip rect in webrenderized images. r=mstange
In bug 1758942 there was a bit of clipping logic for webrenderized svg images that was removed because we didn't know what it was useful for. I still don't quite know, other than that it caused layout/reftests/svg/image/image-preserveAspectRatio-01-raster.svg and layout/reftests/svg/image/image-preserveAspectRatio-02-raster.svg to start failing when the gfx.webrender.svg-images pref is enabled, so let's revert it. Depends on D141847 Differential Revision: https://phabricator.services.mozilla.com/D141848
This commit is contained in:
Родитель
b0457b9551
Коммит
6019443efe
|
@ -497,7 +497,16 @@ bool SVGImageFrame::CreateWebRenderCommands(
|
||||||
appUnitsPerCSSPixel);
|
appUnitsPerCSSPixel);
|
||||||
appRect += toReferenceFrame;
|
appRect += toReferenceFrame;
|
||||||
auto destRect = LayoutDeviceRect::FromAppUnits(appRect, appUnitsPerDevPx);
|
auto destRect = LayoutDeviceRect::FromAppUnits(appRect, appUnitsPerDevPx);
|
||||||
|
auto clipRect = destRect;
|
||||||
|
|
||||||
if (StyleDisplay()->IsScrollableOverflow()) {
|
if (StyleDisplay()->IsScrollableOverflow()) {
|
||||||
|
// Apply potential non-trivial clip
|
||||||
|
auto cssClip = SVGUtils::GetClipRectForFrame(this, 0, 0, width, height);
|
||||||
|
auto appClip =
|
||||||
|
nsLayoutUtils::RoundGfxRectToAppRect(cssClip, appUnitsPerCSSPixel);
|
||||||
|
appClip += toReferenceFrame;
|
||||||
|
clipRect = LayoutDeviceRect::FromAppUnits(appClip, appUnitsPerDevPx);
|
||||||
|
|
||||||
// Apply preserveAspectRatio
|
// Apply preserveAspectRatio
|
||||||
if (mImageContainer->GetType() == imgIContainer::TYPE_RASTER) {
|
if (mImageContainer->GetType() == imgIContainer::TYPE_RASTER) {
|
||||||
int32_t nativeWidth, nativeHeight;
|
int32_t nativeWidth, nativeHeight;
|
||||||
|
@ -611,7 +620,7 @@ bool SVGImageFrame::CreateWebRenderCommands(
|
||||||
|
|
||||||
Maybe<ImageIntRegion> region;
|
Maybe<ImageIntRegion> region;
|
||||||
IntSize decodeSize = nsLayoutUtils::ComputeImageContainerDrawingParameters(
|
IntSize decodeSize = nsLayoutUtils::ComputeImageContainerDrawingParameters(
|
||||||
mImageContainer, this, destRect, destRect, aSc, flags, svgContext,
|
mImageContainer, this, destRect, clipRect, aSc, flags, svgContext,
|
||||||
region);
|
region);
|
||||||
|
|
||||||
RefPtr<image::WebRenderImageProvider> provider;
|
RefPtr<image::WebRenderImageProvider> provider;
|
||||||
|
@ -644,7 +653,7 @@ bool SVGImageFrame::CreateWebRenderCommands(
|
||||||
if (provider) {
|
if (provider) {
|
||||||
aManager->CommandBuilder().PushImageProvider(aItem, provider, drawResult,
|
aManager->CommandBuilder().PushImageProvider(aItem, provider, drawResult,
|
||||||
aBuilder, aResources,
|
aBuilder, aResources,
|
||||||
destRect, destRect);
|
destRect, clipRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDisplayItemGenericImageGeometry::UpdateDrawResult(aItem, drawResult);
|
nsDisplayItemGenericImageGeometry::UpdateDrawResult(aItem, drawResult);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче