Title: [205519] trunk
Revision
205519
Author
mmaxfi...@apple.com
Date
2016-09-06 16:12:15 -0700 (Tue, 06 Sep 2016)

Log Message

Strikethrough positions are erroneously snapped twice
https://bugs.webkit.org/show_bug.cgi?id=161647
<rdar://problem/11542470>

Reviewed by Zalan Bujtas.

Source/WebCore:

Because we're using an int for the position of the baseline, the math to calculate the
strikethrough position is snapped. Then, we snap it again inside GraphicsContext.

Test: fast/text/strikethrough-int.html

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintDecoration):
* rendering/TextDecorationPainter.h:
(WebCore::TextDecorationPainter::setBaseline):

LayoutTests:

* fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html: Updated.
* fast/text/strikethrough-int-expected-mismatch.html: Added.
* fast/text/strikethrough-int.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (205518 => 205519)


--- trunk/LayoutTests/ChangeLog	2016-09-06 23:06:54 UTC (rev 205518)
+++ trunk/LayoutTests/ChangeLog	2016-09-06 23:12:15 UTC (rev 205519)
@@ -1,3 +1,15 @@
+2016-09-06  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Strikethrough positions are erroneously snapped twice
+        https://bugs.webkit.org/show_bug.cgi?id=161647
+        <rdar://problem/11542470>
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html: Updated.
+        * fast/text/strikethrough-int-expected-mismatch.html: Added.
+        * fast/text/strikethrough-int.html: Added.
+
 2016-09-06  Chris Dumez  <cdu...@apple.com>
 
         Align srcset attribute parsing with the HTML specification

Modified: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html (205518 => 205519)


--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html	2016-09-06 23:06:54 UTC (rev 205518)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html	2016-09-06 23:12:15 UTC (rev 205519)
@@ -7,7 +7,7 @@
     border-top: 3px solid green;
     position: absolute;
     left: 20px;
-    top: 33px;
+    top: 34px;
     width: 120px;
     height: 1px;
   }

Added: trunk/LayoutTests/fast/text/strikethrough-int-expected-mismatch.html (0 => 205519)


--- trunk/LayoutTests/fast/text/strikethrough-int-expected-mismatch.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/strikethrough-int-expected-mismatch.html	2016-09-06 23:12:15 UTC (rev 205519)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="overflow: hidden; width: 400px; height: 400px;">
+<div style="font-family: 'Ahem'; display: inline-block; transform: scale(500) translateY(-128px); transform-origin: left top;">
+<span style="font-size: 241px; text-decoration: line-through;">p</span>
+</div>
+</div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/text/strikethrough-int.html (0 => 205519)


--- trunk/LayoutTests/fast/text/strikethrough-int.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/strikethrough-int.html	2016-09-06 23:12:15 UTC (rev 205519)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="overflow: hidden; width: 400px; height: 400px;">
+<div style="font-family: 'Ahem'; display: inline-block; transform: scale(500) translateY(-128px); transform-origin: left top;">
+<span style="font-size: 240px; text-decoration: line-through; position: relative; top: -1px;">p</span>
+</div>
+</div>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (205518 => 205519)


--- trunk/Source/WebCore/ChangeLog	2016-09-06 23:06:54 UTC (rev 205518)
+++ trunk/Source/WebCore/ChangeLog	2016-09-06 23:12:15 UTC (rev 205519)
@@ -1,3 +1,21 @@
+2016-09-06  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Strikethrough positions are erroneously snapped twice
+        https://bugs.webkit.org/show_bug.cgi?id=161647
+        <rdar://problem/11542470>
+
+        Reviewed by Zalan Bujtas.
+
+        Because we're using an int for the position of the baseline, the math to calculate the
+        strikethrough position is snapped. Then, we snap it again inside GraphicsContext.
+
+        Test: fast/text/strikethrough-int.html
+
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paintDecoration):
+        * rendering/TextDecorationPainter.h:
+        (WebCore::TextDecorationPainter::setBaseline):
+
 2016-09-06  David Kilzer  <ddkil...@apple.com>
 
         [iOS] Remove soft linking of MobileCoreServices.framework

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (205518 => 205519)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2016-09-06 23:06:54 UTC (rev 205518)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2016-09-06 23:12:15 UTC (rev 205519)
@@ -715,13 +715,12 @@
         width = renderer().width(m_start, m_truncation, textPos(), isFirstLine());
         mirrorRTLSegment(m_logicalWidth, direction(), start, width);
     }
-    
-    int baseline = lineStyle().fontMetrics().ascent();
+
     TextDecorationPainter decorationPainter(context, decoration, renderer(), isFirstLine());
     decorationPainter.setInlineTextBox(this);
     decorationPainter.setFont(font);
     decorationPainter.setWidth(width);
-    decorationPainter.setBaseline(baseline);
+    decorationPainter.setBaseline(lineStyle().fontMetrics().ascent());
     decorationPainter.setIsHorizontal(isHorizontal());
     decorationPainter.addTextShadow(shadow);
 

Modified: trunk/Source/WebCore/rendering/TextDecorationPainter.h (205518 => 205519)


--- trunk/Source/WebCore/rendering/TextDecorationPainter.h	2016-09-06 23:06:54 UTC (rev 205518)
+++ trunk/Source/WebCore/rendering/TextDecorationPainter.h	2016-09-06 23:12:15 UTC (rev 205519)
@@ -45,7 +45,7 @@
     void setFont(const FontCascade& font) { m_font = &font; }
     void setIsHorizontal(bool isHorizontal) { m_isHorizontal = isHorizontal; }
     void setWidth(float width) { m_width = width; }
-    void setBaseline(int baseline) { m_baseline = baseline; }
+    void setBaseline(float baseline) { m_baseline = baseline; }
     void addTextShadow(const ShadowData* textShadow) { m_shadow = textShadow; }
 
     void paintTextDecoration(const TextRun&, const FloatPoint& textOrigin, const FloatPoint& boxOrigin);
@@ -56,7 +56,7 @@
     int m_wavyOffset { 0 };
     bool m_isPrinting { false };
     float m_width { 0 };
-    int m_baseline { 0 };
+    float m_baseline { 0 };
     FloatPoint m_boxOrigin;
     bool m_isHorizontal { true };
     const ShadowData* m_shadow { nullptr };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to