Bug 1402229 - Correct the transform order of canvas in layers-free mode. r=kats
MozReview-Commit-ID: 730mujRk3Lf
--- a/layout/generic/nsHTMLCanvasFrame.cpp
+++ b/layout/generic/nsHTMLCanvasFrame.cpp
@@ -173,24 +173,23 @@ public:
// context need to be done manually and pushed over to the parent side,
// where it will be done when we build the display list for the iframe.
// That happens in WebRenderCompositableHolder.
wr::LayoutRect r = aSc.ToRelativeLayoutRect(bounds);
aBuilder.PushIFrame(r, !BackfaceIsHidden(), data->GetPipelineId().ref());
gfx::Matrix4x4 scTransform;
+ gfxRect destGFXRect = mFrame->PresContext()->AppUnitsToGfxUnits(dest);
+ scTransform.PreScale(destGFXRect.Width() / canvasSizeInPx.width,
+ destGFXRect.Height() / canvasSizeInPx.height, 1.0f);
if (data->NeedsYFlip()) {
scTransform = scTransform.PreTranslate(0, data->GetSize().height, 0).PreScale(1, -1, 1);
}
- gfxRect destGFXRect = mFrame->PresContext()->AppUnitsToGfxUnits(dest);
- scTransform.PreScale(destGFXRect.Width() / canvasSizeInPx.width,
- destGFXRect.Height() / canvasSizeInPx.height, 1.0f);
-
MaybeIntSize scaleToSize;
LayerRect scBounds(0, 0, bounds.width, bounds.height);
wr::ImageRendering filter = wr::ToImageRendering(nsLayoutUtils::GetSamplingFilterForFrame(mFrame));
wr::MixBlendMode mixBlendMode = wr::MixBlendMode::Normal;
aManager->WrBridge()->AddWebRenderParentCommand(OpUpdateAsyncImagePipeline(data->GetPipelineId().value(),
scBounds,
scTransform,
scaleToSize,