b=488692; full page zoom broken with canvas; r=roc
authorVladimir Vukicevic <vladimir@pobox.com>
Wed, 06 May 2009 13:02:59 -0700
changeset 28043 69246843ecf4cbe600d3c45a0b8125ecada527bb
parent 28042 388c8abcc7fefdad35d1dcf17d0918f6395c960a
child 28044 1671b6e69007b6641f84e5fc4a2e01c9f68a8a68
push id6858
push uservladimir@mozilla.com
push dateWed, 06 May 2009 20:07:10 +0000
treeherdermozilla-central@69246843ecf4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs488692
milestone1.9.2a1pre
b=488692; full page zoom broken with canvas; r=roc
layout/generic/nsHTMLCanvasFrame.cpp
layout/reftests/bugs/488692-1-ref.html
layout/reftests/bugs/488692-1.html
layout/reftests/bugs/reftest.list
--- a/layout/generic/nsHTMLCanvasFrame.cpp
+++ b/layout/generic/nsHTMLCanvasFrame.cpp
@@ -231,29 +231,27 @@ nsHTMLCanvasFrame::PaintCanvas(nsIRender
   nsCOMPtr<nsICanvasElement> canvas(do_QueryInterface(GetContent()));
   if (!canvas)
     return;
 
   // anything to do?
   if (inner.width == 0 || inner.height == 0)
     return;
 
+  gfxRect devInner(presContext->AppUnitsToGfxUnits(inner));
+
   nsIntSize sizeCSSPixels = GetCanvasSize();
-  nsSize sizeAppUnits(nsPresContext::CSSPixelsToAppUnits(sizeCSSPixels.width),
-                      nsPresContext::CSSPixelsToAppUnits(sizeCSSPixels.height));
+  gfxFloat sx = devInner.size.width / (gfxFloat) sizeCSSPixels.width;
+  gfxFloat sy = devInner.size.height / (gfxFloat) sizeCSSPixels.height;
 
   gfxContext *ctx = aRenderingContext.ThebesContext();
 
-  gfxFloat sx = inner.width / (gfxFloat) sizeAppUnits.width;
-  gfxFloat sy = inner.height / (gfxFloat) sizeAppUnits.height;
-
   ctx->Save();
 
-  ctx->Translate(gfxPoint(presContext->AppUnitsToGfxUnits(inner.x),
-                          presContext->AppUnitsToGfxUnits(inner.y)));
+  ctx->Translate(devInner.pos);
   ctx->Scale(sx, sy);
 
   canvas->RenderContexts(ctx);
 
   ctx->Restore();
 }
 
 NS_IMETHODIMP
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/488692-1-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html reftest-zoom="2.0">
+<body style="background: black">
+<div style="width: 100px; height: 100px; background: #00ff00"></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/488692-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<html reftest-zoom="2.0">
+<body style="background: black">
+<canvas width="100" height="100" id="c"></canvas>
+<script type="text/javascript">
+var cx = document.getElementById("c").getContext("2d");
+cx.fillStyle = "#00ff00";
+cx.fillRect(0, 0, 100, 100);
+</script>
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1224,8 +1224,9 @@ fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 
 == 486052-2d.html 486052-2-ref.html
 == 486052-2e.html 486052-2-ref.html
 == 486052-2f.html 486052-2-ref.html
 == 486052-2g.html 486052-2-ref.html
 == 486848-1.xul 486848-1-ref.xul
 == 487539-1.html about:blank
 == 488390-1.html 488390-1-ref.html
 == 488685-1.html 488685-1-ref.html
+== 488692-1.html 488692-1-ref.html