зеркало из https://github.com/mozilla/pjs.git
Bug 463204. Be more careful about snapping the anchor point. We must transform the anchor point to match the snapping of the fill rect before we actually snap it to device pixels. r+sr=dbaron
This commit is contained in:
Родитель
c2bd446a22
Коммит
5a88d06e85
|
@ -2678,7 +2678,7 @@ nsLayoutUtils::DrawImage(nsIRenderingContext* aRenderingContext,
|
||||||
const nsPoint& aAnchor,
|
const nsPoint& aAnchor,
|
||||||
const nsRect& aDirty)
|
const nsRect& aDirty)
|
||||||
{
|
{
|
||||||
if (aDest.IsEmpty())
|
if (aDest.IsEmpty() || aFill.IsEmpty())
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
nsCOMPtr<nsIDeviceContext> dc;
|
nsCOMPtr<nsIDeviceContext> dc;
|
||||||
|
@ -2687,14 +2687,15 @@ nsLayoutUtils::DrawImage(nsIRenderingContext* aRenderingContext,
|
||||||
gfxContext *ctx = aRenderingContext->ThebesContext();
|
gfxContext *ctx = aRenderingContext->ThebesContext();
|
||||||
|
|
||||||
// Compute the pixel-snapped area that should be drawn
|
// Compute the pixel-snapped area that should be drawn
|
||||||
gfxRect fill(aFill.x/appUnitsPerDevPixel,
|
gfxRect devPixelFill(aFill.x/appUnitsPerDevPixel,
|
||||||
aFill.y/appUnitsPerDevPixel,
|
aFill.y/appUnitsPerDevPixel,
|
||||||
aFill.width/appUnitsPerDevPixel,
|
aFill.width/appUnitsPerDevPixel,
|
||||||
aFill.height/appUnitsPerDevPixel);
|
aFill.height/appUnitsPerDevPixel);
|
||||||
PRBool ignoreScale = PR_FALSE;
|
PRBool ignoreScale = PR_FALSE;
|
||||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
||||||
ignoreScale = PR_TRUE;
|
ignoreScale = PR_TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
gfxRect fill = devPixelFill;
|
||||||
PRBool didSnap = ctx->UserToDevicePixelSnapped(fill, ignoreScale);
|
PRBool didSnap = ctx->UserToDevicePixelSnapped(fill, ignoreScale);
|
||||||
|
|
||||||
// Compute dirty rect in gfx space
|
// Compute dirty rect in gfx space
|
||||||
|
@ -2735,7 +2736,13 @@ nsLayoutUtils::DrawImage(nsIRenderingContext* aRenderingContext,
|
||||||
gfxMatrix currentMatrix = ctx->CurrentMatrix();
|
gfxMatrix currentMatrix = ctx->CurrentMatrix();
|
||||||
gfxRect finalFillRect = fill;
|
gfxRect finalFillRect = fill;
|
||||||
if (didSnap) {
|
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
|
// This form of Transform is safe to call since non-axis-aligned
|
||||||
// transforms wouldn't be snapped.
|
// transforms wouldn't be snapped.
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
<div>
|
<div>
|
||||||
<div class="cell"><p>32 x 32</p><div style="width:32px; background-position:-16px -16px;" class="image"></div></div>
|
<div class="cell"><p>32 x 32</p><div style="width:32px; background-position:-16px -16px;" class="image"></div></div>
|
||||||
<div class="cell"><p>32.1 x 32</p><div style="width:32px; background-position:-16px -16px;" class="image"></div></div>
|
<div class="cell"><p>32.1 x 32</p><div style="width:32px; background-position:-16px -16px;" class="image"></div></div>
|
||||||
<div class="cell"><p>32.5 x 32</p><div style="width:33px; background-position:-16px -16px;" class="image"></div></div>
|
<div class="cell"><p>32.5 x 32</p><div style="width:33px; background-position:-15px -16px;" class="image"></div></div>
|
||||||
<div class="cell"><p>32.8 x 32</p><div style="width:33px; background-position:-16px -16px;" class="image"></div></div>
|
<div class="cell"><p>32.8 x 32</p><div style="width:33px; background-position:-15px -16px;" class="image"></div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
@ -42,8 +42,8 @@
|
||||||
<div>
|
<div>
|
||||||
<div class="cell"><p>32 x 32 </p><div style="height:32px; background-position:-16px -16px;" class="image"></div></div>
|
<div class="cell"><p>32 x 32 </p><div style="height:32px; background-position:-16px -16px;" class="image"></div></div>
|
||||||
<div class="cell"><p>32 x 32.1 </p><div style="height:32px; background-position:-16px -16px;" class="image"></div></div>
|
<div class="cell"><p>32 x 32.1 </p><div style="height:32px; background-position:-16px -16px;" class="image"></div></div>
|
||||||
<div class="cell"><p>32 x 32.5 </p><div style="height:33px; background-position:-16px -16px;" class="image"></div></div>
|
<div class="cell"><p>32 x 32.5 </p><div style="height:33px; background-position:-16px -15px;" class="image"></div></div>
|
||||||
<div class="cell"><p>32 x 32.8 </p><div style="height:33px; background-position:-16px -16px;" class="image"></div></div>
|
<div class="cell"><p>32 x 32.8 </p><div style="height:33px; background-position:-16px -15px;" class="image"></div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body></html>
|
</body></html>
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
span {
|
||||||
|
background-image: url(data:image/gif;base64,R0lGODlhEwATAKIAAP//AMzMADMzAP8AAAAAAP///wAAAAAAACH5BAEAAAUALAAAAAATABMAAANWWLrUTisyEoC1oUlFr8dQRHykFRad+Y0gdzlv86KVKdsskOUAjHu312rFK5FuxaMNIMgYe85GrVfKZVDAR7DHmVoG4IHn6vqEgZLU90xOq8OazUS7SQAAOw==);
|
||||||
|
display: inline-block;
|
||||||
|
width: 19px;
|
||||||
|
height: 19px;
|
||||||
|
margin-left: 1px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<span></span>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,19 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
span {
|
||||||
|
background-image: url(data:image/gif;base64,R0lGODlhEwATAKIAAP//AMzMADMzAP8AAAAAAP///wAAAAAAACH5BAEAAAUALAAAAAATABMAAANWWLrUTisyEoC1oUlFr8dQRHykFRad+Y0gdzlv86KVKdsskOUAjHu312rFK5FuxaMNIMgYe85GrVfKZVDAR7DHmVoG4IHn6vqEgZLU90xOq8OazUS7SQAAOw==);
|
||||||
|
display: inline-block;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center center;
|
||||||
|
width: 19px;
|
||||||
|
height: 19px;
|
||||||
|
margin-left: 0.6px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<span></span>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -958,3 +958,4 @@ fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 456147.xul 456147-ref.html # bug 456147
|
||||||
== 458487-5b.html 458487-5-ref.html
|
== 458487-5b.html 458487-5-ref.html
|
||||||
== 461266-1.html 461266-1-ref.html
|
== 461266-1.html 461266-1-ref.html
|
||||||
fails == 461512-1.html 461512-1-ref.html # Bug 461512
|
fails == 461512-1.html 461512-1-ref.html # Bug 461512
|
||||||
|
== 463204-1.html 463204-1-ref.html
|
||||||
|
|
Загрузка…
Ссылка в новой задаче