b=488692; full page zoom broken with canvas; r=roc

This commit is contained in:
Vladimir Vukicevic 2009-05-06 13:02:59 -07:00
parent abce5af2c7
commit 75d85ea612
4 changed files with 23 additions and 7 deletions

View File

@ -236,19 +236,17 @@ nsHTMLCanvasFrame::PaintCanvas(nsIRenderingContext& aRenderingContext,
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);

View File

@ -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>

View File

@ -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>

View File

@ -1229,3 +1229,4 @@ fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 481948-3.html 481948-3-ref.html # differ
== 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