<!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>[170875] 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/170875">170875</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2014-07-07 21:13:40 -0700 (Mon, 07 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Subpixel rendering: Inline box decoration rounds to integral.
https://bugs.webkit.org/show_bug.cgi?id=134523
&lt;rdar://problem/17530298&gt;

Reviewed by Darin Adler.

This patch removes 2 integral roundings from InlineFlowBox:
1. Border and padding sizes are implicitly integral truncated by the 'int' return type
   of borderLogicalLeft/Right()/paddingLogicalLeft/Right(). It results in losing
   fractional border/padding values.
2. Painting rectangle is explicitly rounded which pushes border and
   other decoration elements to odd device pixel positions on retina displays.
These values get pixel snapped right before calling in to GraphicsContext::*.

Source/WebCore:
Test: fast/inline/hidpi-inline-text-decoration-with-subpixel-value.html

* rendering/InlineBox.h:
(WebCore::InlineBox::frameRect):
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::nodeAtPoint):
(WebCore::InlineFlowBox::paintBoxDecorations):
(WebCore::InlineFlowBox::paintMask):
(WebCore::InlineFlowBox::roundedFrameRect): Deleted.
* rendering/InlineFlowBox.h:
(WebCore::InlineFlowBox::borderLogicalLeft):
(WebCore::InlineFlowBox::borderLogicalRight):
(WebCore::InlineFlowBox::paddingLogicalLeft):
(WebCore::InlineFlowBox::paddingLogicalRight):

