Narrow underlines are too tall
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Jan 2014 20:30:33 +0000 (20:30 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Jan 2014 20:30:33 +0000 (20:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=126708

Reviewed by Simon Fraser.

Source/WebCore:

I made a typo in r158392 and used was settings the line rect's
height equal to its width. No one noticed because of the subsequent
if statement.

Test: fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-tall-underlines.html

* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::computeLineBoundsAndAntialiasingModeForText):

LayoutTests:

This test clips to a region that should not be drawn in, then draws a scaled underline. It then compares
the output to an empty element.

* fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-tall-underlines-expected.html: Added.
* fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-tall-underlines.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161573 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-tall-underlines-expected.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-tall-underlines.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp

index cc6258b6efb2f019325e8383fd7d96d25debbf04..cbfe30dbc8ffc67a46b24d088216de9aa45c5b9a 100644 (file)
@@ -1,3 +1,16 @@
+2014-01-09  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Narrow underlines are too tall
+        https://bugs.webkit.org/show_bug.cgi?id=126708
+
+        Reviewed by Simon Fraser.
+
+        This test clips to a region that should not be drawn in, then draws a scaled underline. It then compares
+        the output to an empty element.
+
+        * fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-tall-underlines-expected.html: Added.
+        * fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-tall-underlines.html: Added.
+
 2014-01-09  Alexey Proskuryakov  <ap@apple.com>
 
         REGRESSION (r161429?): Frequent crashes on media/track/media-element-enqueue-event-crash.html
diff --git a/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-tall-underlines-expected.html b/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-tall-underlines-expected.html
new file mode 100644 (file)
index 0000000..bec718e
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This text draws underlined text with a large scale, then clips the underline to
+a region that should not be drawn. It then makes sure that the image is the same as
+an empty one.
+</body>
+</html>
diff --git a/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-tall-underlines.html b/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-tall-underlines.html
new file mode 100644 (file)
index 0000000..e6aeddf
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This text draws underlined text with a large scale, then clips the underline to
+a region that should not be drawn. It then makes sure that the image is the same as
+an empty one.
+<div style="position: relative; overflow: hidden; width: 36px; height: 100px;">
+<div style="left: -160px; top: -320px; position: absolute; -webkit-transform: scale(20); font-family: helvetica; -webkit-transform-origin: left top; display: inline-block; text-decoration: underline; -webkit-text-decoration-skip: ink;">gy</div>
+</div>
+</body>
+</html>
index 9e09c78baa1932f4c61d9e4c0f1ff9054c432903..77636b80798ce98bbea069fe970719e9e9b454e6 100644 (file)
@@ -1,3 +1,19 @@
+2014-01-09  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Narrow underlines are too tall
+        https://bugs.webkit.org/show_bug.cgi?id=126708
+
+        Reviewed by Simon Fraser.
+
+        I made a typo in r158392 and used was settings the line rect's
+        height equal to its width. No one noticed because of the subsequent
+        if statement.
+
+        Test: fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-tall-underlines.html
+
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::computeLineBoundsAndAntialiasingModeForText):
+
 2014-01-09  Antti Koivisto  <antti@apple.com>
 
         DocumentOrderedMap should use iterator
index a19745e28e26521bdf084c0ddfcd9d69221012de..a6d66187f6cf44f30bb97b163f86e0ae0de630b9 100644 (file)
@@ -1251,7 +1251,7 @@ static FloatRect computeLineBoundsAndAntialiasingModeForText(GraphicsContext& co
 
     // On screen, use a minimum thickness of 1.0 in user space (later rounded to an integral number in device space).
     FloatRect adjustedBounds = initialBounds;
-    adjustedBounds.setHeight(std::max(initialBounds.width(), 1.0f));
+    adjustedBounds.setHeight(std::max(initialBounds.height(), 1.0f));
 
     // FIXME: This should be done a better way.
     // We try to round all parameters to integer boundaries in device space. If rounding pixels in device space