Title: [237948] trunk
Revision
237948
Author
mmaxfi...@apple.com
Date
2018-11-07 16:10:20 -0800 (Wed, 07 Nov 2018)

Log Message

Dotted underlines that skip descenders are invisible
https://bugs.webkit.org/show_bug.cgi?id=191403

Reviewed by Simon Fraser.

Source/WebCore:

Turns out our underline bounding boxes had negative width. When drawing the full
underline that was fine because it was handled by the 2D graphics engine, but when
we try to split up the box into dots, our "for" loop was taking 0 iterations (because
the end was before the start).

Test: fast/css3-text/css3-text-decoration/text-underline-style.html

* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::drawLineForText):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawLineForText):
* platform/graphics/win/GraphicsContextDirect2D.cpp:
(WebCore::GraphicsContext::drawLineForText):

LayoutTests:

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (237947 => 237948)


--- trunk/LayoutTests/ChangeLog	2018-11-07 23:49:29 UTC (rev 237947)
+++ trunk/LayoutTests/ChangeLog	2018-11-08 00:10:20 UTC (rev 237948)
@@ -1,3 +1,13 @@
+2018-11-07  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Dotted underlines that skip descenders are invisible
+        https://bugs.webkit.org/show_bug.cgi?id=191403
+
+        Reviewed by Simon Fraser.
+
+        * fast/css3-text/css3-text-decoration/text-underline-style-expected.html: Added.
+        * fast/css3-text/css3-text-decoration/text-underline-style.html: Added.
+
 2018-11-07  Andy Estes  <aes...@apple.com>
 
         Crash in WebCore::PaymentRequest::canMakePayment when Apple Pay payment method data is missing

Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-style-expected.html (0 => 237948)


--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-style-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-style-expected.html	2018-11-08 00:10:20 UTC (rev 237948)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that dotted underlines have the correct dot diameters when underlines have thickness.
+<div style="position: relative;">
+<div style="font: 100px 'Ahem';">&#xc9;&#xc9;&#xc9;&#xc9;</div>
+<div style="position: absolute; left: 0px; top: 80px; width: 50px; height: 50px; background: green;"></div>
+<div style="position: absolute; left: 100px; top: 80px; width: 50px; height: 50px; background: green;"></div>
+<div style="position: absolute; left: 200px; top: 80px; width: 50px; height: 50px; background: green;"></div>
+<div style="position: absolute; left: 300px; top: 80px; width: 50px; height: 50px; background: green;"></div>
+</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-style.html (0 => 237948)


--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-style.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-style.html	2018-11-08 00:10:20 UTC (rev 237948)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that dotted underlines have the correct dot diameters when underlines have thickness.
+<div style="font: 100px 'Ahem'; text-decoration: underline; -webkit-text-decoration-skip: none; text-underline-offset: 0px; -webkit-text-decoration-color: green; text-decoration-thickness: 50px; -webkit-text-decoration-style: dotted;">&#xc9;&#xc9;&#xc9;&#xc9;</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (237947 => 237948)


--- trunk/Source/WebCore/ChangeLog	2018-11-07 23:49:29 UTC (rev 237947)
+++ trunk/Source/WebCore/ChangeLog	2018-11-08 00:10:20 UTC (rev 237948)
@@ -1,3 +1,24 @@
+2018-11-07  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Dotted underlines that skip descenders are invisible
+        https://bugs.webkit.org/show_bug.cgi?id=191403
+
+        Reviewed by Simon Fraser.
+
+        Turns out our underline bounding boxes had negative width. When drawing the full
+        underline that was fine because it was handled by the 2D graphics engine, but when
+        we try to split up the box into dots, our "for" loop was taking 0 iterations (because
+        the end was before the start).
+
+        Test: fast/css3-text/css3-text-decoration/text-underline-style.html
+
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContext::drawLineForText):
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::drawLineForText):
+        * platform/graphics/win/GraphicsContextDirect2D.cpp:
+        (WebCore::GraphicsContext::drawLineForText):
+
 2018-11-07  Andy Estes  <aes...@apple.com>
 
         Crash in WebCore::PaymentRequest::canMakePayment when Apple Pay payment method data is missing

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (237947 => 237948)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2018-11-07 23:49:29 UTC (rev 237947)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2018-11-08 00:10:20 UTC (rev 237948)
@@ -318,7 +318,7 @@
 
 void GraphicsContext::drawLineForText(const FloatRect& rect, bool printing, bool doubleUnderlines, StrokeStyle)
 {
-    drawLinesForText(rect.location(), rect.height(), DashArray { rect.width(), 0 }, printing, doubleUnderlines);
+    drawLinesForText(rect.location(), rect.height(), DashArray { 0, rect.width() }, printing, doubleUnderlines);
 }
 
 void GraphicsContext::drawLinesForText(const FloatPoint& point, float thickness, const DashArray& widths, bool printing, bool doubleUnderlines, StrokeStyle)

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (237947 => 237948)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2018-11-07 23:49:29 UTC (rev 237947)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2018-11-08 00:10:20 UTC (rev 237948)
@@ -1573,8 +1573,8 @@
 void GraphicsContext::drawLineForText(const FloatRect& rect, bool printing, bool doubleLines, StrokeStyle strokeStyle)
 {
     DashArray widths;
+    widths.append(0);
     widths.append(rect.width());
-    widths.append(0);
     drawLinesForText(rect.location(), rect.height(), widths, printing, doubleLines, strokeStyle);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp (237947 => 237948)


--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp	2018-11-07 23:49:29 UTC (rev 237947)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp	2018-11-08 00:10:20 UTC (rev 237948)
@@ -1690,8 +1690,8 @@
 void GraphicsContext::drawLineForText(const FloatPoint& point, float width, bool printing, bool doubleLines, StrokeStyle strokeStyle)
 {
     DashArray widths;
+    widths.append(0);
     widths.append(width);
-    widths.append(0);
     drawLinesForText(point, widths, printing, doubleLines, strokeStyle);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to