LayoutTests:
* fast/inline/hidpi-inline-text-decoration-with-subpixel-value-expected.html: Added.
* fast/inline/hidpi-inline-text-decoration-with-subpixel-value.html: Added.
* platform/mac/css1/formatting_model/inline_elements-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmaccss1formatting_modelinline_elementsexpectedtxt">trunk/LayoutTests/platform/mac/css1/formatting_model/inline_elements-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineBoxh">trunk/Source/WebCore/rendering/InlineBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineFlowBoxcpp">trunk/Source/WebCore/rendering/InlineFlowBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineFlowBoxh">trunk/Source/WebCore/rendering/InlineFlowBox.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastinlinehidpiinlinetextdecorationwithsubpixelvalueexpectedhtml">trunk/LayoutTests/fast/inline/hidpi-inline-text-decoration-with-subpixel-value-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastinlinehidpiinlinetextdecorationwithsubpixelvaluehtml">trunk/LayoutTests/fast/inline/hidpi-inline-text-decoration-with-subpixel-value.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (170874 => 170875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-07-08 04:00:27 UTC (rev 170874)
+++ trunk/LayoutTests/ChangeLog        2014-07-08 04:13:40 UTC (rev 170875)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-07-07  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        Subpixel rendering: Inline box decoration rounds to integral.
+        https://bugs.webkit.org/show_bug.cgi?id=134523
+        &lt;rdar://problem/17530298&gt;
+
+        Reviewed by Darin Adler.
+
+        This patch removes 2 integral roundings from InlineFlowBox:
+        1. Border and padding sizes are implicitly integral truncated by the 'int' return type
+           of borderLogicalLeft/Right()/paddingLogicalLeft/Right(). It results in losing
+           fractional border/padding values.
+        2. Painting rectangle is explicitly rounded which pushes border and
+           other decoration elements to odd device pixel positions on retina displays.
+        These values get pixel snapped right before calling in to GraphicsContext::*.
+
+        * fast/inline/hidpi-inline-text-decoration-with-subpixel-value-expected.html: Added.
+        * fast/inline/hidpi-inline-text-decoration-with-subpixel-value.html: Added.
+        * platform/mac/css1/formatting_model/inline_elements-expected.txt:
+
</ins><span class="cx"> 2014-07-07  Hunseop Jeong  &lt;hs85.jeong@samsung.com&gt;
</span><span class="cx">         [EFL] gardening after r170864
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=134713
</span></span></pre></div>
<a id="trunkLayoutTestsfastinlinehidpiinlinetextdecorationwithsubpixelvalueexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/inline/hidpi-inline-text-decoration-with-subpixel-value-expected.html (0 => 170875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/inline/hidpi-inline-text-decoration-with-subpixel-value-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/inline/hidpi-inline-text-decoration-with-subpixel-value-expected.html        2014-07-08 04:13:40 UTC (rev 170875)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that inline border is positioned properly.&lt;/title&gt;
+&lt;style&gt;
+  div {
+    border: 0.5px solid blue;
+    position: absolute;
+    width: 26px;
+    height: 10px;
+  }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;script&gt;
+  for(i = 0; i &lt; 9; ++i) { 
+    for(j = 1; j &lt; 3; ++j) {    
+      var e = document.createElement(&quot;div&quot;);
+      e.style.left = j * 30 + &quot;px&quot;;
+      e.style.top = 36.5 + (30 * i) + &quot;px&quot;;
+      document.body.appendChild(e);
+    }
+  }
+
+  for(i = 0; i &lt; 9; ++i) { 
+    var e = document.createElement(&quot;div&quot;);
+    e.style.width = &quot;26.5px&quot;;
+    e.style.height = &quot;10px&quot;;
+    e.style.left = 3 * 30 + &quot;px&quot;;
+    e.style.top = 36.5 + (30 * i) + &quot;px&quot;;
+    document.body.appendChild(e);
+  }
+
+  for(i = 0; i &lt; 9; ++i) { 
+    var e = document.createElement(&quot;div&quot;);
+    e.style.width = &quot;26.5px&quot;;
+    e.style.height = &quot;11px&quot;;
+    e.style.left = 4 * 30 + &quot;px&quot;;
+    e.style.top = 36 + (30 * i) + &quot;px&quot;;
+    document.body.appendChild(e);
+  }
+
+  for(i = 0; i &lt; 9; ++i) { 
+    var e = document.createElement(&quot;div&quot;);
+    e.style.width = &quot;27px&quot;;
+    e.style.height = &quot;11px&quot;;
+    e.style.left = 5 * 30 + &quot;px&quot;;
+    e.style.top = 36 + (30 * i) + &quot;px&quot;;
+    document.body.appendChild(e);
+  }
+
+  for(i = 0; i &lt; 9; ++i) { 
+    for(j = 6; j &lt; 8; ++j) {    
+      var e = document.createElement(&quot;div&quot;);
+      e.style.left = j * 30 + &quot;px&quot;;
+      e.style.top = 36 + (30 * i) + &quot;px&quot;;
+      e.style.borderWidth = &quot;1px&quot;;
+      document.body.appendChild(e);
+    }
+  }
+
+  for(i = 0; i &lt; 9; ++i) { 
+    var e = document.createElement(&quot;div&quot;);
+    e.style.width = &quot;26.5px&quot;;
+    e.style.height = &quot;10px&quot;;
+    e.style.left = 8 * 30 + &quot;px&quot;;
+    e.style.top = 36 + (30 * i) + &quot;px&quot;;
+    e.style.borderWidth = &quot;1px&quot;;
+    document.body.appendChild(e);
+  }
+
+  for(i = 0; i &lt; 9; ++i) { 
+    var e = document.createElement(&quot;div&quot;);
+    e.style.width = &quot;26.5px&quot;;
+    e.style.height = &quot;11px&quot;;
+    e.style.left = 9 * 30 + &quot;px&quot;;
+    e.style.top = 35.5 + (30 * i) + &quot;px&quot;;
+    e.style.borderWidth = &quot;1px&quot;;
+    document.body.appendChild(e);
+  }
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastinlinehidpiinlinetextdecorationwithsubpixelvaluehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/inline/hidpi-inline-text-decoration-with-subpixel-value.html (0 => 170875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/inline/hidpi-inline-text-decoration-with-subpixel-value.html                                (rev 0)
+++ trunk/LayoutTests/fast/inline/hidpi-inline-text-decoration-with-subpixel-value.html        2014-07-08 04:13:40 UTC (rev 170875)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that inline border is positioned properly.&lt;/title&gt;
+&lt;style&gt;
+  div {
+    position: absolute;
+  }
+  
+  span {
+    font-family: 'Ahem';
+    font-size: 8px;
+    border: 0.5px solid blue;
+    color: white;
+    padding: 1px;
+  }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p id=&quot;container&quot;&gt;&lt;/p&gt;
+&lt;script&gt;
+  var container = document.getElementById(&quot;container&quot;);
+  for (i = 1; i &lt; 10; ++i) {
+    borderWidth = 0.5;
+    for (j = 1; j &lt; 10; ++j) {
+      var e = document.createElement(&quot;div&quot;);
+      e.style.top = (30 * i) + &quot;px&quot;;
+      e.style.left = (30 * j) + &quot;px&quot;;
+
+      var s = document.createElement(&quot;span&quot;);
+      s.style.borderWidth = borderWidth + &quot;px&quot;;
+      s.innerHTML = &quot;foo&quot;;
+
+      e.appendChild(s);
+      container.appendChild(e);
+      borderWidth += 0.1;
+    }
+  }
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmaccss1formatting_modelinline_elementsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/css1/formatting_model/inline_elements-expected.txt (170874 => 170875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/css1/formatting_model/inline_elements-expected.txt        2014-07-08 04:00:27 UTC (rev 170874)
+++ trunk/LayoutTests/platform/mac/css1/formatting_model/inline_elements-expected.txt        2014-07-08 04:13:40 UTC (rev 170875)
</span><span class="lines">@@ -25,9 +25,9 @@
</span><span class="cx">       RenderBlock {P} at (0,170) size 769x192
</span><span class="cx">         RenderText {#text} at (0,7) size 187x18
</span><span class="cx">           text run at (0,7) width 187: &quot;This is a paragraph that has a &quot;
</span><del>-        RenderInline {SPAN} at (0,0) size 761x172 [border: (10px solid #FF0000)]
-          RenderText {#text} at (239,7) size 761x146
-            text run at (239,7) width 522: &quot;very long span in it, and the span has a 10px red border separated from the span by&quot;
</del><ins>+        RenderInline {SPAN} at (0,0) size 762x172 [border: (10px solid #FF0000)]
+          RenderText {#text} at (239,7) size 762x146
+            text run at (239,7) width 523: &quot;very long span in it, and the span has a 10px red border separated from the span by&quot;
</ins><span class="cx">             text run at (0,39) width 167: &quot;2pt, and a margin of 30pt. &quot;
</span><span class="cx">             text run at (167,39) width 560: &quot;The padding and border should be present on all sides of the span (although vertical lines&quot;
</span><span class="cx">             text run at (0,71) width 539: &quot;should appear only at the beginning and the end of the whole span, not on each line). &quot;
</span><span class="lines">@@ -35,23 +35,23 @@
</span><span class="cx">             text run at (0,103) width 388: &quot;should all be noticeable at the beginning and end of the span. &quot;
</span><span class="cx">             text run at (388,103) width 366: &quot;However, the line height should not be changed by any of&quot;
</span><span class="cx">             text run at (0,135) width 585: &quot;them, so the margin should be unnoticeable and the border should overlap text on other lines.&quot;
</span><del>-        RenderText {#text} at (637,135) size 761x50
-          text run at (637,135) width 4: &quot; &quot;
-          text run at (641,135) width 120: &quot;The line spacing in&quot;
</del><ins>+        RenderText {#text} at (637,135) size 762x50
+          text run at (637,135) width 5: &quot; &quot;
+          text run at (641,135) width 121: &quot;The line spacing in&quot;
</ins><span class="cx">           text run at (0,167) width 336: &quot;the whole paragraph should be 200% of the font size.&quot;
</span><span class="cx">       RenderBlock {P} at (0,378) size 769x64
</span><span class="cx">         RenderText {#text} at (0,0) size 159x15
</span><span class="cx">           text run at (0,0) width 159: &quot;This is a paragraph that has a &quot;
</span><span class="cx">         RenderInline {SPAN} at (0,0) size 764x93 [border: (12px solid #FF0000)]
</span><span class="cx">           RenderText {#text} at (173,0) size 764x63
</span><del>-            text run at (173,0) width 552: &quot;very long span in it, and the span has a 12px red border separated from the span by 2pt of padding (the&quot;
</del><ins>+            text run at (173,0) width 553: &quot;very long span in it, and the span has a 12px red border separated from the span by 2pt of padding (the&quot;
</ins><span class="cx">             text run at (0,16) width 764: &quot;difference between the line-height and the font-size), which should overlap with the lines of text above and below the span, since the padding&quot;
</span><span class="cx">             text run at (0,32) width 240: &quot;and border should not effect the line height. &quot;
</span><span class="cx">             text run at (240,32) width 524: &quot;The span's border should have vertical lines only at the beginning and end of the whole span, not&quot;
</span><span class="cx">             text run at (0,48) width 69: &quot;on each line.&quot;
</span><del>-        RenderText {#text} at (83,48) size 415x15
-          text run at (83,48) width 3: &quot; &quot;
-          text run at (86,48) width 412: &quot;The line spacing in the whole paragraph should be 12pt, with font-size 10pt.&quot;
</del><ins>+        RenderText {#text} at (83,48) size 416x15
+          text run at (83,48) width 4: &quot; &quot;
+          text run at (86,48) width 413: &quot;The line spacing in the whole paragraph should be 12pt, with font-size 10pt.&quot;
</ins><span class="cx">       RenderTable {TABLE} at (0,455) size 769x309 [border: (1px outset #808080)]
</span><span class="cx">         RenderTableSection {TBODY} at (1,1) size 767x306
</span><span class="cx">           RenderTableRow {TR} at (0,0) size 767x26
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx">                   text run at (0,7) width 187: &quot;This is a paragraph that has a &quot;
</span><span class="cx">                 RenderInline {SPAN} at (0,0) size 747x172 [border: (10px solid #FF0000)]
</span><span class="cx">                   RenderText {#text} at (239,7) size 747x146
</span><del>-                    text run at (239,7) width 502: &quot;very long span in it, and the span has a 10px red border separated from the span&quot;
</del><ins>+                    text run at (239,7) width 503: &quot;very long span in it, and the span has a 10px red border separated from the span&quot;
</ins><span class="cx">                     text run at (0,39) width 187: &quot;by 2pt, and a margin of 30pt. &quot;
</span><span class="cx">                     text run at (187,39) width 560: &quot;The padding and border should be present on all sides of the span (although vertical lines&quot;
</span><span class="cx">                     text run at (0,71) width 539: &quot;should appear only at the beginning and the end of the whole span, not on each line). &quot;
</span><span class="lines">@@ -77,20 +77,20 @@
</span><span class="cx">                     text run at (0,103) width 388: &quot;should all be noticeable at the beginning and end of the span. &quot;
</span><span class="cx">                     text run at (388,103) width 349: &quot;However, the line height should not be changed by any&quot;
</span><span class="cx">                     text run at (0,135) width 602: &quot;of them, so the margin should be unnoticeable and the border should overlap text on other lines.&quot;
</span><del>-                RenderText {#text} at (654,135) size 710x50
-                  text run at (654,135) width 4: &quot; &quot;
-                  text run at (658,135) width 52: &quot;The line&quot;
</del><ins>+                RenderText {#text} at (654,135) size 711x50
+                  text run at (654,135) width 5: &quot; &quot;
+                  text run at (658,135) width 53: &quot;The line&quot;
</ins><span class="cx">                   text run at (0,167) width 404: &quot;spacing in the whole paragraph should be 200% of the font size.&quot;
</span><span class="cx">               RenderBlock {P} at (4,212) size 747x64
</span><span class="cx">                 RenderText {#text} at (0,0) size 159x15
</span><span class="cx">                   text run at (0,0) width 159: &quot;This is a paragraph that has a &quot;
</span><del>-                RenderInline {SPAN} at (0,0) size 725x93 [border: (12px solid #FF0000)]
-                  RenderText {#text} at (173,0) size 725x63
-                    text run at (173,0) width 552: &quot;very long span in it, and the span has a 12px red border separated from the span by 2pt of padding (the&quot;
</del><ins>+                RenderInline {SPAN} at (0,0) size 726x93 [border: (12px solid #FF0000)]
+                  RenderText {#text} at (173,0) size 726x63
+                    text run at (173,0) width 553: &quot;very long span in it, and the span has a 12px red border separated from the span by 2pt of padding (the&quot;
</ins><span class="cx">                     text run at (0,16) width 716: &quot;difference between the line-height and the font-size), which should overlap with the lines of text above and below the span, since the&quot;
</span><span class="cx">                     text run at (0,32) width 288: &quot;padding and border should not effect the line height. &quot;
</span><span class="cx">                     text run at (288,32) width 436: &quot;The span's border should have vertical lines only at the beginning and end of the&quot;
</span><span class="cx">                     text run at (0,48) width 157: &quot;whole span, not on each line.&quot;
</span><del>-                RenderText {#text} at (171,48) size 415x15
-                  text run at (171,48) width 3: &quot; &quot;
-                  text run at (174,48) width 412: &quot;The line spacing in the whole paragraph should be 12pt, with font-size 10pt.&quot;
</del><ins>+                RenderText {#text} at (171,48) size 416x15
+                  text run at (171,48) width 4: &quot; &quot;
+                  text run at (174,48) width 413: &quot;The line spacing in the whole paragraph should be 12pt, with font-size 10pt.&quot;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (170874 => 170875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-07-08 04:00:27 UTC (rev 170874)
+++ trunk/Source/WebCore/ChangeLog        2014-07-08 04:13:40 UTC (rev 170875)
</span><span class="lines">@@ -1,5 +1,36 @@
</span><span class="cx"> 2014-07-07  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Subpixel rendering: Inline box decoration rounds to integral.
+        https://bugs.webkit.org/show_bug.cgi?id=134523
+        &lt;rdar://problem/17530298&gt;
+
+        Reviewed by Darin Adler.
+
+        This patch removes 2 integral roundings from InlineFlowBox:
+        1. Border and padding sizes are implicitly integral truncated by the 'int' return type
+           of borderLogicalLeft/Right()/paddingLogicalLeft/Right(). It results in losing
+           fractional border/padding values.
+        2. Painting rectangle is explicitly rounded which pushes border and
+           other decoration elements to odd device pixel positions on retina displays.
+        These values get pixel snapped right before calling in to GraphicsContext::*.
+
+        Test: fast/inline/hidpi-inline-text-decoration-with-subpixel-value.html
+
+        * rendering/InlineBox.h:
+        (WebCore::InlineBox::frameRect):
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::nodeAtPoint):
+        (WebCore::InlineFlowBox::paintBoxDecorations):
+        (WebCore::InlineFlowBox::paintMask):
+        (WebCore::InlineFlowBox::roundedFrameRect): Deleted.
+        * rendering/InlineFlowBox.h:
+        (WebCore::InlineFlowBox::borderLogicalLeft):
+        (WebCore::InlineFlowBox::borderLogicalRight):
+        (WebCore::InlineFlowBox::paddingLogicalLeft):
+        (WebCore::InlineFlowBox::paddingLogicalRight):
+
+2014-07-07  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
</ins><span class="cx">         Pass RenderLayer reference instead of pointer to RenderLayer::paintingExtent().
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=134714
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineBox.h (170874 => 170875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineBox.h        2014-07-08 04:00:27 UTC (rev 170874)
+++ trunk/Source/WebCore/rendering/InlineBox.h        2014-07-08 04:13:40 UTC (rev 170875)
</span><span class="lines">@@ -210,6 +210,7 @@
</span><span class="cx">     float logicalHeight() const;
</span><span class="cx"> 
</span><span class="cx">     FloatRect logicalFrameRect() const { return isHorizontal() ? FloatRect(m_topLeft.x(), m_topLeft.y(), m_logicalWidth, logicalHeight()) : FloatRect(m_topLeft.y(), m_topLeft.x(), m_logicalWidth, logicalHeight()); }
</span><ins>+    FloatRect frameRect() const { return FloatRect(topLeft(), size()); }
</ins><span class="cx"> 
</span><span class="cx">     virtual int baselinePosition(FontBaseline baselineType) const;
</span><span class="cx">     virtual LayoutUnit lineHeight() const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineFlowBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (170874 => 170875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp        2014-07-08 04:00:27 UTC (rev 170874)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp        2014-07-08 04:13:40 UTC (rev 170875)
</span><span class="lines">@@ -78,18 +78,6 @@
</span><span class="cx">     return totWidth;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IntRect InlineFlowBox::roundedFrameRect() const
-{
-    // Begin by snapping the x and y coordinates to the nearest pixel.
-    int snappedX = lroundf(x());
-    int snappedY = lroundf(y());
-    
-    int snappedMaxX = lroundf(x() + width());
-    int snappedMaxY = lroundf(y() + height());
-    
-    return IntRect(snappedX, snappedY, snappedMaxX - snappedX, snappedMaxY - snappedY);
-}
-
</del><span class="cx"> static void setHasTextDescendantsOnAncestors(InlineFlowBox* box)
</span><span class="cx"> {
</span><span class="cx">     while (box &amp;&amp; !box-&gt;hasTextDescendants()) {
</span><span class="lines">@@ -1061,7 +1049,7 @@
</span><span class="cx">     // Do not hittest content beyond the ellipsis box.
</span><span class="cx">     if (isRootInlineBox() &amp;&amp; hasEllipsisBox()) {
</span><span class="cx">         const EllipsisBox* ellipsisBox = root().ellipsisBox();
</span><del>-        LayoutRect boundsRect(roundedFrameRect());
</del><ins>+        FloatRect boundsRect(frameRect());
</ins><span class="cx"> 
</span><span class="cx">         if (isHorizontal())
</span><span class="cx">             renderer().style().isLeftToRightDirection() ? boundsRect.shiftXEdgeTo(ellipsisBox-&gt;right()) : boundsRect.setWidth(ellipsisBox-&gt;left() - left());
</span><span class="lines">@@ -1075,25 +1063,19 @@
</span><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    LayoutRect frameRect = roundedFrameRect();
-    LayoutUnit minX = frameRect.x();
-    LayoutUnit minY = frameRect.y();
-    LayoutUnit width = frameRect.width();
-    LayoutUnit height = frameRect.height();
-
</del><span class="cx">     // Constrain our hit testing to the line top and bottom if necessary.
</span><span class="cx">     bool noQuirksMode = renderer().document().inNoQuirksMode();
</span><span class="cx">     if (!noQuirksMode &amp;&amp; !hasTextChildren() &amp;&amp; !(descendantsHaveSameLineHeightAndBaseline() &amp;&amp; hasTextDescendants())) {
</span><span class="cx">         RootInlineBox&amp; rootBox = root();
</span><del>-        LayoutUnit&amp; top = isHorizontal() ? minY : minX;
-        LayoutUnit&amp; logicalHeight = isHorizontal() ? height : width;
</del><ins>+        LayoutUnit top = isHorizontal() ? y() : x();
+        LayoutUnit logicalHeight = isHorizontal() ? height() : width();
</ins><span class="cx">         LayoutUnit bottom = std::min(rootBox.lineBottom(), top + logicalHeight);
</span><span class="cx">         top = std::max(rootBox.lineTop(), top);
</span><span class="cx">         logicalHeight = bottom - top;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Move x/y to our coordinates.
</span><del>-    LayoutRect rect(minX, minY, width, height);
</del><ins>+    FloatRect rect(frameRect());
</ins><span class="cx">     flipForWritingMode(rect);
</span><span class="cx">     rect.moveBy(accumulatedOffset);
</span><span class="cx"> 
</span><span class="lines">@@ -1302,9 +1284,7 @@
</span><span class="cx">     if (!paintInfo.shouldPaintWithinRoot(renderer()) || renderer().style().visibility() != VISIBLE || paintInfo.phase != PaintPhaseForeground)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // Pixel snap background/border painting.
-    LayoutRect frameRect = roundedFrameRect();
-
</del><ins>+    LayoutRect frameRect(this-&gt;frameRect());
</ins><span class="cx">     constrainToLineTopAndBottomIfNeeded(frameRect);
</span><span class="cx">     
</span><span class="cx">     // Move x/y to our coordinates.
</span><span class="lines">@@ -1376,9 +1356,7 @@
</span><span class="cx">     if (!paintInfo.shouldPaintWithinRoot(renderer()) || renderer().style().visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // Pixel snap mask painting.
-    LayoutRect frameRect = roundedFrameRect();
-
</del><ins>+    LayoutRect frameRect(this-&gt;frameRect());
</ins><span class="cx">     constrainToLineTopAndBottomIfNeeded(frameRect);
</span><span class="cx">     
</span><span class="cx">     // Move x/y to our coordinates.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineFlowBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (170874 => 170875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineFlowBox.h        2014-07-08 04:00:27 UTC (rev 170874)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h        2014-07-08 04:13:40 UTC (rev 170875)
</span><span class="lines">@@ -113,8 +113,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void clearTruncation() override;
</span><span class="cx"> 
</span><del>-    IntRect roundedFrameRect() const;
-    
</del><span class="cx">     void paintBoxDecorations(PaintInfo&amp;, const LayoutPoint&amp;);
</span><span class="cx">     void paintMask(PaintInfo&amp;, const LayoutPoint&amp;);
</span><span class="cx">     void paintFillLayers(const PaintInfo&amp;, const Color&amp;, const FillLayer*, const LayoutRect&amp;, CompositeOperator = CompositeSourceOver);
</span><span class="lines">@@ -140,25 +138,25 @@
</span><span class="cx">             return 0;
</span><span class="cx">         return isHorizontal() ? renderer().marginRight() : renderer().marginBottom();
</span><span class="cx">     }
</span><del>-    int borderLogicalLeft() const
</del><ins>+    float borderLogicalLeft() const
</ins><span class="cx">     {
</span><span class="cx">         if (!includeLogicalLeftEdge())
</span><span class="cx">             return 0;
</span><span class="cx">         return isHorizontal() ? lineStyle().borderLeftWidth() : lineStyle().borderTopWidth();
</span><span class="cx">     }
</span><del>-    int borderLogicalRight() const
</del><ins>+    float borderLogicalRight() const
</ins><span class="cx">     {
</span><span class="cx">         if (!includeLogicalRightEdge())
</span><span class="cx">             return 0;
</span><span class="cx">         return isHorizontal() ? lineStyle().borderRightWidth() : lineStyle().borderBottomWidth();
</span><span class="cx">     }
</span><del>-    int paddingLogicalLeft() const
</del><ins>+    float paddingLogicalLeft() const
</ins><span class="cx">     {
</span><span class="cx">         if (!includeLogicalLeftEdge())
</span><span class="cx">             return 0;
</span><span class="cx">         return isHorizontal() ? renderer().paddingLeft() : renderer().paddingTop();
</span><span class="cx">     }
</span><del>-    int paddingLogicalRight() const
</del><ins>+    float paddingLogicalRight() const
</ins><span class="cx">     {
</span><span class="cx">         if (!includeLogicalRightEdge())
</span><span class="cx">             return 0;
</span></span></pre>
</div>
</div>

</body>
</html>