Bug 1402229 - Correct the transform order of canvas in layers-free mode. r=kats draft
authorEthan Lin <ethlin@mozilla.com>
Fri, 22 Sep 2017 23:54:43 +0800
changeset 669159 fc9c6542a90eb691ecd38cfedb968e3b4dee3eb0
parent 668407 835a92b19e3d7666890153a84bc635bc43a44cb2
child 732871 3eca57ecb4238212ec65b7d6c9434b7f1c16412e
push id81231
push userbmo:ethlin@mozilla.com
push dateFri, 22 Sep 2017 15:55:48 +0000
reviewerskats
bugs1402229
milestone58.0a1
Bug 1402229 - Correct the transform order of canvas in layers-free mode. r=kats MozReview-Commit-ID: 730mujRk3Lf
layout/generic/nsHTMLCanvasFrame.cpp
--- 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,