Title: [164741] trunk
Revision
164741
Author
mmaxfi...@apple.com
Date
2014-02-26 13:13:03 -0800 (Wed, 26 Feb 2014)

Log Message

Underlines are too thick when zoomed in
https://bugs.webkit.org/show_bug.cgi?id=129352

Reviewed by Dean Jackson.

Source/WebCore:

The input to the underline drawing code is in user-space, not device-space.
The underlines were getting scaled twice, once in InlineTextBox and the other
in GraphicsContext.

Test: fast/css3-text/css3-text-decoration/text-decoration-scaled.html

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintDecoration):

LayoutTests:

This test changes the page scale factor to a very large value, simulating
the user zooming in with a trackpad. It then positions the viewport
to a place where the underline should not be drawn. It then compares this
to a completely white page.

This explanation cannot be in the test itself because the test sets the
scale factor too high for the tester to be able to read text.

* fast/css3-text/css3-text-decoration/text-decoration-scaled-expected.html: Added.
* fast/css3-text/css3-text-decoration/text-decoration-scaled.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (164740 => 164741)


--- trunk/LayoutTests/ChangeLog	2014-02-26 20:58:13 UTC (rev 164740)
+++ trunk/LayoutTests/ChangeLog	2014-02-26 21:13:03 UTC (rev 164741)
@@ -1,3 +1,21 @@
+2014-02-26  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Underlines are too thick when zoomed in
+        https://bugs.webkit.org/show_bug.cgi?id=129352
+
+        Reviewed by Dean Jackson.
+
+        This test changes the page scale factor to a very large value, simulating
+        the user zooming in with a trackpad. It then positions the viewport
+        to a place where the underline should not be drawn. It then compares this
+        to a completely white page.
+
+        This explanation cannot be in the test itself because the test sets the
+        scale factor too high for the tester to be able to read text.
+
+        * fast/css3-text/css3-text-decoration/text-decoration-scaled-expected.html: Added.
+        * fast/css3-text/css3-text-decoration/text-decoration-scaled.html: Added.
+
 2014-02-26  Oliver Hunt  <oli...@apple.com>
 
         Function.prototype.apply has a bad time with the spread operator

Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-scaled-expected.html (0 => 164741)


--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-scaled-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-scaled-expected.html	2014-02-26 21:13:03 UTC (rev 164741)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<script>
+if (window.internals)
+    window.internals.setPageScaleFactor(100, 0, 0);
+</script>
+<div style="position: absolute; left: 0px; top: 0px; width: 1px; height: 1px; background: white;">
+</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-scaled.html (0 => 164741)


--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-scaled.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-scaled.html	2014-02-26 21:13:03 UTC (rev 164741)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<script>
+if (window.internals)
+    window.internals.setPageScaleFactor(100, 0, 0);
+</script>
+<div style="position: absolute; left: 0px; top: 0px; width: 1px; height: 1px; overflow: hidden;">
+<div style="font-family: Ahem; font-size: 12px; overflow: hidden; position: absolute; left: 0px; top: -12px; text-decoration: underline;">&nbsp;</div>
+</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (164740 => 164741)


--- trunk/Source/WebCore/ChangeLog	2014-02-26 20:58:13 UTC (rev 164740)
+++ trunk/Source/WebCore/ChangeLog	2014-02-26 21:13:03 UTC (rev 164741)
@@ -1,3 +1,19 @@
+2014-02-26  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Underlines are too thick when zoomed in
+        https://bugs.webkit.org/show_bug.cgi?id=129352
+
+        Reviewed by Dean Jackson.
+
+        The input to the underline drawing code is in user-space, not device-space.
+        The underlines were getting scaled twice, once in InlineTextBox and the other
+        in GraphicsContext.
+
+        Test: fast/css3-text/css3-text-decoration/text-decoration-scaled.html
+
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paintDecoration):
+
 2014-02-26  Andreas Kling  <akl...@apple.com>
 
         Remove unused InspectorCounters.

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (164740 => 164741)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2014-02-26 20:58:13 UTC (rev 164740)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2014-02-26 21:13:03 UTC (rev 164741)
@@ -1060,18 +1060,9 @@
     // Use a special function for underlines to get the positioning exactly right.
     bool isPrinting = renderer().document().printing();
 
-    // On iOS we want to draw crisp decorations. The function drawLineForText takes the context's
-    // strokeThickness and renders that at device pixel scale (i.e. a strokeThickness of 1 will
-    // produce a 1 device pixel line, so thinner on retina than non-retina). We will also scale
-    // our thickness based on the size of the font. Since our default size is 16px we'll use that
-    // as a scale reference.
-    float pageScale = 1;
-    if (Page* page = renderer().frame().page())
-        pageScale = page->pageScaleFactor();
-
     const float textDecorationBaseFontSize = 16;
     float fontSizeScaling = renderer().style().fontSize() / textDecorationBaseFontSize;
-    float strokeThickness = roundf(textDecorationThickness * fontSizeScaling * pageScale);
+    float strokeThickness = roundf(textDecorationThickness * fontSizeScaling);
     context.setStrokeThickness(strokeThickness);
 
     bool linesAreOpaque = !isPrinting && (!(decoration & TextDecorationUnderline) || underline.alpha() == 255) && (!(decoration & TextDecorationOverline) || overline.alpha() == 255) && (!(decoration & TextDecorationLineThrough) || linethrough.alpha() == 255);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to