Title: [268244] trunk
Revision
268244
Author
mmaxfi...@apple.com
Date
2020-10-08 20:05:43 -0700 (Thu, 08 Oct 2020)

Log Message

Stop clamping text-underline-offset to 0
https://bugs.webkit.org/show_bug.cgi?id=217455

Reviewed by Simon Fraser.

Source/WebCore:

As per the CSSWG resolution at
https://github.com/w3c/csswg-drafts/issues/4059

Test: fast/text/negative-underline-position.html

* style/InlineTextBoxStyle.cpp:
(WebCore::computeUnderlineOffset):

LayoutTests:

* fast/text/negative-underline-position-expected-mismatch.html: Added.
* fast/text/negative-underline-position.html: Added.
* fast/css3-text/css3-text-decoration/text-underline-negative-expected.html: Update.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (268243 => 268244)


--- trunk/LayoutTests/ChangeLog	2020-10-09 02:31:40 UTC (rev 268243)
+++ trunk/LayoutTests/ChangeLog	2020-10-09 03:05:43 UTC (rev 268244)
@@ -1,3 +1,14 @@
+2020-10-08  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Stop clamping text-underline-offset to 0
+        https://bugs.webkit.org/show_bug.cgi?id=217455
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/negative-underline-position-expected-mismatch.html: Added.
+        * fast/text/negative-underline-position.html: Added.
+        * fast/css3-text/css3-text-decoration/text-underline-negative-expected.html: Update.
+
 2020-10-08  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Unreviewed, unskip several canvas-related layout test directories when enabling GPU process

Modified: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-negative-expected.html (268243 => 268244)


--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-negative-expected.html	2020-10-09 02:31:40 UTC (rev 268243)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-negative-expected.html	2020-10-09 03:05:43 UTC (rev 268244)
@@ -4,6 +4,6 @@
 </head>
 <body>
 This test makes sure you can't place an underline to make it look like a line-through. The test passes if all the underlines are in the correct place.
-<div style="font: 100px 'Ahem'; text-decoration: underline; -webkit-text-decoration-color: green; text-underline-offset: 0px; -webkit-text-decoration-skip: none;">&#xc9;<span style="text-underline-offset: 14px;">&#xc9;<span style="text-underline-offset: 24px;">&#xc9;</span></span></div>
+<div style="font: 100px 'Ahem'; text-decoration: underline; -webkit-text-decoration-color: green; text-underline-offset: -10px; -webkit-text-decoration-skip: none;">&#xc9;<span style="text-underline-offset: 14px;">&#xc9;<span style="text-underline-offset: 24px;">&#xc9;</span></span></div>
 </body>
 </html>

Added: trunk/LayoutTests/fast/text/negative-underline-position-expected-mismatch.html (0 => 268244)


--- trunk/LayoutTests/fast/text/negative-underline-position-expected-mismatch.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/negative-underline-position-expected-mismatch.html	2020-10-09 03:05:43 UTC (rev 268244)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font-size: 48px; text-decoration: underline; text-underline-offset: 0px; text-decoration-skip: none;">Hello</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/negative-underline-position.html (0 => 268244)


--- trunk/LayoutTests/fast/text/negative-underline-position.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/negative-underline-position.html	2020-10-09 03:05:43 UTC (rev 268244)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font-size: 48px; text-decoration: underline; text-underline-offset: -20px; text-decoration-skip: none;">Hello</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (268243 => 268244)


--- trunk/Source/WebCore/ChangeLog	2020-10-09 02:31:40 UTC (rev 268243)
+++ trunk/Source/WebCore/ChangeLog	2020-10-09 03:05:43 UTC (rev 268244)
@@ -1,3 +1,18 @@
+2020-10-08  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Stop clamping text-underline-offset to 0
+        https://bugs.webkit.org/show_bug.cgi?id=217455
+
+        Reviewed by Simon Fraser.
+
+        As per the CSSWG resolution at
+        https://github.com/w3c/csswg-drafts/issues/4059
+
+        Test: fast/text/negative-underline-position.html
+
+        * style/InlineTextBoxStyle.cpp:
+        (WebCore::computeUnderlineOffset):
+
 2020-10-08  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [MotionMark] Add a fast path for GraphicsContext::strokePath in the case where the path is a line

Modified: trunk/Source/WebCore/style/InlineTextBoxStyle.cpp (268243 => 268244)


--- trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2020-10-09 02:31:40 UTC (rev 268243)
+++ trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2020-10-09 03:05:43 UTC (rev 268244)
@@ -60,9 +60,9 @@
     case TextUnderlinePosition::Auto:
         if (underlineOffset.isAuto())
             return fontMetrics.ascent() + gap;
-        return fontMetrics.ascent() + std::max(0.0f, underlineOffset.lengthValue());
+        return fontMetrics.ascent() + underlineOffset.lengthValue();
     case TextUnderlinePosition::FromFont:
-        return fontMetrics.ascent() + std::max(0.0f, fontMetrics.underlinePosition() + underlineOffset.lengthOr(0));
+        return fontMetrics.ascent() + fontMetrics.underlinePosition() + underlineOffset.lengthOr(0);
     case TextUnderlinePosition::Under: {
         ASSERT(inlineTextBox);
         // Position underline relative to the bottom edge of the lowest element's content box.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to