Bug 637852. Part 13: Allow snapping of text baselines to occur when there's a scale in the current transform. r=tnikkel
authorRobert O'Callahan <robert@ocallahan.org>
Thu, 23 Jun 2011 00:11:28 +1200
changeset 71802 2c7a42271f31aba0507fbec85a6622dba44f45a3
parent 71801 e552be420a02acc127554b582f7f6c062418965c
child 71803 9c05bcab628fb6f0aeea60612c32e77ecc68f2fd
push idunknown
push userunknown
push dateunknown
reviewerstnikkel
bugs637852
milestone7.0a1
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.
layout/generic/nsTextFrameThebes.cpp
layout/reftests/bugs/637852-1-ref.html
layout/reftests/bugs/637852-1.html
layout/reftests/bugs/reftest.list
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -5126,17 +5126,17 @@ ComputeTransformedLength(PropertyProvide
 }
 
 gfxFloat
 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;
 }
 
 void
 nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt,
                        const nsRect& aDirtyRect)
 {
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/637852-1-ref.html
@@ -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>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/637852-1.html
@@ -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>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1624,16 +1624,17 @@ skip-if(Android) fails-if(winWidget) == 
 == 632781-normalsize.html 632781-ref.html
 fails-if(Android) == 634232-1.html 634232-1-ref.html
 fails-if(Android) == 635302-1.html 635302-1-ref.html
 == 635373-1.html 635373-1-ref.html
 == 635373-2.html 635373-2-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
 == 645768-1.html 645768-1-ref.html
 fails-if(layersGPUAccelerated&&cocoaWidget) == 650228-1.html 650228-1-ref.html # Quartz alpha blending doesn't match GL alpha blending
 == 653930-1.html 653930-1-ref.html
 HTTP(..) == 654057-1.html 654057-1-ref.html
 fails-if(layersGPUAccelerated&&cocoaWidget) == 654950-1.html 654950-1-ref.html # Quartz alpha blending doesn't match GL alpha blending