diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index c1b077f5191a..c1e1ab9a0623 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -2678,7 +2678,7 @@ nsLayoutUtils::DrawImage(nsIRenderingContext* aRenderingContext, const nsPoint& aAnchor, const nsRect& aDirty) { - if (aDest.IsEmpty()) + if (aDest.IsEmpty() || aFill.IsEmpty()) return NS_OK; nsCOMPtr dc; @@ -2687,14 +2687,15 @@ nsLayoutUtils::DrawImage(nsIRenderingContext* aRenderingContext, gfxContext *ctx = aRenderingContext->ThebesContext(); // Compute the pixel-snapped area that should be drawn - gfxRect fill(aFill.x/appUnitsPerDevPixel, - aFill.y/appUnitsPerDevPixel, - aFill.width/appUnitsPerDevPixel, - aFill.height/appUnitsPerDevPixel); + gfxRect devPixelFill(aFill.x/appUnitsPerDevPixel, + aFill.y/appUnitsPerDevPixel, + aFill.width/appUnitsPerDevPixel, + aFill.height/appUnitsPerDevPixel); PRBool ignoreScale = PR_FALSE; #ifdef MOZ_GFX_OPTIMIZE_MOBILE ignoreScale = PR_TRUE; #endif + gfxRect fill = devPixelFill; PRBool didSnap = ctx->UserToDevicePixelSnapped(fill, ignoreScale); // Compute dirty rect in gfx space @@ -2735,7 +2736,13 @@ nsLayoutUtils::DrawImage(nsIRenderingContext* aRenderingContext, gfxMatrix currentMatrix = ctx->CurrentMatrix(); gfxRect finalFillRect = fill; if (didSnap) { - ctx->UserToDevicePixelSnapped(anchorPoint, ignoreScale); + NS_ASSERTION(!currentMatrix.HasNonAxisAlignedTransform(), + "How did we snap, then?"); + anchorPoint.x = fill.pos.x + + (anchorPoint.x - devPixelFill.pos.x)*fill.size.width/devPixelFill.size.width; + anchorPoint.y = fill.pos.y + + (anchorPoint.y - devPixelFill.pos.y)*fill.size.height/devPixelFill.size.height; + anchorPoint.Round(); // This form of Transform is safe to call since non-axis-aligned // transforms wouldn't be snapped. diff --git a/layout/reftests/bugs/433640-1-ref.html b/layout/reftests/bugs/433640-1-ref.html index 49ff9596a47c..b99f710ace7a 100644 --- a/layout/reftests/bugs/433640-1-ref.html +++ b/layout/reftests/bugs/433640-1-ref.html @@ -28,8 +28,8 @@

32 x 32

32.1 x 32

-

32.5 x 32

-

32.8 x 32

+

32.5 x 32

+

32.8 x 32

@@ -42,8 +42,8 @@

32 x 32

32 x 32.1

-

32 x 32.5

-

32 x 32.8

+

32 x 32.5

+

32 x 32.8

diff --git a/layout/reftests/bugs/463204-1-ref.html b/layout/reftests/bugs/463204-1-ref.html new file mode 100644 index 000000000000..59e5eabe2b86 --- /dev/null +++ b/layout/reftests/bugs/463204-1-ref.html @@ -0,0 +1,17 @@ + + + + + + + + + diff --git a/layout/reftests/bugs/463204-1.html b/layout/reftests/bugs/463204-1.html new file mode 100644 index 000000000000..3ba91abaa17c --- /dev/null +++ b/layout/reftests/bugs/463204-1.html @@ -0,0 +1,19 @@ + + + + + + + + + diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 9f7799a1d1e2..ba5191864e32 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -958,3 +958,4 @@ fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 456147.xul 456147-ref.html # bug 456147 == 458487-5b.html 458487-5-ref.html == 461266-1.html 461266-1-ref.html fails == 461512-1.html 461512-1-ref.html # Bug 461512 +== 463204-1.html 463204-1-ref.html