Bug 637852. Part 13: Allow snapping of text baselines to occur when there's a scale in the current transform. r=tnikkel

This allows baselines to be snapped properly when drawing into high-resolution ThebesLayers.
This commit is contained in:
Robert O'Callahan 2011-06-23 00:11:28 +12:00
parent 08cb8f63ce
commit c37c544c23
4 changed files with 34 additions and 1 deletions

View File

@ -5131,7 +5131,7 @@ nsTextFrame::GetSnappedBaselineY(gfxContext* aContext, gfxFloat aY)
gfxFloat appUnitsPerDevUnit = mTextRun->GetAppUnitsPerDevUnit();
gfxFloat baseline = aY + mAscent;
gfxRect putativeRect(0, baseline/appUnitsPerDevUnit, 1, 1);
if (!aContext->UserToDevicePixelSnapped(putativeRect))
if (!aContext->UserToDevicePixelSnapped(putativeRect, PR_TRUE))
return baseline;
return aContext->DeviceToUser(putativeRect.TopLeft()).y*appUnitsPerDevUnit;
}

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<style>
body { margin-top:101px; }
.outer {
-moz-transform:scale(1.4);
-moz-transform-origin:top left;
line-height:40px;
}
</style>
</head>
<body>
<div class="outer"><div class="inner">Hello Kitty</div></div>
</body>
</html>

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<style>
body { margin-top:100.9px; }
.outer {
-moz-transform:scale(1.4);
-moz-transform-origin:top left;
line-height:40px;
}
</style>
</head>
<body>
<div class="outer"><div class="inner">Hello Kitty</div></div>
</body>
</html>

View File

@ -1629,6 +1629,7 @@ fails-if(Android) == 635302-1.html 635302-1-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
== 637852-1.html 637852-1-ref.html
== 641770-1.html 641770-1-ref.html
== 641856-1.html 641856-1-ref.html
== 645491-1.html 645491-1-ref.html