<!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>[166060] 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/166060">166060</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2014-03-21 06:55:40 -0700 (Fri, 21 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Subpixel rendering: RenderBox is positioned off by one when non-compositing transform is present.
https://bugs.webkit.org/show_bug.cgi?id=130430

Reviewed by Simon Fraser.

div {
    position: absolute;
     top: 10.25px;
     left: 10.25px;
 }

 The &lt;div&gt; with (10.25px, 10.25px) is painted to (10.5px, 10.5px) after device pixel snapping on 2x display.
 Moving &lt;div&gt; to its own RenderLayer should not change the painting position.

 div {
     position: absolute;
     top: 10.25px;
     left: 10.25px;
     -webkit-transform: rotate(0deg);
 }

When we paint the RenderLayer's content, the graphics context is translated by the rounded value of
renderer's offset from parent.

    (10.25px,10.25px) -&gt; rounded to (10.5px,10.5px).

When the translate moves the graphics context's origin over the renderer's top-left position,
the renderer's relative top-left coordinates end up being negative.

    Graphics context translated by (10.5px,10.5px) -&gt; pushes renderer's relative top-left coords to (-0.25px,-0.25px)

When we round (pixel snap) these negative coordinates, half-way values get translated to the wrong direction.

(relative coords (-0.25px,-0.25px) -&gt; pixel snapped to (-0.5px,-0.5px) -&gt; final absolute(painting) coords (10px,10px))

This patch changes the rounding to flooring to ensure that the relative top-left position never gets negative as the result
of subpixel shifting.

Source/WebCore:

Tests: compositing/hidpi-box-positioned-off-by-one-when-non-compositing-transform-is-present.html
       fast/layers/hidpi-box-positioned-off-by-one-when-transform-is-present.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::computedTransform):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateTransform):
(WebCore::RenderLayer::currentTransform):
(WebCore::RenderLayer::paintLayerByApplyingTransform):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateTransform):
* rendering/style/RenderStyle.cpp:
* rendering/style/RenderStyle.h:
* svg/SVGTextElement.cpp:
(WebCore::SVGTextElement::animatedLocalTransform):

LayoutTests:

