<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[194465] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/194465">194465</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2015-12-31 11:57:25 -0800 (Thu, 31 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>text-decoration: line-through is mispositioned when text has overline/underline too.
https://bugs.webkit.org/show_bug.cgi?id=152619

Reviewed by Simon Fraser.

Line-through painting was mistakenly calling drawLineForText with overline/underline positioning.

Source/WebCore:

Test: fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned.html

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintDecoration): Deleted.
* rendering/TextDecorationPainter.cpp:
(WebCore::TextDecorationPainter::paintTextDecoration):

LayoutTests:

* fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html: Added.
* fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineTextBoxcpp">trunk/Source/WebCore/rendering/InlineTextBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingTextDecorationPaintercpp">trunk/Source/WebCore/rendering/TextDecorationPainter.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcss3textcss3textdecorationtextdecorationlinethroughmispositionedexpectedhtml">trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastcss3textcss3textdecorationtextdecorationlinethroughmispositionedhtml">trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (194464 => 194465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-12-31 19:53:21 UTC (rev 194464)
+++ trunk/LayoutTests/ChangeLog        2015-12-31 19:57:25 UTC (rev 194465)
</span><span class="lines">@@ -1,5 +1,17 @@
</span><span class="cx"> 2015-12-31  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        text-decoration: line-through is mispositioned when text has overline/underline too.
+        https://bugs.webkit.org/show_bug.cgi?id=152619
+
+        Reviewed by Simon Fraser.
+
+        Line-through painting was mistakenly calling drawLineForText with overline/underline positioning.
+
+        * fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html: Added.
+        * fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned.html: Added.
+
+2015-12-31  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
</ins><span class="cx">         Simple line layout: Text with stroke width is not positioned correctly.
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=152614
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsfastcss3textcss3textdecorationtextdecorationlinethroughmispositionedexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html (0 => 194465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned-expected.html        2015-12-31 19:57:25 UTC (rev 194465)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that line-through is positioned properly.&lt;/title&gt;
+&lt;style&gt;
+  div {
+    border-top: 3px solid green;
+    position: absolute;
+    left: 20px;
+    top: 33px;
+    width: 120px;
+    height: 1px;
+  }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcss3textcss3textdecorationtextdecorationlinethroughmispositionedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned.html (0 => 194465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned.html                                (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned.html        2015-12-31 19:57:25 UTC (rev 194465)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that line-through is positioned properly.&lt;/title&gt;
+&lt;style&gt;
+  body {
+          font-family: Ahem; 
+          font-size: 48px;
+          color: white;
+  } 
+  #blue-underline {
+    text-decoration: underline;
+    -webkit-text-decoration-color: white;
+  }

+  #green-line-through {
+    text-decoration: line-through;
+    -webkit-text-decoration-color: green;
+  }
+  
+  div {
+          position: relative;
+          top: 0px;
+          left: 0px;
+  }
+  
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;blue-underline&quot;&gt;
+  &lt;div id=&quot;green-line-through&quot;&gt;foo&lt;/div&gt;
+&lt;/div&gt;
+&lt;div style=&quot;position: absolute; left: 0px; top: 20px; width: 20px; height: 20px; background-color: white&quot;&gt;&lt;/div&gt;
+&lt;div style=&quot;position: absolute; left: 140px; top: 20px; width: 20px; height: 20px; background-color: white&quot;&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (194464 => 194465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-12-31 19:53:21 UTC (rev 194464)
+++ trunk/Source/WebCore/ChangeLog        2015-12-31 19:57:25 UTC (rev 194465)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-12-31  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        text-decoration: line-through is mispositioned when text has overline/underline too.
+        https://bugs.webkit.org/show_bug.cgi?id=152619
+
+        Reviewed by Simon Fraser.
+
+        Line-through painting was mistakenly calling drawLineForText with overline/underline positioning.
+
+        Test: fast/css3-text/css3-text-decoration/text-decoration-line-through-mispositioned.html
+
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paintDecoration): Deleted.
+        * rendering/TextDecorationPainter.cpp:
+        (WebCore::TextDecorationPainter::paintTextDecoration):
+
</ins><span class="cx"> 2015-12-31  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Clarify that scrollPositionChangedViaPlatformWidget takes offsets
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineTextBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (194464 => 194465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineTextBox.cpp        2015-12-31 19:53:21 UTC (rev 194464)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp        2015-12-31 19:57:25 UTC (rev 194465)
</span><span class="lines">@@ -702,11 +702,6 @@
</span><span class="cx"> void InlineTextBox::paintDecoration(GraphicsContext&amp; context, const FontCascade&amp; font, const TextRun&amp; textRun, const FloatPoint&amp; textOrigin, const FloatPoint&amp; boxOrigin,
</span><span class="cx">     TextDecoration decoration, const ShadowData* shadow)
</span><span class="cx"> {
</span><del>-#if !ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
-    UNUSED_PARAM(font);
-    UNUSED_PARAM(textRun);
-    UNUSED_PARAM(textOrigin);
-#endif
</del><span class="cx">     if (m_truncation == cFullTruncation)
</span><span class="cx">         return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingTextDecorationPaintercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/TextDecorationPainter.cpp (194464 => 194465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/TextDecorationPainter.cpp        2015-12-31 19:53:21 UTC (rev 194464)
+++ trunk/Source/WebCore/rendering/TextDecorationPainter.cpp        2015-12-31 19:57:25 UTC (rev 194465)
</span><span class="lines">@@ -255,19 +255,23 @@
</span><span class="cx"> 
</span><span class="cx"> void TextDecorationPainter::paintTextDecoration(const TextRun&amp; textRun, const FloatPoint&amp; textOrigin, const FloatPoint&amp; boxOrigin)
</span><span class="cx"> {
</span><ins>+#if !ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
+    UNUSED_PARAM(textRun);
+    UNUSED_PARAM(textOrigin);
+#endif
</ins><span class="cx">     ASSERT(m_font);
</span><span class="cx">     float textDecorationThickness = textDecorationStrokeThickness(m_lineStyle.fontSize());
</span><span class="cx">     m_context.setStrokeThickness(textDecorationThickness);
</span><span class="cx">     FloatPoint localOrigin = boxOrigin;
</span><span class="cx"> 
</span><del>-    auto paintDecoration = [&amp;](TextDecorationStyle style, Color color, StrokeStyle strokeStyle,
</del><ins>+    auto paintDecoration = [&amp;](TextDecoration decoration, TextDecorationStyle style, Color color, StrokeStyle strokeStyle,
</ins><span class="cx">         const FloatPoint&amp; start, const FloatPoint&amp; end, int offset) {
</span><span class="cx">         m_context.setStrokeColor(color);
</span><span class="cx">         m_context.setStrokeStyle(strokeStyle);
</span><span class="cx"> 
</span><span class="cx">         if (style == TextDecorationStyleWavy) {
</span><span class="cx">             strokeWavyTextDecoration(m_context, start, end, textDecorationThickness);
</span><del>-        } else if (m_decoration &amp; TextDecorationUnderline || m_decoration &amp; TextDecorationOverline) {
</del><ins>+        } else if (decoration == TextDecorationUnderline || decoration == TextDecorationOverline) {
</ins><span class="cx"> #if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
</span><span class="cx">             if ((m_lineStyle.textDecorationSkip() == TextDecorationSkipInk || m_lineStyle.textDecorationSkip() == TextDecorationSkipAuto) &amp;&amp; m_isHorizontal) {
</span><span class="cx">                 if (!m_context.paintingDisabled())
</span><span class="lines">@@ -278,7 +282,7 @@
</span><span class="cx">                 m_context.drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + offset), m_width, m_isPrinting, style == TextDecorationStyleDouble);
</span><span class="cx">             
</span><span class="cx">         } else {
</span><del>-            ASSERT(m_decoration &amp; TextDecorationLineThrough);
</del><ins>+            ASSERT(decoration == TextDecorationLineThrough);
</ins><span class="cx">             m_context.drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + 2 * m_baseline / 3), m_width, m_isPrinting, style == TextDecorationStyleDouble);
</span><span class="cx">         }
</span><span class="cx">     };
</span><span class="lines">@@ -327,17 +331,17 @@
</span><span class="cx">             const int offset = computeUnderlineOffset(m_lineStyle.textUnderlinePosition(), m_lineStyle.fontMetrics(), m_inlineTextBox, textDecorationThickness);
</span><span class="cx">             FloatPoint start(localOrigin.x(), localOrigin.y() + offset + m_wavyOffset);
</span><span class="cx">             FloatPoint end(localOrigin.x() + m_width, localOrigin.y() + offset + m_wavyOffset);
</span><del>-            paintDecoration(m_underlineStyle, m_underlineColor, textDecorationStyleToStrokeStyle(m_underlineStyle), start, end, offset);
</del><ins>+            paintDecoration(TextDecorationUnderline, m_underlineStyle, m_underlineColor, textDecorationStyleToStrokeStyle(m_underlineStyle), start, end, offset);
</ins><span class="cx">         }
</span><span class="cx">         if (m_decoration &amp; TextDecorationOverline) {
</span><span class="cx">             FloatPoint start(localOrigin.x(), localOrigin.y() - m_wavyOffset);
</span><span class="cx">             FloatPoint end(localOrigin.x() + m_width, localOrigin.y() - m_wavyOffset);
</span><del>-            paintDecoration(m_overlineStyle, m_overlineColor, textDecorationStyleToStrokeStyle(m_overlineStyle), start, end, 0);
</del><ins>+            paintDecoration(TextDecorationOverline, m_overlineStyle, m_overlineColor, textDecorationStyleToStrokeStyle(m_overlineStyle), start, end, 0);
</ins><span class="cx">         }
</span><span class="cx">         if (m_decoration &amp; TextDecorationLineThrough) {
</span><span class="cx">             FloatPoint start(localOrigin.x(), localOrigin.y() + 2 * m_baseline / 3);
</span><span class="cx">             FloatPoint end(localOrigin.x() + m_width, localOrigin.y() + 2 * m_baseline / 3);
</span><del>-            paintDecoration(m_linethroughStyle, m_linethroughColor, textDecorationStyleToStrokeStyle(m_linethroughStyle), start, end, 0);
</del><ins>+            paintDecoration(TextDecorationLineThrough, m_linethroughStyle, m_linethroughColor, textDecorationStyleToStrokeStyle(m_linethroughStyle), start, end, 0);
</ins><span class="cx">         }
</span><span class="cx">     } while (shadow);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>