<!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>[174433] releases/WebKitGTK/webkit-2.6</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/174433">174433</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-10-08 04:23:45 -0700 (Wed, 08 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/173906">r173906</a> - The style resolution cache applies properties incorrectly whenever direction != ltr
https://bugs.webkit.org/show_bug.cgi?id=137052

Patch by Benjamin Poulain &lt;bpoulain@apple.com&gt; on 2014-09-23
Reviewed by Andreas Kling.

Source/WebCore:

The optimization <a href="http://trac.webkit.org/projects/webkit/changeset/135021">r135021</a> introduced a bug whenever the direction of subtree is not
uniform in the whole page.

When StyleResolver::applyMatchedProperties() resolves the style, some properties are
resolved differently based on the writing-mode and the direction.

In isCacheableInMatchedPropertiesCache(), the cases for writing-mode are already handled
by not caching any style with anything else than the default.
The direction was ignored, causing the bugs solved here.

Tests: css3/flexbox/flex-flow-2.html
       fast/css/style-resolver-cache-direction-1.html
       fast/css/style-resolver-cache-direction-2.html
       fast/css/style-resolver-cache-direction-3.html

* css/StyleResolver.cpp:
(WebCore::isCacheableInMatchedPropertiesCache):

LayoutTests:

* css3/flexbox/flex-flow-2-expected.txt: Added.
* css3/flexbox/flex-flow-2.html: Added.
The test flex-flow.html should have uncovered the bug. It did not because it uses
:nth-child(), which disable style optimizations.

flex-flow-2.html is a copy of flex-flow.html using classes instead of :nth-child().
This would have caught the bug.