* TestExpectations:
* compositing/hidpi-box-positioned-off-by-one-when-non-compositing-transform-is-present-expected.html: Added.
* compositing/hidpi-box-positioned-off-by-one-when-non-compositing-transform-is-present.html: Added.
* fast/layers/hidpi-box-positioned-off-by-one-when-transform-is-present-expected.html: Added.
* fast/layers/hidpi-box-positioned-off-by-one-when-transform-is-present.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSComputedStyleDeclarationcpp">trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerBackingcpp">trunk/Source/WebCore/rendering/RenderLayerBacking.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStylecpp">trunk/Source/WebCore/rendering/style/RenderStyle.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStyleh">trunk/Source/WebCore/rendering/style/RenderStyle.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGTextElementcpp">trunk/Source/WebCore/svg/SVGTextElement.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscompositinghidpiboxpositionedoffbyonewhennoncompositingtransformispresentexpectedhtml">trunk/LayoutTests/compositing/hidpi-box-positioned-off-by-one-when-non-compositing-transform-is-present-expected.html</a></li>
<li><a href="#trunkLayoutTestscompositinghidpiboxpositionedoffbyonewhennoncompositingtransformispresenthtml">trunk/LayoutTests/compositing/hidpi-box-positioned-off-by-one-when-non-compositing-transform-is-present.html</a></li>
<li><a href="#trunkLayoutTestsfastlayershidpiboxpositionedoffbyonewhentransformispresentexpectedhtml">trunk/LayoutTests/fast/layers/hidpi-box-positioned-off-by-one-when-transform-is-present-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastlayershidpiboxpositionedoffbyonewhentransformispresenthtml">trunk/LayoutTests/fast/layers/hidpi-box-positioned-off-by-one-when-transform-is-present.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (166059 => 166060)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-03-21 13:01:56 UTC (rev 166059)
+++ trunk/LayoutTests/ChangeLog        2014-03-21 13:55:40 UTC (rev 166060)
</span><span class="lines">@@ -1,3 +1,49 @@
</span><ins>+2014-03-21  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        Subpixel rendering: RenderBox is positioned off by one when non-compositing transform is present.
+        https://bugs.webkit.org/show_bug.cgi?id=130430
+
+        Reviewed by Simon Fraser.
+
+        div {
+            position: absolute;
+             top: 10.25px;
+             left: 10.25px;
+         }
+
+         The &lt;div&gt; with (10.25px, 10.25px) is painted to (10.5px, 10.5px) after device pixel snapping on 2x display.
+         Moving &lt;div&gt; to its own RenderLayer should not change the painting position.
+
+         div {
+             position: absolute;
+             top: 10.25px;
+             left: 10.25px;
+             -webkit-transform: rotate(0deg);
+         }
+
+        When we paint the RenderLayer's content, the graphics context is translated by the rounded value of
+        renderer's offset from parent.
+
+            (10.25px,10.25px) -&gt; rounded to (10.5px,10.5px).
+
+        When the translate moves the graphics context's origin over the renderer's top-left position,
+        the renderer's relative top-left coordinates end up being negative.
+
+            Graphics context translated by (10.5px,10.5px) -&gt; pushes renderer's relative top-left coords to (-0.25px,-0.25px)
+
+        When we round (pixel snap) these negative coordinates, half-way values get translated to the wrong direction.
+
+        (relative coords (-0.25px,-0.25px) -&gt; pixel snapped to (-0.5px,-0.5px) -&gt; final absolute(painting) coords (10px,10px))
+
+        This patch changes the rounding to flooring to ensure that the relative top-left position never gets negative as the result
+        of subpixel shifting.
+
+        * TestExpectations:
+        * compositing/hidpi-box-positioned-off-by-one-when-non-compositing-transform-is-present-expected.html: Added.
+        * compositing/hidpi-box-positioned-off-by-one-when-non-compositing-transform-is-present.html: Added.
+        * fast/layers/hidpi-box-positioned-off-by-one-when-transform-is-present-expected.html: Added.
+        * fast/layers/hidpi-box-positioned-off-by-one-when-transform-is-present.html: Added.
+
</ins><span class="cx"> 2014-03-19  Frédéric Wang  &lt;fred.wang@free.fr&gt;
</span><span class="cx"> 
</span><span class="cx">         Update some references for MathML pixels tests
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (166059 => 166060)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2014-03-21 13:01:56 UTC (rev 166059)
+++ trunk/LayoutTests/TestExpectations        2014-03-21 13:55:40 UTC (rev 166060)
</span><span class="lines">@@ -88,6 +88,8 @@
</span><span class="cx"> #subpixel failure on non-retina displays.
</span><span class="cx"> webkit.org/b/129050 fast/sub-pixel/compositing-layers-on-subpixel-position.html [ ImageOnlyFailure ]
</span><span class="cx"> webkit.org/b/129113 fast/multicol/newmulticol/clipping.html [ ImageOnlyFailure ]
</span><ins>+#subpixel rotation
+webkit.org/b/130556 compositing/hidpi-absolute-subpixel-positioned-transformed-elements.html [ ImageOnlyFailure ]
</ins><span class="cx"> 
</span><span class="cx"> webkit.org/b/129327 inspector-protocol/indexeddb/basics.html [ Pass Failure ]
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestscompositinghidpiboxpositionedoffbyonewhennoncompositingtransformispresentexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/hidpi-box-positioned-off-by-one-when-non-compositing-transform-is-present-expected.html (0 => 166060)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/hidpi-box-positioned-off-by-one-when-non-compositing-transform-is-present-expected.html                                (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-box-positioned-off-by-one-when-non-compositing-transform-is-present-expected.html        2014-03-21 13:55:40 UTC (rev 166060)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests if flooring the transformed boxes' coordinates produce the same result as if compositing transform is present.&lt;/title&gt;
+&lt;head&gt;
+&lt;style&gt;
+  div {
+    background: green;
+    width: 5px;
+    height: 5px;
+    position: absolute;
+    -webkit-transform: rotate3D(0, 0, 0, 0deg);
+  }
+&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 = 0; i &lt; 40; ++i) {
+    adjustment = 0.25;
+    for (j = 0; j &lt; 40; ++j) {
+      var e = document.createElement(&quot;div&quot;);
+      e.style.top = (i * 5 + adjustment) +  &quot;px&quot;;
+      e.style.left = ( j * 5 + adjustment) + &quot;px&quot;;
+      container.appendChild(e);
+      adjustment+=0.05;
+    }
+  }
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscompositinghidpiboxpositionedoffbyonewhennoncompositingtransformispresenthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/hidpi-box-positioned-off-by-one-when-non-compositing-transform-is-present.html (0 => 166060)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/hidpi-box-positioned-off-by-one-when-non-compositing-transform-is-present.html                                (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-box-positioned-off-by-one-when-non-compositing-transform-is-present.html        2014-03-21 13:55:40 UTC (rev 166060)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests if flooring the transformed boxes' coordinates produce the same result as if compositing transform is present.&lt;/title&gt;
+&lt;head&gt;
+&lt;style&gt;
+  div {
+    background: green;
+    width: 5px;
+    height: 5px;
+    position: absolute;
+    -webkit-transform: rotate(0deg);
+  }
+&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 = 0; i &lt; 40; ++i) {
+    adjustment = 0.25;
+    for (j = 0; j &lt; 40; ++j) {
+      var e = document.createElement(&quot;div&quot;);
+      e.style.top = (i * 5 + adjustment) +  &quot;px&quot;;
+      e.style.left = ( j * 5 + adjustment) + &quot;px&quot;;
+      container.appendChild(e);
+      adjustment+=0.05;
+    }
+  }
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastlayershidpiboxpositionedoffbyonewhentransformispresentexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/layers/hidpi-box-positioned-off-by-one-when-transform-is-present-expected.html (0 => 166060)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/layers/hidpi-box-positioned-off-by-one-when-transform-is-present-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/layers/hidpi-box-positioned-off-by-one-when-transform-is-present-expected.html        2014-03-21 13:55:40 UTC (rev 166060)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests if flooring the transformed boxes' coordinates produce the same result as if there was no transform present.&lt;/title&gt;
+&lt;head&gt;
+&lt;style&gt;
+  div {
+    background: green;
+    width: 50px;
+    height: 200px;
+    position: absolute;
+  }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div style=&quot;left: 0.5px; top: 0.5px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;left: 51px; top: 1px;&quot;&gt;&lt;/div&gt;
+&lt;div style=&quot;left: 101.5px; top: 1.5px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;left: 152px; top: 2px;&quot;&gt;&lt;/div&gt;
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastlayershidpiboxpositionedoffbyonewhentransformispresenthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/layers/hidpi-box-positioned-off-by-one-when-transform-is-present.html (0 => 166060)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/layers/hidpi-box-positioned-off-by-one-when-transform-is-present.html                                (rev 0)
+++ trunk/LayoutTests/fast/layers/hidpi-box-positioned-off-by-one-when-transform-is-present.html        2014-03-21 13:55:40 UTC (rev 166060)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests if flooring the transformed boxes' coordinates produce the same result as if there was no transform present.&lt;/title&gt;
+&lt;head&gt;
+&lt;style&gt;
+  div {
+    background: green;
+    width: 5px;
+    height: 5px;
+    position: absolute;
+    -webkit-transform: rotate(0deg);
+  }
+&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 = 0; i &lt; 40; ++i) {
+    adjustment = 0.25;
+    for (j = 0; j &lt; 40; ++j) {
+      var e = document.createElement(&quot;div&quot;);
+      e.style.top = (i * 5 + adjustment) +  &quot;px&quot;;
+      e.style.left = ( j * 5 + adjustment) + &quot;px&quot;;
+      container.appendChild(e);
+      adjustment+=0.05;
+    }
+  }
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (166059 => 166060)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-21 13:01:56 UTC (rev 166059)
+++ trunk/Source/WebCore/ChangeLog        2014-03-21 13:55:40 UTC (rev 166060)
</span><span class="lines">@@ -1,3 +1,59 @@
</span><ins>+2014-03-21  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        Subpixel rendering: RenderBox is positioned off by one when non-compositing transform is present.
+        https://bugs.webkit.org/show_bug.cgi?id=130430
+
+        Reviewed by Simon Fraser.
+
+        div {
+            position: absolute;
+             top: 10.25px;
+             left: 10.25px;
+         }
+
+         The &lt;div&gt; with (10.25px, 10.25px) is painted to (10.5px, 10.5px) after device pixel snapping on 2x display.
+         Moving &lt;div&gt; to its own RenderLayer should not change the painting position.
+
+         div {
+             position: absolute;
+             top: 10.25px;
+             left: 10.25px;
+             -webkit-transform: rotate(0deg);
+         }
+
+        When we paint the RenderLayer's content, the graphics context is translated by the rounded value of
+        renderer's offset from parent.
+
+            (10.25px,10.25px) -&gt; rounded to (10.5px,10.5px).
+
+        When the translate moves the graphics context's origin over the renderer's top-left position,
+        the renderer's relative top-left coordinates end up being negative.
+
+            Graphics context translated by (10.5px,10.5px) -&gt; pushes renderer's relative top-left coords to (-0.25px,-0.25px)
+
+        When we round (pixel snap) these negative coordinates, half-way values get translated to the wrong direction.
+
+        (relative coords (-0.25px,-0.25px) -&gt; pixel snapped to (-0.5px,-0.5px) -&gt; final absolute(painting) coords (10px,10px))
+
+        This patch changes the rounding to flooring to ensure that the relative top-left position never gets negative as the result
+        of subpixel shifting.
+
+        Tests: compositing/hidpi-box-positioned-off-by-one-when-non-compositing-transform-is-present.html
+               fast/layers/hidpi-box-positioned-off-by-one-when-transform-is-present.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::computedTransform):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateTransform):
+        (WebCore::RenderLayer::currentTransform):
+        (WebCore::RenderLayer::paintLayerByApplyingTransform):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateTransform):
+        * rendering/style/RenderStyle.cpp:
+        * rendering/style/RenderStyle.h:
+        * svg/SVGTextElement.cpp:
+        (WebCore::SVGTextElement::animatedLocalTransform):
+
</ins><span class="cx"> 2014-03-21  Pratik Solanki  &lt;psolanki@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed. iOS build fix after r166046.
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSComputedStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (166059 => 166060)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2014-03-21 13:01:56 UTC (rev 166059)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2014-03-21 13:55:40 UTC (rev 166060)
</span><span class="lines">@@ -826,12 +826,12 @@
</span><span class="cx">     if (!renderer || !renderer-&gt;hasTransform() || !style-&gt;hasTransform())
</span><span class="cx">         return cssValuePool().createIdentifierValue(CSSValueNone);
</span><span class="cx"> 
</span><del>-    IntRect box;
</del><ins>+    FloatRect pixelSnappedRect;
</ins><span class="cx">     if (renderer-&gt;isBox())
</span><del>-        box = pixelSnappedIntRect(toRenderBox(renderer)-&gt;borderBoxRect());
</del><ins>+        pixelSnappedRect = pixelSnappedForPainting(toRenderBox(renderer)-&gt;borderBoxRect(), renderer-&gt;document().deviceScaleFactor());
</ins><span class="cx"> 
</span><span class="cx">     TransformationMatrix transform;
</span><del>-    style-&gt;applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin);
</del><ins>+    style-&gt;applyTransform(transform, pixelSnappedRect, RenderStyle::ExcludeTransformOrigin);
</ins><span class="cx">     // Note that this does not flatten to an affine transform if ENABLE(3D_RENDERING) is off, by design.
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (166059 => 166060)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-03-21 13:01:56 UTC (rev 166059)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-03-21 13:55:40 UTC (rev 166060)
</span><span class="lines">@@ -878,7 +878,7 @@
</span><span class="cx">         RenderBox* box = renderBox();
</span><span class="cx">         ASSERT(box);
</span><span class="cx">         m_transform-&gt;makeIdentity();
</span><del>-        box-&gt;style().applyTransform(*m_transform, box-&gt;pixelSnappedBorderBoxRect().size(), RenderStyle::IncludeTransformOrigin);
</del><ins>+        box-&gt;style().applyTransform(*m_transform, pixelSnappedForPainting(box-&gt;borderBoxRect(), box-&gt;document().deviceScaleFactor()), RenderStyle::IncludeTransformOrigin);
</ins><span class="cx">         makeMatrixRenderable(*m_transform, canRender3DTransforms());
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -891,19 +891,21 @@
</span><span class="cx">     if (!m_transform)
</span><span class="cx">         return TransformationMatrix();
</span><span class="cx"> 
</span><ins>+    RenderBox* box = renderBox();
+    ASSERT(box);
+    FloatRect pixelSnappedBorderRect = pixelSnappedForPainting(box-&gt;borderBoxRect(), box-&gt;document().deviceScaleFactor());
</ins><span class="cx">     if (renderer().style().isRunningAcceleratedAnimation()) {
</span><span class="cx">         TransformationMatrix currTransform;
</span><span class="cx">         RefPtr&lt;RenderStyle&gt; style = renderer().animation().getAnimatedStyleForRenderer(&amp;renderer());
</span><del>-        style-&gt;applyTransform(currTransform, renderBox()-&gt;pixelSnappedBorderBoxRect().size(), applyOrigin);
</del><ins>+        style-&gt;applyTransform(currTransform, pixelSnappedBorderRect, applyOrigin);
</ins><span class="cx">         makeMatrixRenderable(currTransform, canRender3DTransforms());
</span><span class="cx">         return currTransform;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // m_transform includes transform-origin, so we need to recompute the transform here.
</span><span class="cx">     if (applyOrigin == RenderStyle::ExcludeTransformOrigin) {
</span><del>-        RenderBox* box = renderBox();
</del><span class="cx">         TransformationMatrix currTransform;
</span><del>-        box-&gt;style().applyTransform(currTransform, box-&gt;pixelSnappedBorderBoxRect().size(), RenderStyle::ExcludeTransformOrigin);
</del><ins>+        box-&gt;style().applyTransform(currTransform, pixelSnappedBorderRect, RenderStyle::ExcludeTransformOrigin);
</ins><span class="cx">         makeMatrixRenderable(currTransform, canRender3DTransforms());
</span><span class="cx">         return currTransform;
</span><span class="cx">     }
</span><span class="lines">@@ -4202,13 +4204,13 @@
</span><span class="cx">     convertToLayerCoords(paintingInfo.rootLayer, offsetFromParent);
</span><span class="cx">     offsetFromParent.moveBy(translationOffset);
</span><span class="cx">     TransformationMatrix transform(renderableTransform(paintingInfo.paintBehavior));
</span><del>-    FloatPoint devicePixelSnappeddOffsetFromParent = roundedForPainting(offsetFromParent, deviceScaleFactor);
</del><ins>+    FloatPoint devicePixelFlooredOffsetFromParent = flooredForPainting(offsetFromParent, deviceScaleFactor);
</ins><span class="cx">     // Translate the graphics context to the snapping position to avoid off-device-pixel positing.
</span><del>-    transform.translateRight(devicePixelSnappeddOffsetFromParent.x(), devicePixelSnappeddOffsetFromParent.y());
</del><ins>+    transform.translateRight(devicePixelFlooredOffsetFromParent.x(), devicePixelFlooredOffsetFromParent.y());
</ins><span class="cx">     // We handle accumulated subpixels through nested layers here. Since the context gets translated to device pixels,
</span><span class="cx">     // all we need to do is add the delta to the accumulated pixels coming from ancestor layers. With deep nesting of subpixel positioned
</span><span class="cx">     // boxes, this could grow to a relatively large number, but the translateRight() balances it.
</span><del>-    FloatSize delta = offsetFromParent - devicePixelSnappeddOffsetFromParent;
</del><ins>+    FloatSize delta = offsetFromParent - devicePixelFlooredOffsetFromParent;
</ins><span class="cx">     LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation + LayoutSize(delta);
</span><span class="cx">     // Apply the transform.
</span><span class="cx">     GraphicsContextStateSaver stateSaver(*context);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (166059 => 166060)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp        2014-03-21 13:01:56 UTC (rev 166059)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp        2014-03-21 13:55:40 UTC (rev 166060)
</span><span class="lines">@@ -370,7 +370,8 @@
</span><span class="cx">     // baked into it, and we don't want that.
</span><span class="cx">     TransformationMatrix t;
</span><span class="cx">     if (m_owningLayer.hasTransform()) {
</span><del>-        style-&gt;applyTransform(t, toRenderBox(renderer()).pixelSnappedBorderBoxRect().size(), RenderStyle::ExcludeTransformOrigin);
</del><ins>+        RenderBox&amp; renderBox = toRenderBox(renderer());
+        style-&gt;applyTransform(t, pixelSnappedForPainting(renderBox.borderBoxRect(), renderBox.document().deviceScaleFactor()), RenderStyle::ExcludeTransformOrigin);
</ins><span class="cx">         makeMatrixRenderable(t, compositor().canRender3DTransforms());
</span><span class="cx">     }
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (166059 => 166060)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2014-03-21 13:01:56 UTC (rev 166059)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2014-03-21 13:55:40 UTC (rev 166060)
</span><span class="lines">@@ -958,25 +958,6 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderStyle::applyTransform(TransformationMatrix&amp; transform, const LayoutSize&amp; borderBoxSize, ApplyTransformOrigin applyOrigin) const
-{
-    // FIXME: when subpixel layout is supported (bug 71143) the body of this function could be replaced by
-    // applyTransform(transform, FloatRect(FloatPoint(), borderBoxSize), applyOrigin);
-    
-    const Vector&lt;RefPtr&lt;TransformOperation&gt;&gt;&amp; transformOperations = rareNonInheritedData-&gt;m_transform-&gt;m_operations.operations();
-    bool applyTransformOrigin = requireTransformOrigin(transformOperations, applyOrigin);
-
-    if (applyTransformOrigin)
-        transform.translate3d(floatValueForLength(transformOriginX(), borderBoxSize.width()), floatValueForLength(transformOriginY(), borderBoxSize.height()), transformOriginZ());
-
-    unsigned size = transformOperations.size();
-    for (unsigned i = 0; i &lt; size; ++i)
-        transformOperations[i]-&gt;apply(transform, borderBoxSize);
-
-    if (applyTransformOrigin)
-        transform.translate3d(-floatValueForLength(transformOriginX(), borderBoxSize.width()), -floatValueForLength(transformOriginY(), borderBoxSize.height()), -transformOriginZ()); 
-}
-
</del><span class="cx"> void RenderStyle::applyTransform(TransformationMatrix&amp; transform, const FloatRect&amp; boundingBox, ApplyTransformOrigin applyOrigin) const
</span><span class="cx"> {
</span><span class="cx">     const Vector&lt;RefPtr&lt;TransformOperation&gt;&gt;&amp; transformOperations = rareNonInheritedData-&gt;m_transform-&gt;m_operations.operations();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (166059 => 166060)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.h        2014-03-21 13:01:56 UTC (rev 166059)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h        2014-03-21 13:55:40 UTC (rev 166060)
</span><span class="lines">@@ -874,7 +874,6 @@
</span><span class="cx">     bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective(); }
</span><span class="cx"> 
</span><span class="cx">     enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin };
</span><del>-    void applyTransform(TransformationMatrix&amp;, const LayoutSize&amp; borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin) const;
</del><span class="cx">     void applyTransform(TransformationMatrix&amp;, const FloatRect&amp; boundingBox, ApplyTransformOrigin = IncludeTransformOrigin) const;
</span><span class="cx">     void setPageScaleTransform(float);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGTextElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGTextElement.cpp (166059 => 166060)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGTextElement.cpp        2014-03-21 13:01:56 UTC (rev 166059)
+++ trunk/Source/WebCore/svg/SVGTextElement.cpp        2014-03-21 13:55:40 UTC (rev 166060)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx">         TransformationMatrix t;
</span><span class="cx">         // For now, the transform-origin is not taken into account
</span><span class="cx">         // Also, any percentage values will not be taken into account
</span><del>-        style-&gt;applyTransform(t, IntSize(0, 0), RenderStyle::ExcludeTransformOrigin);
</del><ins>+        style-&gt;applyTransform(t, FloatRect(0, 0, 0, 0), RenderStyle::ExcludeTransformOrigin);
</ins><span class="cx">         // Flatten any 3D transform
</span><span class="cx">         matrix = t.toAffineTransform();
</span><span class="cx">     } else
</span></span></pre>
</div>
</div>

</body>
</html>