Title: [238075] trunk
Revision
238075
Author
[email protected]
Date
2018-11-11 09:13:40 -0800 (Sun, 11 Nov 2018)

Log Message

Address post-review comments after r237955
https://bugs.webkit.org/show_bug.cgi?id=191496

Reviewed by Darin Adler.

Source/WebCore:

* rendering/TextDecorationPainter.cpp:
(WebCore::TextDecorationPainter::paintTextDecoration):
* style/InlineTextBoxStyle.cpp:
(WebCore::computeUnderlineOffset):
* style/InlineTextBoxStyle.h:

LayoutTests:

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

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238074 => 238075)


--- trunk/LayoutTests/ChangeLog	2018-11-11 08:27:32 UTC (rev 238074)
+++ trunk/LayoutTests/ChangeLog	2018-11-11 17:13:40 UTC (rev 238075)
@@ -1,3 +1,12 @@
+2018-11-11  Myles C. Maxfield  <[email protected]>
+
+        Address post-review comments after r237955
+        https://bugs.webkit.org/show_bug.cgi?id=191496
+
+        Reviewed by Darin Adler.
+
+        * fast/css3-text/css3-text-decoration/text-underline-negative-expected.html:
+
 2018-11-10  Simon Fraser  <[email protected]>
 
         Remove support for -webkit-svg-shadow

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


--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-negative-expected.html	2018-11-11 08:27:32 UTC (rev 238074)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-negative-expected.html	2018-11-11 17:13:40 UTC (rev 238075)
@@ -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: 13px;">&#xc9;<span style="text-underline-offset: 23px;">&#xc9;</span></span></div>
+<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>
 </body>
 </html>

Modified: trunk/Source/WebCore/ChangeLog (238074 => 238075)


--- trunk/Source/WebCore/ChangeLog	2018-11-11 08:27:32 UTC (rev 238074)
+++ trunk/Source/WebCore/ChangeLog	2018-11-11 17:13:40 UTC (rev 238075)
@@ -1,3 +1,16 @@
+2018-11-11  Myles C. Maxfield  <[email protected]>
+
+        Address post-review comments after r237955
+        https://bugs.webkit.org/show_bug.cgi?id=191496
+
+        Reviewed by Darin Adler.
+
+        * rendering/TextDecorationPainter.cpp:
+        (WebCore::TextDecorationPainter::paintTextDecoration):
+        * style/InlineTextBoxStyle.cpp:
+        (WebCore::computeUnderlineOffset):
+        * style/InlineTextBoxStyle.h:
+
 2018-11-11  Benjamin Poulain  <[email protected]>
 
         Fix a fixme: rename wtfObjcMsgSend to wtfObjCMsgSend

Modified: trunk/Source/WebCore/rendering/TextDecorationPainter.cpp (238074 => 238075)


--- trunk/Source/WebCore/rendering/TextDecorationPainter.cpp	2018-11-11 08:27:32 UTC (rev 238074)
+++ trunk/Source/WebCore/rendering/TextDecorationPainter.cpp	2018-11-11 17:13:40 UTC (rev 238075)
@@ -287,7 +287,7 @@
         if (m_decorations.contains(TextDecoration::Underline)) {
             float textDecorationBaseFontSize = 16;
             auto defaultGap = m_lineStyle.computedFontSize() / textDecorationBaseFontSize;
-            int offset = computeUnderlineOffset(m_lineStyle.textUnderlinePosition(), m_lineStyle.textUnderlineOffset(), m_lineStyle.fontMetrics(), m_inlineTextBox, defaultGap);
+            float offset = computeUnderlineOffset(m_lineStyle.textUnderlinePosition(), m_lineStyle.textUnderlineOffset(), m_lineStyle.fontMetrics(), m_inlineTextBox, defaultGap);
             float wavyOffset = m_styles.underlineStyle == TextDecorationStyle::Wavy ? m_wavyOffset : 0;
             FloatRect rect(localOrigin, FloatSize(m_width, textDecorationThickness));
             rect.move(0, offset + wavyOffset);

Modified: trunk/Source/WebCore/style/InlineTextBoxStyle.cpp (238074 => 238075)


--- trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2018-11-11 08:27:32 UTC (rev 238074)
+++ trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2018-11-11 17:13:40 UTC (rev 238075)
@@ -32,10 +32,10 @@
 
 namespace WebCore {
     
-int computeUnderlineOffset(TextUnderlinePosition underlinePosition, TextUnderlineOffset underlineOffset, const FontMetrics& fontMetrics, const InlineTextBox* inlineTextBox, int defaultGap)
+float computeUnderlineOffset(TextUnderlinePosition underlinePosition, TextUnderlineOffset underlineOffset, const FontMetrics& fontMetrics, const InlineTextBox* inlineTextBox, float defaultGap)
 {
     // This represents the gap between the baseline and the closest edge of the underline.
-    int gap = std::max<int>(1, ceilf(defaultGap / 2.0));
+    float gap = std::max<int>(1, std::ceil(defaultGap / 2.0f));
     
     // FIXME: The code for visual overflow detection passes in a null inline text box. This means it is now
     // broken for the case where auto needs to behave like "under".
@@ -78,9 +78,8 @@
             rootBox.maxLogicalBottomForTextDecorationLine(offset, decorationRenderer, TextDecoration::Underline);
             offset -= inlineTextBox->logicalBottom();
         }
-        auto desiredOffset = inlineTextBox->logicalHeight() + gap + std::max<float>(offset, 0) + underlineOffset.lengthOr(0);
-        desiredOffset = std::max<float>(desiredOffset, fontMetrics.ascent());
-        return desiredOffset;
+        auto desiredOffset = inlineTextBox->logicalHeight() + gap + std::max(offset, 0.0f) + underlineOffset.lengthOr(0);
+        return std::max<float>(desiredOffset, fontMetrics.ascent());
     }
     }
 

Modified: trunk/Source/WebCore/style/InlineTextBoxStyle.h (238074 => 238075)


--- trunk/Source/WebCore/style/InlineTextBoxStyle.h	2018-11-11 08:27:32 UTC (rev 238074)
+++ trunk/Source/WebCore/style/InlineTextBoxStyle.h	2018-11-11 17:13:40 UTC (rev 238075)
@@ -51,6 +51,6 @@
 };
 WavyStrokeParameters getWavyStrokeParameters(float fontSize);
 GlyphOverflow visualOverflowForDecorations(const RenderStyle& lineStyle, const InlineTextBox*);
-int computeUnderlineOffset(TextUnderlinePosition, TextUnderlineOffset, const FontMetrics&, const InlineTextBox*, int textDecorationThickness);
+float computeUnderlineOffset(TextUnderlinePosition, TextUnderlineOffset, const FontMetrics&, const InlineTextBox*, float textDecorationThickness);
     
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to