* fast/css/style-resolver-cache-direction-1-expected.html: Added.
* fast/css/style-resolver-cache-direction-1.html: Added.
* fast/css/style-resolver-cache-direction-2-expected.html: Added.
* fast/css/style-resolver-cache-direction-2.html: Added.
* fast/css/style-resolver-cache-direction-3-expected.html: Added.
* fast/css/style-resolver-cache-direction-3.html: Added.
New basic tests for the fix.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit26LayoutTestsChangeLog">releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCorecssStyleResolvercpp">releases/WebKitGTK/webkit-2.6/Source/WebCore/css/StyleResolver.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit26LayoutTestscss3flexboxflexflow2expectedtxt">releases/WebKitGTK/webkit-2.6/LayoutTests/css3/flexbox/flex-flow-2-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit26LayoutTestscss3flexboxflexflow2html">releases/WebKitGTK/webkit-2.6/LayoutTests/css3/flexbox/flex-flow-2.html</a></li>
<li><a href="#releasesWebKitGTKwebkit26LayoutTestsfastcssstyleresolvercachedirection1expectedhtml">releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-1-expected.html</a></li>
<li><a href="#releasesWebKitGTKwebkit26LayoutTestsfastcssstyleresolvercachedirection1html">releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-1.html</a></li>
<li><a href="#releasesWebKitGTKwebkit26LayoutTestsfastcssstyleresolvercachedirection2expectedhtml">releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-2-expected.html</a></li>
<li><a href="#releasesWebKitGTKwebkit26LayoutTestsfastcssstyleresolvercachedirection2html">releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-2.html</a></li>
<li><a href="#releasesWebKitGTKwebkit26LayoutTestsfastcssstyleresolvercachedirection3expectedhtml">releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-3-expected.html</a></li>
<li><a href="#releasesWebKitGTKwebkit26LayoutTestsfastcssstyleresolvercachedirection3html">releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-3.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit26LayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog (174432 => 174433)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog        2014-10-08 11:20:03 UTC (rev 174432)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog        2014-10-08 11:23:45 UTC (rev 174433)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-09-23  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        The style resolution cache applies properties incorrectly whenever direction != ltr
+        https://bugs.webkit.org/show_bug.cgi?id=137052
+
+        Reviewed by Andreas Kling.
+
+        * css3/flexbox/flex-flow-2-expected.txt: Added.
+        * css3/flexbox/flex-flow-2.html: Added.
+        The test flex-flow.html should have uncovered the bug. It did not because it uses
+        :nth-child(), which disable style optimizations.
+
+        flex-flow-2.html is a copy of flex-flow.html using classes instead of :nth-child().
+        This would have caught the bug.
+
+        * fast/css/style-resolver-cache-direction-1-expected.html: Added.
+        * fast/css/style-resolver-cache-direction-1.html: Added.
+        * fast/css/style-resolver-cache-direction-2-expected.html: Added.
+        * fast/css/style-resolver-cache-direction-2.html: Added.
+        * fast/css/style-resolver-cache-direction-3-expected.html: Added.
+        * fast/css/style-resolver-cache-direction-3.html: Added.
+        New basic tests for the fix.
+
</ins><span class="cx"> 2014-09-19  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Latching in iframes is not working as expected
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26LayoutTestscss3flexboxflexflow2expectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.6/LayoutTests/css3/flexbox/flex-flow-2-expected.txt (0 => 174433)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/LayoutTests/css3/flexbox/flex-flow-2-expected.txt                                (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/css3/flexbox/flex-flow-2-expected.txt        2014-10-08 11:23:45 UTC (rev 174433)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit26LayoutTestscss3flexboxflexflow2html"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.6/LayoutTests/css3/flexbox/flex-flow-2.html (0 => 174433)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/LayoutTests/css3/flexbox/flex-flow-2.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/css3/flexbox/flex-flow-2.html        2014-10-08 11:23:45 UTC (rev 174433)
</span><span class="lines">@@ -0,0 +1,153 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;style&gt;
+body {
+    margin: 0;
+}
+.flexbox {
+    width: 600px;
+    display: -webkit-flex;
+    background-color: grey;
+}
+.flexbox &gt; div {
+    height: 20px;
+    width: 20px;
+    border: 0;
+}
+
+.rtl {
+    direction: rtl;
+}
+
+.bt {
+    -webkit-writing-mode: horizontal-bt;
+}
+
+.vertical-rl, .vertical-lr, .column, .column-reverse {
+    height: 600px;
+}
+
+.vertical-rl {
+    -webkit-writing-mode: vertical-rl;
+}
+
+.vertical-lr {
+    -webkit-writing-mode: vertical-lr;
+}
+
+.row-reverse {
+    -webkit-flex-flow: row-reverse;
+}
+
+.column {
+    -webkit-flex-flow: column;
+}
+
+.column-reverse {
+    -webkit-flex-flow: column-reverse;
+}
+
+.flexbox &gt; .first {
+    background-color: blue;
+}
+.flexbox &gt; .second {
+    background-color: green;
+}
+.flexbox &gt; .third {
+    background-color: red;
+}
+
+.flexbox &gt; div &gt; div {
+    background-color: orange;
+    height: 10px;
+}
+&lt;/style&gt;
+&lt;script src=&quot;../../resources/check-layout.js&quot;&gt;&lt;/script&gt;
+&lt;body onload=&quot;checkLayout('.flexbox')&quot;&gt;
+
+&lt;div class=&quot;flexbox&quot;&gt;
+  &lt;div class=&quot;first&quot; data-expected-width=&quot;75&quot; data-offset-x=&quot;0&quot; style=&quot;-webkit-flex: 1 0 0; margin: 0 auto;&quot;&gt;&lt;/div&gt;
+  &lt;div class=&quot;second&quot; data-expected-width=&quot;350&quot; data-offset-x=&quot;75&quot; style=&quot;-webkit-flex: 2 0 0; -webkit-padding-start: 200px&quot;&gt;&lt;div data-offset-x=&quot;275&quot;&gt;&lt;/div&gt;&lt;/div&gt;
+  &lt;div class=&quot;third&quot; data-expected-width=&quot;75&quot; data-offset-x=&quot;425&quot; style=&quot;-webkit-flex: 1 0 0; -webkit-margin-end: 100px;&quot;&gt;&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div class=&quot;flexbox rtl&quot;&gt;
+  &lt;div class=&quot;first&quot; data-expected-width=&quot;75&quot; data-offset-x=&quot;525&quot; style=&quot;-webkit-flex: 1 0 0; margin: 0 auto;&quot;&gt;&lt;/div&gt;
+  &lt;div class=&quot;second&quot; data-expected-width=&quot;350&quot; data-offset-x=&quot;175&quot; style=&quot;-webkit-flex: 2 0 0; -webkit-padding-start: 200px&quot;&gt;&lt;div data-offset-x=&quot;175&quot;&gt;&lt;/div&gt;&lt;/div&gt;
+  &lt;div class=&quot;third&quot; data-expected-width=&quot;75&quot; data-offset-x=&quot;100&quot; style=&quot;-webkit-flex: 1 0 0; -webkit-margin-end: 100px;&quot;&gt;&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div class=&quot;flexbox row-reverse&quot;&gt;
+  &lt;div class=&quot;first&quot; data-expected-width=&quot;75&quot; data-offset-x=&quot;525&quot; style=&quot;-webkit-flex: 1 0 0; margin: 0 auto;&quot;&gt;&lt;/div&gt;
+  &lt;div class=&quot;second&quot; data-expected-width=&quot;350&quot; data-offset-x=&quot;175&quot; style=&quot;-webkit-flex: 2 0 0; -webkit-padding-start: 200px&quot;&gt;&lt;div data-offset-x=&quot;375&quot;&gt;&lt;/div&gt;&lt;/div&gt;
+  &lt;div class=&quot;third&quot; data-expected-width=&quot;75&quot; data-offset-x=&quot;0&quot; style=&quot;-webkit-flex: 1 0 0; -webkit-margin-end: 100px;&quot;&gt;&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div class=&quot;flexbox rtl row-reverse&quot;&gt;
+  &lt;div class=&quot;first&quot; data-expected-width=&quot;75&quot; data-offset-x=&quot;0&quot; style=&quot;-webkit-flex: 1 0 0; margin: 0 auto;&quot;&gt;&lt;/div&gt;
+  &lt;div class=&quot;second&quot; data-expected-width=&quot;350&quot; data-offset-x=&quot;75&quot; style=&quot;-webkit-flex: 2 0 0; -webkit-padding-start: 200px&quot;&gt;&lt;div data-offset-x=&quot;75&quot;&gt;&lt;/div&gt;&lt;/div&gt;
+  &lt;div class=&quot;third&quot; data-expected-width=&quot;75&quot; data-offset-x=&quot;525&quot; style=&quot;-webkit-flex: 1 0 0; -webkit-margin-end: 100px;&quot;&gt;&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style=&quot;position: relative;&quot;&gt;
+&lt;div class=&quot;flexbox column&quot;&gt;
+  &lt;div class=&quot;first&quot; data-expected-height=&quot;150&quot; data-offset-y=&quot;0&quot; style=&quot;-webkit-flex: 1 0 0; margin: auto 200px auto 150px;&quot;&gt;&lt;/div&gt;
+  &lt;div class=&quot;second&quot; data-expected-height=&quot;300&quot; data-offset-y=&quot;150&quot; style=&quot;-webkit-flex: 2 0 0; -webkit-padding-start: 200px&quot;&gt;&lt;div data-offset-y=&quot;150&quot; data-offset-x=&quot;200&quot;&gt;&lt;/div&gt;&lt;/div&gt;
+  &lt;div class=&quot;third&quot; data-expected-height=&quot;150&quot; data-offset-y=&quot;450&quot; style=&quot;-webkit-flex: 1 0 0; -webkit-margin-end: 100px;&quot;&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style=&quot;position: relative;&quot;&gt;
+&lt;div class=&quot;flexbox column-reverse&quot;&gt;
+  &lt;div class=&quot;first&quot; data-expected-height=&quot;150&quot; data-offset-y=&quot;450&quot; style=&quot;-webkit-flex: 1 0 0; margin: auto 200px auto 150px;&quot;&gt;&lt;/div&gt;
+  &lt;div class=&quot;second&quot; data-expected-height=&quot;300&quot; data-offset-y=&quot;150&quot; style=&quot;-webkit-flex: 2 0 0; -webkit-padding-start: 200px&quot;&gt;&lt;div data-offset-y=&quot;150&quot; data-offset-x=&quot;200&quot;&gt;&lt;/div&gt;&lt;/div&gt;
+  &lt;div class=&quot;third&quot; data-expected-height=&quot;150&quot; data-offset-y=&quot;0&quot; style=&quot;-webkit-flex: 1 0 0; -webkit-margin-end: 100px;&quot;&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style=&quot;position: relative;&quot;&gt;
+&lt;div class=&quot;flexbox column rtl&quot;&gt;
+  &lt;div class=&quot;first&quot; data-expected-height=&quot;150&quot; data-offset-y=&quot;0&quot; data-offset-x=&quot;480&quot; style=&quot;-webkit-flex: 1 0 0; margin: auto 100px auto 50px;&quot;&gt;&lt;/div&gt;
+  &lt;div class=&quot;second&quot; data-expected-height=&quot;300&quot; data-offset-y=&quot;150&quot; style=&quot;-webkit-flex: 2 0 0; -webkit-padding-start: 200px&quot;&gt;&lt;div data-offset-y=&quot;150&quot; data-offset-x=&quot;380&quot;&gt;&lt;/div&gt;&lt;/div&gt;
+  &lt;div class=&quot;third&quot; data-expected-height=&quot;150&quot; data-offset-y=&quot;450&quot; data-offset-x=&quot;580&quot; style=&quot;-webkit-flex: 1 0 0; -webkit-margin-end: 100px;&quot;&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style=&quot;position: relative;&quot;&gt;
+&lt;div class=&quot;flexbox column-reverse rtl&quot;&gt;
+  &lt;div class=&quot;first&quot; data-expected-height=&quot;150&quot; data-offset-y=&quot;450&quot; data-offset-x=&quot;480&quot; style=&quot;-webkit-flex: 1 0 0; margin: auto 100px auto 50px;&quot;&gt;&lt;/div&gt;
+  &lt;div class=&quot;second&quot; data-expected-height=&quot;300&quot; data-offset-y=&quot;150&quot; style=&quot;-webkit-flex: 2 0 0; -webkit-padding-start: 200px&quot;&gt;&lt;div data-offset-y=&quot;150&quot; data-offset-x=&quot;380&quot;&gt;&lt;/div&gt;&lt;/div&gt;
+  &lt;div class=&quot;third&quot; data-expected-height=&quot;150&quot; data-offset-y=&quot;0&quot; data-offset-x=&quot;580&quot; style=&quot;-webkit-flex: 1 0 0; -webkit-margin-end: 100px;&quot;&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style=&quot;position: relative;&quot;&gt;
+&lt;div data-expected-height=&quot;600&quot; class=&quot;flexbox vertical-lr column&quot;&gt;
+  &lt;div class=&quot;first&quot; data-offset-x=&quot;0&quot; data-expected-width=&quot;500&quot; style=&quot;-webkit-flex: 1 0 0; min-width: 300px&quot;&gt;&lt;/div&gt;
+  &lt;div class=&quot;second&quot; data-offset-x=&quot;500&quot; data-offset-y=&quot;100&quot; data-expected-width=&quot;100&quot; style=&quot;-webkit-flex: 1 0 200px; max-width: 100px; margin: 100px 0 50px 0;&quot;&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style=&quot;position: relative;&quot;&gt;
+&lt;div data-expected-height=&quot;600&quot; class=&quot;flexbox vertical-lr column-reverse&quot;&gt;
+  &lt;div class=&quot;first&quot; data-offset-x=&quot;100&quot; data-expected-width=&quot;500&quot; style=&quot;-webkit-flex: 1 0 0; min-width: 300px&quot;&gt;&lt;/div&gt;
+  &lt;div class=&quot;second&quot; data-offset-x=&quot;0&quot; data-offset-y=&quot;100&quot; data-expected-width=&quot;100&quot; style=&quot;-webkit-flex: 1 0 200px; max-width: 100px; margin: 100px 0 50px 0;&quot;&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style=&quot;position: relative;&quot;&gt;
+&lt;div data-expected-height=&quot;600&quot; class=&quot;flexbox vertical-rl column&quot;&gt;
+  &lt;div class=&quot;first&quot; data-offset-x=&quot;100&quot; data-expected-width=&quot;500&quot; style=&quot;-webkit-flex: 1 0 0; min-width: 300px; margin-bottom: 100px&quot;&gt;&lt;/div&gt;
+  &lt;div class=&quot;second&quot; data-offset-x=&quot;0&quot; data-offset-y=&quot;100&quot; data-expected-width=&quot;100&quot; style=&quot;-webkit-flex: 1 0 200px; max-width: 100px; margin: 100px 0 50px 0;&quot;&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style=&quot;position: relative;&quot;&gt;
+&lt;div data-expected-height=&quot;600&quot; class=&quot;flexbox vertical-rl column-reverse&quot;&gt;
+  &lt;div class=&quot;first&quot; data-offset-x=&quot;0&quot; data-expected-width=&quot;500&quot; style=&quot;-webkit-flex: 1 0 0; min-width: 300px; margin-bottom: 100px&quot;&gt;&lt;/div&gt;
+  &lt;div class=&quot;second&quot; data-offset-x=&quot;500&quot; data-offset-y=&quot;100&quot; data-expected-width=&quot;100&quot; style=&quot;-webkit-flex: 1 0 200px; max-width: 100px; margin: 100px 0 50px 0;&quot;&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit26LayoutTestsfastcssstyleresolvercachedirection1expectedhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-1-expected.html (0 => 174433)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-1-expected.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-1-expected.html        2014-10-08 11:23:45 UTC (rev 174433)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.root {
+    background-color: lime;
+    margin: 5px;
+}
+.testcase {
+    height: 25px;
+    width: 50px;
+    background-color: red;
+}
+.left {
+    margin-left: 200px;
+}
+.right {
+    margin-left: calc(100% - 250px);
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;p&gt;This test the style is not copied from the wrong source when the direction is defined.&lt;/p&gt;
+    &lt;div class=&quot;root&quot;&gt;
+        &lt;div class=&quot;left testcase&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div class=&quot;left testcase&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+    &lt;div class=&quot;root&quot;&gt;
+        &lt;div class=&quot;right testcase&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div class=&quot;right testcase&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+    &lt;div class=&quot;root&quot;&gt;
+        &lt;div class=&quot;left testcase&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div class=&quot;left testcase&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit26LayoutTestsfastcssstyleresolvercachedirection1html"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-1.html (0 => 174433)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-1.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-1.html        2014-10-08 11:23:45 UTC (rev 174433)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.default {
+    background-color: lime;
+    margin: 5px;
+}
+.ltr {
+    direction: ltr;
+    background-color: lime;
+    margin: 5px;
+}
+.rtl {
+    direction: rtl;
+    background-color: lime;
+    margin: 5px;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;p&gt;This test the style is not copied from the wrong source when the direction is defined.&lt;/p&gt;
+    &lt;!-- The inline style strings must be strictly equal. Each tested div must also match the exact same set of rules. --&gt;
+    &lt;div class=&quot;ltr&quot;&gt;
+        &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+    &lt;div class=&quot;rtl&quot;&gt;
+        &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+    &lt;div class=&quot;default&quot;&gt;
+        &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit26LayoutTestsfastcssstyleresolvercachedirection2expectedhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-2-expected.html (0 => 174433)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-2-expected.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-2-expected.html        2014-10-08 11:23:45 UTC (rev 174433)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.root {
+    background-color: lime;
+    margin: 5px;
+}
+.testcase {
+    height: 25px;
+    width: 50px;
+    background-color: red;
+}
+.left {
+    margin-left: 200px;
+}
+.right {
+    margin-left: calc(100% - 250px);
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;p&gt;This test the style is not copied from the wrong source when the direction is defined.&lt;/p&gt;
+    &lt;div class=&quot;root&quot;&gt;
+        &lt;div class=&quot;right testcase&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div class=&quot;right testcase&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+    &lt;div class=&quot;root&quot;&gt;
+        &lt;div class=&quot;left testcase&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div class=&quot;left testcase&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+    &lt;div class=&quot;root&quot;&gt;
+        &lt;div class=&quot;left testcase&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div class=&quot;left testcase&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit26LayoutTestsfastcssstyleresolvercachedirection2html"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-2.html (0 => 174433)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-2.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-2.html        2014-10-08 11:23:45 UTC (rev 174433)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.default {
+    background-color: lime;
+    margin: 5px;
+}
+.ltr {
+    direction: ltr;
+    background-color: lime;
+    margin: 5px;
+}
+.rtl {
+    direction: rtl;
+    background-color: lime;
+    margin: 5px;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;p&gt;This test the style is not copied from the wrong source when the direction is defined.&lt;/p&gt;
+    &lt;!-- The inline style strings must be strictly equal. Each tested div must also match the exact same set of rules. --&gt;
+    &lt;div class=&quot;rtl&quot;&gt;
+        &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+    &lt;div class=&quot;ltr&quot;&gt;
+        &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+    &lt;div class=&quot;default&quot;&gt;
+        &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit26LayoutTestsfastcssstyleresolvercachedirection3expectedhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-3-expected.html (0 => 174433)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-3-expected.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-3-expected.html        2014-10-08 11:23:45 UTC (rev 174433)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.root {
+    background-color: lime;
+    margin: 5px;
+}
+.testcase {
+    height: 25px;
+    width: 50px;
+    background-color: red;
+}
+.left {
+    margin-left: 200px;
+}
+.right {
+    margin-left: calc(100% - 250px);
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;p&gt;This test the style is not copied from the wrong source when the direction is defined.&lt;/p&gt;
+    &lt;div class=&quot;root&quot;&gt;
+        &lt;div class=&quot;left testcase&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div class=&quot;left testcase&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+    &lt;div class=&quot;root&quot;&gt;
+        &lt;div class=&quot;left testcase&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div class=&quot;left testcase&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+    &lt;div class=&quot;root&quot;&gt;
+        &lt;div class=&quot;right testcase&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div class=&quot;right testcase&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit26LayoutTestsfastcssstyleresolvercachedirection3html"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-3.html (0 => 174433)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-3.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css/style-resolver-cache-direction-3.html        2014-10-08 11:23:45 UTC (rev 174433)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.default {
+    background-color: lime;
+    margin: 5px;
+}
+.ltr {
+    direction: ltr;
+    background-color: lime;
+    margin: 5px;
+}
+.rtl {
+    direction: rtl;
+    background-color: lime;
+    margin: 5px;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;p&gt;This test the style is not copied from the wrong source when the direction is defined.&lt;/p&gt;
+    &lt;!-- The inline style strings must be strictly equal. Each tested div must also match the exact same set of rules. --&gt;
+    &lt;div class=&quot;default&quot;&gt;
+        &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+    &lt;div class=&quot;ltr&quot;&gt;
+        &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+    &lt;div class=&quot;rtl&quot;&gt;
+        &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;
+            &lt;div style=&quot;height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog (174432 => 174433)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog        2014-10-08 11:20:03 UTC (rev 174432)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog        2014-10-08 11:23:45 UTC (rev 174433)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-09-23  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        The style resolution cache applies properties incorrectly whenever direction != ltr
+        https://bugs.webkit.org/show_bug.cgi?id=137052
+
+        Reviewed by Andreas Kling.
+
+        The optimization r135021 introduced a bug whenever the direction of subtree is not
+        uniform in the whole page.
+
+        When StyleResolver::applyMatchedProperties() resolves the style, some properties are
+        resolved differently based on the writing-mode and the direction.
+
+        In isCacheableInMatchedPropertiesCache(), the cases for writing-mode are already handled
+        by not caching any style with anything else than the default.
+        The direction was ignored, causing the bugs solved here.
+
+        Tests: css3/flexbox/flex-flow-2.html
+               fast/css/style-resolver-cache-direction-1.html
+               fast/css/style-resolver-cache-direction-2.html
+               fast/css/style-resolver-cache-direction-3.html
+
+        * css/StyleResolver.cpp:
+        (WebCore::isCacheableInMatchedPropertiesCache):
+
</ins><span class="cx"> 2014-09-22  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Ensure that layout is up-to-date before hit-testing via RenderView
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/css/StyleResolver.cpp (174432 => 174433)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/css/StyleResolver.cpp        2014-10-08 11:20:03 UTC (rev 174432)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/css/StyleResolver.cpp        2014-10-08 11:23:45 UTC (rev 174433)
</span><span class="lines">@@ -1622,7 +1622,7 @@
</span><span class="cx">         return false;
</span><span class="cx">     if (style-&gt;zoom() != RenderStyle::initialZoom())
</span><span class="cx">         return false;
</span><del>-    if (style-&gt;writingMode() != RenderStyle::initialWritingMode())
</del><ins>+    if (style-&gt;writingMode() != RenderStyle::initialWritingMode() || style-&gt;direction() != RenderStyle::initialDirection())
</ins><span class="cx">         return false;
</span><span class="cx">     // The cache assumes static knowledge about which properties are inherited.
</span><span class="cx">     if (parentStyle-&gt;hasExplicitlyInheritedProperties())
</span></span></pre>
</div>
</div>

</body>
</html>