Bug 637852. Part 24: Fix scale/translate order in DrawThebesLayer. r=tnikkel
authorRobert O'Callahan <robert@ocallahan.org>
Thu, 23 Jun 2011 00:11:28 +1200
changeset 71539 c18bdf8b0b761731e0f6de7d28a4e9ac57a6c5d3
parent 71538 dcfa8de9746a5b091de102f1a417e4ca52fdca22
child 71540 8b1e793fbf453feba15297386293b28b07cb4bc9
push idunknown
push userunknown
push dateunknown
reviewerstnikkel
bugs637852
milestone7.0a1
Bug 637852. Part 24: Fix scale/translate order in DrawThebesLayer. r=tnikkel
layout/base/FrameLayerBuilder.cpp
layout/reftests/bugs/637852-3-ref.html
layout/reftests/bugs/637852-3.html
layout/reftests/bugs/reftest.list
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -2036,21 +2036,21 @@ FrameLayerBuilder::DrawThebesLayer(Thebe
     aContext->SetColor(gfxRGBA(userData->mForcedBackgroundColor));
     aContext->Fill();
   }
 
   // make the origin of the context coincide with the origin of the
   // ThebesLayer
   gfxContextMatrixAutoSaveRestore saveMatrix(aContext);
   nsIntPoint offset = GetTranslationForThebesLayer(aLayer);
-  aContext->Scale(userData->mXScale, userData->mYScale);
   // Apply the residual transform if it has been enabled, to ensure that
   // snapping when we draw into aContext exactly matches the ideal transform.
   // See above for why this is OK.
   aContext->Translate(aLayer->GetResidualTranslation() - gfxPoint(offset.x, offset.y));
+  aContext->Scale(userData->mXScale, userData->mYScale);
 
   nsPresContext* presContext = containerLayerFrame->PresContext();
   PRInt32 appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
   if (!aRegionToInvalidate.IsEmpty()) {
     nsRect r = (aRegionToInvalidate.GetBounds() + offset).
       ToAppUnits(appUnitsPerDevPixel);
     r.ScaleInverseRoundOut(userData->mXScale, userData->mYScale);
     containerLayerFrame->InvalidateWithFlags(r,
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/637852-3-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<div id="d" style="border:20px solid black; height:200px; width:200px;">
+  <div style="width:200px; height:50px; background:yellow"></div>
+  <div style="height:100px; background:blue;"></div>
+  <div style="height:50px; background:orange;"></div>
+</div>
+</body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/637852-3.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<div id="d" style="-moz-transform:scale(2); -moz-transform-origin:top left; border:10px solid black; height:100px; width:100px; overflow:hidden">
+  <canvas width="100" height="100" id="c" style="display:block"></canvas>
+  <div style="height:50px; background:blue;"></div>
+  <div style="height:50px; background:orange;"></div>
+</div>
+<script>
+var c = document.getElementById("c");
+var ctx = c.getContext("2d");
+ctx.fillStyle = "yellow";
+ctx.fillRect(0, 0, c.width, c.height);
+var d = document.getElementById("d");
+d.scrollTop = 75;
+</script>
+</body>
+</html>
+
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1628,16 +1628,17 @@ fails-if(Android) == 635302-1.html 63530
 == 635373-1.html 635373-1-ref.html
 == 635373-2.html 635373-2-ref.html
 fails-if(http.platform=="X11"&&!layersGPUAccelerated) == 635373-3.html 635373-3-ref.html
 HTTP(..) == 635639-1.html 635639-1-ref.html
 HTTP(..) == 635639-2.html 635639-2-ref.html
 == 637597-1.html 637597-1-ref.html
 == 637852-1.html 637852-1-ref.html
 == 637852-2.html 637852-2-ref.html
+== 637852-3.html 637852-3-ref.html
 == 641770-1.html 641770-1-ref.html
 == 641856-1.html 641856-1-ref.html
 == 645491-1.html 645491-1-ref.html
 == 645768-1.html 645768-1-ref.html
 fails-if(layersGPUAccelerated&&cocoaWidget) == 650228-1.html 650228-1-ref.html # Quartz alpha blending doesn't match GL alpha blending
 == 653930-1.html 653930-1-ref.html
 HTTP(..) == 654057-1.html 654057-1-ref.html
 fails-if(layersGPUAccelerated&&cocoaWidget) == 654950-1.html 654950-1-ref.html # Quartz alpha blending doesn't match GL alpha blending