<!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>[182130] 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/182130">182130</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2015-03-29 20:10:48 -0700 (Sun, 29 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>`currentColor` computes to the same colour on all elements, even if 'color' is inherited differently
https://bugs.webkit.org/show_bug.cgi?id=133420

Reviewed by Darin Adler.

Source/WebCore:

When resolving a style with the help of the property cache, we were
completely ignoring currentColor.

Since you can set currentColor on properties that are not inherited,
those properties would just be copied from the cached style, which
may have a completely different inherited color.

This pacth fixes the issue by preventing any MatchResult from hitting
the cache if it contains any non-inherited property that would require
resolution by the cache:
-Using the inherit value.
-Using the currentColor value.

Tests: fast/css/currentColor-on-before-after-pseudo-elements.html
       fast/css/currentColor-style-update-reftest.html
       fast/css/currentColor-value-style-update.html

* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::addElementStyleProperties):
(WebCore::ElementRuleCollector::matchAuthorRules):
(WebCore::ElementRuleCollector::matchUserRules):
(WebCore::ElementRuleCollector::matchUARules):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::MatchResult::addMatchedProperties):
(WebCore::StyleResolver::styleForKeyframe):
(WebCore::StyleResolver::pseudoStyleForElement):
(WebCore::StyleResolver::styleForPage):
(WebCore::StyleResolver::findFromMatchedPropertiesCache):
(WebCore::StyleResolver::addToMatchedPropertiesCache):
(WebCore::extractDirectionAndWritingMode):
(WebCore::StyleResolver::applyMatchedProperties):
(WebCore::StyleResolver::CascadedProperties::addStyleProperties):
(WebCore::StyleResolver::CascadedProperties::addMatches):
* css/StyleResolver.h:
(WebCore::StyleResolver::MatchResult::matchedProperties):

LayoutTests:

* fast/css/currentColor-on-before-after-pseudo-elements-expected.html: Added.
* fast/css/currentColor-on-before-after-pseudo-elements.html: Added.
* fast/css/currentColor-style-update-reftest-expected.html: Added.
* fast/css/currentColor-style-update-reftest.html: Added.
* fast/css/currentColor-value-style-update-expected.txt: Added.
* fast/css/currentColor-value-style-update.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssElementRuleCollectorcpp">trunk/Source/WebCore/css/ElementRuleCollector.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolverh">trunk/Source/WebCore/css/StyleResolver.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcsscurrentColoronbeforeafterpseudoelementsexpectedhtml">trunk/LayoutTests/fast/css/currentColor-on-before-after-pseudo-elements-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastcsscurrentColoronbeforeafterpseudoelementshtml">trunk/LayoutTests/fast/css/currentColor-on-before-after-pseudo-elements.html</a></li>
<li><a href="#trunkLayoutTestsfastcsscurrentColorstyleupdatereftestexpectedhtml">trunk/LayoutTests/fast/css/currentColor-style-update-reftest-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastcsscurrentColorstyleupdatereftesthtml">trunk/LayoutTests/fast/css/currentColor-style-update-reftest.html</a></li>
<li><a href="#trunkLayoutTestsfastcsscurrentColorvaluestyleupdateexpectedtxt">trunk/LayoutTests/fast/css/currentColor-value-style-update-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcsscurrentColorvaluestyleupdatehtml">trunk/LayoutTests/fast/css/currentColor-value-style-update.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (182129 => 182130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-03-30 03:05:48 UTC (rev 182129)
+++ trunk/LayoutTests/ChangeLog        2015-03-30 03:10:48 UTC (rev 182130)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-03-29  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
+
+        `currentColor` computes to the same colour on all elements, even if 'color' is inherited differently
+        https://bugs.webkit.org/show_bug.cgi?id=133420
+
+        Reviewed by Darin Adler.
+
+        * fast/css/currentColor-on-before-after-pseudo-elements-expected.html: Added.
+        * fast/css/currentColor-on-before-after-pseudo-elements.html: Added.
+        * fast/css/currentColor-style-update-reftest-expected.html: Added.
+        * fast/css/currentColor-style-update-reftest.html: Added.
+        * fast/css/currentColor-value-style-update-expected.txt: Added.
+        * fast/css/currentColor-value-style-update.html: Added.
+
</ins><span class="cx"> 2015-03-29  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         HTMLCollection caches incorrect length if item(0) is called before length on an empty collection
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsscurrentColoronbeforeafterpseudoelementsexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/currentColor-on-before-after-pseudo-elements-expected.html (0 => 182130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/currentColor-on-before-after-pseudo-elements-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/currentColor-on-before-after-pseudo-elements-expected.html        2015-03-30 03:10:48 UTC (rev 182130)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;style&gt;
+    #first::before, #first::after { content: 'FAIL'; background: white; }
+    #second::before, #second::after { content: 'FAIL'; background: navy; }
+&lt;/style&gt;
+&lt;p&gt;There should be a blue block below:
+&lt;p&gt;&lt;span id=&quot;first&quot; style=&quot;color:white&quot;&gt;&lt;/span&gt; &lt;span id=&quot;second&quot; style=&quot;color:navy&quot;&gt;&lt;/span&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsscurrentColoronbeforeafterpseudoelementshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/currentColor-on-before-after-pseudo-elements.html (0 => 182130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/currentColor-on-before-after-pseudo-elements.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/currentColor-on-before-after-pseudo-elements.html        2015-03-30 03:10:48 UTC (rev 182130)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;style&gt;span:matches(::before, ::after) { content: 'FAIL'; background: currentColor; }&lt;/style&gt;
+&lt;p&gt;There should be a blue block below:
+&lt;p&gt;&lt;span style=&quot;color:white&quot;&gt;&lt;/span&gt; &lt;span style=&quot;color:navy&quot;&gt;&lt;/span&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsscurrentColorstyleupdatereftestexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/currentColor-style-update-reftest-expected.html (0 => 182130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/currentColor-style-update-reftest-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/currentColor-style-update-reftest-expected.html        2015-03-30 03:10:48 UTC (rev 182130)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            .container1 {
+                margin: 4px;
+                color: blue;
+            }
+            .container1 &gt; span {
+                border: 1px solid blue;
+            }
+            .container2 {
+                margin: 4px;
+                color: red;
+            }
+            .container2 &gt; span {
+                border: 1px solid red;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;This test verifies that the value of currentColor is updated correctly when the style is updated. If the text is successful, each of the line should be styled as described by its text.&lt;/p&gt;
+
+        &lt;div class=&quot;container1&quot;&gt;
+            &lt;span&gt;This text and border should be blue.&lt;/span&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;container2&quot;&gt;
+            &lt;span&gt;This text and border should be red.&lt;/span&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;container2&quot;&gt;
+            &lt;span&gt;This text and border should be red.&lt;/span&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;container1&quot;&gt;
+            &lt;span&gt;This text and border should be blue.&lt;/span&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;container2&quot;&gt;
+            &lt;span&gt;This text and border should be red.&lt;/span&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;container1&quot;&gt;
+            &lt;span&gt;This text and border should be blue.&lt;/span&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;container2&quot;&gt;
+            &lt;span&gt;This text and border should be red.&lt;/span&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;container1&quot;&gt;
+            &lt;span&gt;This text and border should be blue.&lt;/span&gt;
+        &lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsscurrentColorstyleupdatereftesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/currentColor-style-update-reftest.html (0 => 182130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/currentColor-style-update-reftest.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/currentColor-style-update-reftest.html        2015-03-30 03:10:48 UTC (rev 182130)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;script&gt;
+            function forceLayout() {
+                // We must make sure to hit the cache.
+                var firstParagraph = document.querySelector(&quot;p&quot;);
+                var originalOffset = firstParagraph.offsetLeft;
+                firstParagraph.style.marginLeft = '42px';
+                var newOffset = firstParagraph.offsetLeft;
+                if (originalOffset == newOffset)
+                    document.write(&quot;Something horribly wrong happened to the layout.&quot;);
+                firstParagraph.style.marginLeft = '0';
+            }
+
+            document.addEventListener(&quot;DOMContentLoaded&quot;, forceLayout);
+
+
+            function runTest() {
+                forceLayout();
+
+                var target1 = document.getElementById(&quot;target1&quot;);
+                target1.classList.add(&quot;container2&quot;);
+
+                var target2 = document.getElementById(&quot;target2&quot;);
+                target2.setAttribute(&quot;class&quot;, &quot;container1&quot;);
+
+                var target3 = document.getElementById(&quot;target3&quot;);
+                target3.style.color = &quot;red&quot;;
+
+                var target4 = document.getElementById(&quot;target4&quot;);
+                target4.style.color = &quot;blue&quot;;
+
+                var target5 = document.getElementById(&quot;target5&quot;);
+                target5.setAttribute(&quot;style&quot;, &quot;color: red&quot;);
+
+                var target6 = document.getElementById(&quot;target6&quot;);
+                target6.setAttribute(&quot;style&quot;, &quot;color: blue&quot;);
+            }
+
+            window.addEventListener(&quot;load&quot;, runTest);
+        &lt;/script&gt;
+        &lt;style&gt;
+            .container1 {
+                color: blue;
+            }
+            .container2 {
+                color: red;
+            }
+            div {
+                margin: 4px;
+            }
+            div &gt; span {
+                border: 1px solid currentColor;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;This test verifies that the value of currentColor is updated correctly when the style is updated. If the text is successful, each of the line should be styled as described by its text.&lt;/p&gt;
+
+        &lt;div class=&quot;container1&quot;&gt;
+            &lt;span&gt;This text and border should be blue.&lt;/span&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;container2&quot;&gt;
+            &lt;span&gt;This text and border should be red.&lt;/span&gt;
+        &lt;/div&gt;
+        &lt;div id=&quot;target1&quot;&gt;
+            &lt;span&gt;This text and border should be red.&lt;/span&gt;
+        &lt;/div&gt;
+        &lt;div id=&quot;target2&quot;&gt;
+            &lt;span&gt;This text and border should be blue.&lt;/span&gt;
+        &lt;/div&gt;
+        &lt;div id=&quot;target3&quot;&gt;
+            &lt;span&gt;This text and border should be red.&lt;/span&gt;
+        &lt;/div&gt;
+        &lt;div id=&quot;target4&quot;&gt;
+            &lt;span&gt;This text and border should be blue.&lt;/span&gt;
+        &lt;/div&gt;
+        &lt;div id=&quot;target5&quot;&gt;
+            &lt;span&gt;This text and border should be red.&lt;/span&gt;
+        &lt;/div&gt;
+        &lt;div id=&quot;target6&quot;&gt;
+            &lt;span&gt;This text and border should be blue.&lt;/span&gt;
+        &lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsscurrentColorvaluestyleupdateexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/currentColor-value-style-update-expected.txt (0 => 182130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/currentColor-value-style-update-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/css/currentColor-value-style-update-expected.txt        2015-03-30 03:10:48 UTC (rev 182130)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+Test that the properties that use the CSS Value &quot;currentcolor&quot; to define the color are updated correctly when the inherited color changes.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+
+Initial state.
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[0]).borderColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[0]).backgroundColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[1]).borderColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[1]).backgroundColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[2]).borderColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[2]).backgroundColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[3]).borderColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[3]).backgroundColor is &quot;rgb(4, 5, 6)&quot;
+
+Let's override the style of the wrapper through their style object.
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[0]).borderColor is &quot;rgb(7, 8, 9)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[0]).backgroundColor is &quot;rgb(7, 8, 9)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[1]).borderColor is &quot;rgb(7, 8, 9)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[1]).backgroundColor is &quot;rgb(7, 8, 9)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[2]).borderColor is &quot;rgb(7, 8, 9)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[2]).backgroundColor is &quot;rgb(7, 8, 9)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[3]).borderColor is &quot;rgb(7, 8, 9)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[3]).backgroundColor is &quot;rgb(7, 8, 9)&quot;
+
+Let's remove the style attribute on the wrapper.
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[0]).borderColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[0]).backgroundColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[1]).borderColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[1]).backgroundColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[2]).borderColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[2]).backgroundColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[3]).borderColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[3]).backgroundColor is &quot;rgb(4, 5, 6)&quot;
+
+Let's remove class on the wrappers.
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[0]).borderColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[0]).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[1]).borderColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[1]).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[2]).borderColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[2]).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[3]).borderColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[3]).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+
+Then add it back.
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[0]).borderColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[0]).backgroundColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[1]).borderColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[1]).backgroundColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[2]).borderColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[2]).backgroundColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[3]).borderColor is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[3]).backgroundColor is &quot;rgb(4, 5, 6)&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsscurrentColorvaluestyleupdatehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/currentColor-value-style-update.html (0 => 182130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/currentColor-value-style-update.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/currentColor-value-style-update.html        2015-03-30 03:10:48 UTC (rev 182130)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;style&gt;
+    .test-case {
+        color: rgb(1, 2, 3);
+    }
+    .wrapper {
+        color: rgb(4, 5, 6);
+    }
+    target {
+        border-color: currentcolor;
+        background-color: currentcolor;
+    }
+&lt;/style&gt;
+&lt;script&gt;
+    jsTestIsAsync = true;
+    function testColor(expectedColor) {
+        var allTargets = document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;);
+        for (var i = 0; i &lt; allTargets.length; ++i) {
+            shouldBeEqualToString('getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[' + i + ']).borderColor', expectedColor);
+            shouldBeEqualToString('getComputedStyle(document.querySelectorAll(&quot;.test-case &gt;&gt; target&quot;)[' + i + ']).backgroundColor', expectedColor);
+        }
+    }
+
+    function runTest() {
+        description('Test that the properties that use the CSS Value &quot;currentcolor&quot; to define the color are updated correctly when the inherited color changes.');
+
+        debug(&quot;&quot;);
+        debug(&quot;Initial state.&quot;);
+        testColor(&quot;rgb(4, 5, 6)&quot;);
+
+        debug(&quot;&quot;);
+        debug(&quot;Let's override the style of the wrapper through their style object.&quot;);
+        var allWrappers = document.querySelectorAll(&quot;.wrapper&quot;);
+        for (var i = 0; i &lt; allWrappers.length; ++i) {
+            allWrappers[i].style.color = &quot;rgb(7, 8, 9)&quot;;
+        }
+        testColor(&quot;rgb(7, 8, 9)&quot;);
+
+        debug(&quot;&quot;);
+        debug(&quot;Let's remove the style attribute on the wrapper.&quot;);
+        for (var i = 0; i &lt; allWrappers.length; ++i) {
+            allWrappers[i].removeAttribute(&quot;style&quot;);
+        }
+        testColor(&quot;rgb(4, 5, 6)&quot;);
+
+        debug(&quot;&quot;);
+        debug(&quot;Let's remove class on the wrappers.&quot;);
+        for (var i = 0; i &lt; allWrappers.length; ++i) {
+            allWrappers[i].classList.remove(&quot;wrapper&quot;);
+        }
+        testColor(&quot;rgb(1, 2, 3)&quot;);
+
+        debug(&quot;&quot;);
+        debug(&quot;Then add it back.&quot;);
+        for (var i = 0; i &lt; allWrappers.length; ++i) {
+            allWrappers[i].classList.add(&quot;wrapper&quot;);
+        }
+        testColor(&quot;rgb(4, 5, 6)&quot;);
+
+        finishJSTest();
+    }
+    window.addEventListener(&quot;load&quot;, runTest);
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div class=&quot;test-case&quot;&gt;
+        &lt;div class=&quot;wrapper&quot;&gt;
+            &lt;target&gt;&lt;/target&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;wrapper&quot;&gt;
+            &lt;target&gt;&lt;/target&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+    &lt;div class=&quot;test-case&quot; style=&quot;display:none;&quot;&gt;
+        &lt;div class=&quot;wrapper&quot;&gt;
+            &lt;target&gt;&lt;/target&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;wrapper&quot;&gt;
+            &lt;target&gt;&lt;/target&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (182129 => 182130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-30 03:05:48 UTC (rev 182129)
+++ trunk/Source/WebCore/ChangeLog        2015-03-30 03:10:48 UTC (rev 182130)
</span><span class="lines">@@ -1,5 +1,48 @@
</span><span class="cx"> 2015-03-29  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
</span><span class="cx"> 
</span><ins>+        `currentColor` computes to the same colour on all elements, even if 'color' is inherited differently
+        https://bugs.webkit.org/show_bug.cgi?id=133420
+
+        Reviewed by Darin Adler.
+
+        When resolving a style with the help of the property cache, we were
+        completely ignoring currentColor.
+
+        Since you can set currentColor on properties that are not inherited,
+        those properties would just be copied from the cached style, which
+        may have a completely different inherited color.
+
+        This pacth fixes the issue by preventing any MatchResult from hitting
+        the cache if it contains any non-inherited property that would require
+        resolution by the cache:
+        -Using the inherit value.
+        -Using the currentColor value.
+
+        Tests: fast/css/currentColor-on-before-after-pseudo-elements.html
+               fast/css/currentColor-style-update-reftest.html
+               fast/css/currentColor-value-style-update.html
+
+        * css/ElementRuleCollector.cpp:
+        (WebCore::ElementRuleCollector::addElementStyleProperties):
+        (WebCore::ElementRuleCollector::matchAuthorRules):
+        (WebCore::ElementRuleCollector::matchUserRules):
+        (WebCore::ElementRuleCollector::matchUARules):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::MatchResult::addMatchedProperties):
+        (WebCore::StyleResolver::styleForKeyframe):
+        (WebCore::StyleResolver::pseudoStyleForElement):
+        (WebCore::StyleResolver::styleForPage):
+        (WebCore::StyleResolver::findFromMatchedPropertiesCache):
+        (WebCore::StyleResolver::addToMatchedPropertiesCache):
+        (WebCore::extractDirectionAndWritingMode):
+        (WebCore::StyleResolver::applyMatchedProperties):
+        (WebCore::StyleResolver::CascadedProperties::addStyleProperties):
+        (WebCore::StyleResolver::CascadedProperties::addMatches):
+        * css/StyleResolver.h:
+        (WebCore::StyleResolver::MatchResult::matchedProperties):
+
+2015-03-29  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
+
</ins><span class="cx">         Enable :any-link by default
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=143201
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssElementRuleCollectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/ElementRuleCollector.cpp (182129 => 182130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/ElementRuleCollector.cpp        2015-03-30 03:05:48 UTC (rev 182129)
+++ trunk/Source/WebCore/css/ElementRuleCollector.cpp        2015-03-30 03:10:48 UTC (rev 182130)
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (!propertySet)
</span><span class="cx">         return;
</span><del>-    m_result.ranges.lastAuthorRule = m_result.matchedProperties.size();
</del><ins>+    m_result.ranges.lastAuthorRule = m_result.matchedProperties().size();
</ins><span class="cx">     if (m_result.ranges.firstAuthorRule == -1)
</span><span class="cx">         m_result.ranges.firstAuthorRule = m_result.ranges.lastAuthorRule;
</span><span class="cx">     m_result.addMatchedProperties(*propertySet);
</span><span class="lines">@@ -220,7 +220,7 @@
</span><span class="cx"> void ElementRuleCollector::matchAuthorRules(bool includeEmptyRules)
</span><span class="cx"> {
</span><span class="cx">     clearMatchedRules();
</span><del>-    m_result.ranges.lastAuthorRule = m_result.matchedProperties.size() - 1;
</del><ins>+    m_result.ranges.lastAuthorRule = m_result.matchedProperties().size() - 1;
</ins><span class="cx"> 
</span><span class="cx">     // Match global author rules.
</span><span class="cx">     MatchRequest matchRequest(m_ruleSets.authorStyle(), includeEmptyRules);
</span><span class="lines">@@ -238,7 +238,7 @@
</span><span class="cx">     
</span><span class="cx">     clearMatchedRules();
</span><span class="cx"> 
</span><del>-    m_result.ranges.lastUserRule = m_result.matchedProperties.size() - 1;
</del><ins>+    m_result.ranges.lastUserRule = m_result.matchedProperties().size() - 1;
</ins><span class="cx">     MatchRequest matchRequest(m_ruleSets.userStyle(), includeEmptyRules);
</span><span class="cx">     StyleResolver::RuleRange ruleRange = m_result.ranges.userRuleRange();
</span><span class="cx">     collectMatchingRules(matchRequest, ruleRange);
</span><span class="lines">@@ -267,7 +267,7 @@
</span><span class="cx"> {
</span><span class="cx">     clearMatchedRules();
</span><span class="cx">     
</span><del>-    m_result.ranges.lastUARule = m_result.matchedProperties.size() - 1;
</del><ins>+    m_result.ranges.lastUARule = m_result.matchedProperties().size() - 1;
</ins><span class="cx">     StyleResolver::RuleRange ruleRange = m_result.ranges.UARuleRange();
</span><span class="cx">     collectMatchingRules(MatchRequest(rules), ruleRange);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (182129 => 182130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2015-03-30 03:05:48 UTC (rev 182129)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2015-03-30 03:10:48 UTC (rev 182130)
</span><span class="lines">@@ -184,7 +184,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool hasProperty(CSSPropertyID id) const;
</span><span class="cx">     Property&amp; property(CSSPropertyID);
</span><del>-    bool addMatches(const MatchResult&amp;, bool important, int startIndex, int endIndex, bool inheritedOnly = false);
</del><ins>+    void addMatches(const MatchResult&amp;, bool important, int startIndex, int endIndex, bool inheritedOnly = false);
</ins><span class="cx"> 
</span><span class="cx">     void set(CSSPropertyID, CSSValue&amp;, unsigned linkMatchType);
</span><span class="cx">     void setDeferred(CSSPropertyID, CSSValue&amp;, unsigned linkMatchType);
</span><span class="lines">@@ -192,7 +192,7 @@
</span><span class="cx">     void applyDeferredProperties(StyleResolver&amp;);
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    bool addStyleProperties(const StyleProperties&amp;, StyleRule&amp;, bool isImportant, bool inheritedOnly, PropertyWhitelistType, unsigned linkMatchType);
</del><ins>+    void addStyleProperties(const StyleProperties&amp;, StyleRule&amp;, bool isImportant, bool inheritedOnly, PropertyWhitelistType, unsigned linkMatchType);
</ins><span class="cx">     static void setPropertyInternal(Property&amp;, CSSPropertyID, CSSValue&amp;, unsigned linkMatchType);
</span><span class="cx"> 
</span><span class="cx">     Property m_properties[numCSSProperties + 1];
</span><span class="lines">@@ -245,12 +245,41 @@
</span><span class="cx"> 
</span><span class="cx"> void StyleResolver::MatchResult::addMatchedProperties(const StyleProperties&amp; properties, StyleRule* rule, unsigned linkMatchType, PropertyWhitelistType propertyWhitelistType)
</span><span class="cx"> {
</span><del>-    matchedProperties.grow(matchedProperties.size() + 1);
-    StyleResolver::MatchedProperties&amp; newProperties = matchedProperties.last();
</del><ins>+    m_matchedProperties.grow(m_matchedProperties.size() + 1);
+    StyleResolver::MatchedProperties&amp; newProperties = m_matchedProperties.last();
</ins><span class="cx">     newProperties.properties = const_cast&lt;StyleProperties*&gt;(&amp;properties);
</span><span class="cx">     newProperties.linkMatchType = linkMatchType;
</span><span class="cx">     newProperties.whitelistType = propertyWhitelistType;
</span><span class="cx">     matchedRules.append(rule);
</span><ins>+
+    if (isCacheable) {
+        for (unsigned i = 0, count = properties.propertyCount(); i &lt; count; ++i) {
+            // Currently the property cache only copy the non-inherited values and resolve
+            // the inherited ones.
+            // Here we define some exception were we have to resolve some properties that are not inherited
+            // by default. If those exceptions become too common on the web, it should be possible
+            // to build a list of exception to resolve instead of completely disabling the cache.
+
+            StyleProperties::PropertyReference current = properties.propertyAt(i);
+            if (!current.isInherited()) {
+                // If the property value is explicitly inherited, we need to apply further non-inherited properties
+                // as they might override the value inherited here. For this reason we don't allow declarations with
+                // explicitly inherited properties to be cached.
+                const CSSValue&amp; value = *current.value();
+                if (value.isInheritedValue()) {
+                    isCacheable = false;
+                    break;
+                }
+
+                // The value currentColor has implicitely the same side effect. It depends on the value of color,
+                // which is an inherited value, making the non-inherited property implicitely inherited.
+                if (is&lt;CSSPrimitiveValue&gt;(value) &amp;&amp; downcast&lt;CSSPrimitiveValue&gt;(value).getValueID() == CSSValueCurrentcolor) {
+                    isCacheable = false;
+                    break;
+                }
+            }
+        }
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> StyleResolver::StyleResolver(Document&amp; document, bool matchAuthorAndUserStyles)
</span><span class="lines">@@ -835,7 +864,7 @@
</span><span class="cx">     // We don't need to bother with !important. Since there is only ever one
</span><span class="cx">     // decl, there's nothing to override. So just add the first properties.
</span><span class="cx">     CascadedProperties cascade(direction, writingMode);
</span><del>-    cascade.addMatches(result, false, 0, result.matchedProperties.size() - 1);
</del><ins>+    cascade.addMatches(result, false, 0, result.matchedProperties().size() - 1);
</ins><span class="cx"> 
</span><span class="cx">     applyCascadedProperties(cascade, firstCSSProperty, lastHighPriorityProperty);
</span><span class="cx"> 
</span><span class="lines">@@ -962,7 +991,7 @@
</span><span class="cx">         collector.matchAuthorRules(false);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (collector.matchedResult().matchedProperties.isEmpty())
</del><ins>+    if (collector.matchedResult().matchedProperties().isEmpty())
</ins><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="cx">     state.style()-&gt;setStyleType(pseudoStyleRequest.pseudoId);
</span><span class="lines">@@ -1001,7 +1030,7 @@
</span><span class="cx">     extractDirectionAndWritingMode(*m_state.style(), result, direction, writingMode);
</span><span class="cx"> 
</span><span class="cx">     CascadedProperties cascade(direction, writingMode);
</span><del>-    cascade.addMatches(result, false, 0, result.matchedProperties.size() - 1);
</del><ins>+    cascade.addMatches(result, false, 0, result.matchedProperties().size() - 1);
</ins><span class="cx"> 
</span><span class="cx">     applyCascadedProperties(cascade, firstCSSProperty, lastHighPriorityProperty);
</span><span class="cx"> 
</span><span class="lines">@@ -1610,11 +1639,11 @@
</span><span class="cx">         return 0;
</span><span class="cx">     MatchedPropertiesCacheItem&amp; cacheItem = it-&gt;value;
</span><span class="cx"> 
</span><del>-    size_t size = matchResult.matchedProperties.size();
</del><ins>+    size_t size = matchResult.matchedProperties().size();
</ins><span class="cx">     if (size != cacheItem.matchedProperties.size())
</span><span class="cx">         return 0;
</span><span class="cx">     for (size_t i = 0; i &lt; size; ++i) {
</span><del>-        if (matchResult.matchedProperties[i] != cacheItem.matchedProperties[i])
</del><ins>+        if (matchResult.matchedProperties()[i] != cacheItem.matchedProperties[i])
</ins><span class="cx">             return 0;
</span><span class="cx">     }
</span><span class="cx">     if (cacheItem.ranges != matchResult.ranges)
</span><span class="lines">@@ -1633,7 +1662,7 @@
</span><span class="cx"> 
</span><span class="cx">     ASSERT(hash);
</span><span class="cx">     MatchedPropertiesCacheItem cacheItem;
</span><del>-    cacheItem.matchedProperties.appendVector(matchResult.matchedProperties);
</del><ins>+    cacheItem.matchedProperties.appendVector(matchResult.matchedProperties());
</ins><span class="cx">     cacheItem.ranges = matchResult.ranges;
</span><span class="cx">     // Note that we don't cache the original RenderStyle instance. It may be further modified.
</span><span class="cx">     // The RenderStyle in the cache is really just a holder for the substructures and never used as-is.
</span><span class="lines">@@ -1685,7 +1714,7 @@
</span><span class="cx">     bool hadImportantWebkitWritingMode = false;
</span><span class="cx">     bool hadImportantDirection = false;
</span><span class="cx"> 
</span><del>-    for (auto&amp; matchedProperties : matchResult.matchedProperties) {
</del><ins>+    for (const auto&amp; matchedProperties : matchResult.matchedProperties()) {
</ins><span class="cx">         for (unsigned i = 0, count = matchedProperties.properties-&gt;propertyCount(); i &lt; count; ++i) {
</span><span class="cx">             auto property = matchedProperties.properties-&gt;propertyAt(i);
</span><span class="cx">             if (!property.value()-&gt;isPrimitiveValue())
</span><span class="lines">@@ -1714,7 +1743,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(element);
</span><span class="cx">     State&amp; state = m_state;
</span><del>-    unsigned cacheHash = shouldUseMatchedPropertiesCache &amp;&amp; matchResult.isCacheable ? computeMatchedPropertiesHash(matchResult.matchedProperties.data(), matchResult.matchedProperties.size()) : 0;
</del><ins>+    unsigned cacheHash = shouldUseMatchedPropertiesCache &amp;&amp; matchResult.isCacheable ? computeMatchedPropertiesHash(matchResult.matchedProperties().data(), matchResult.matchedProperties().size()) : 0;
</ins><span class="cx">     bool applyInheritedOnly = false;
</span><span class="cx">     const MatchedPropertiesCacheItem* cacheItem = 0;
</span><span class="cx">     if (cacheHash &amp;&amp; (cacheItem = findFromMatchedPropertiesCache(cacheHash, matchResult))
</span><span class="lines">@@ -1748,9 +1777,8 @@
</span><span class="cx">         // If so, we cache the border and background styles so that RenderTheme::adjustStyle()
</span><span class="cx">         // can look at them later to figure out if this is a styled form control or not.
</span><span class="cx">         CascadedProperties cascade(direction, writingMode);
</span><del>-        if (!cascade.addMatches(matchResult, false, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly)
-            || !cascade.addMatches(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly))
-            return applyMatchedProperties(matchResult, element, DoNotUseMatchedPropertiesCache);
</del><ins>+        cascade.addMatches(matchResult, false, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
+        cascade.addMatches(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
</ins><span class="cx"> 
</span><span class="cx">         applyCascadedProperties(cascade, CSSPropertyWebkitRubyPosition, CSSPropertyWebkitRubyPosition);
</span><span class="cx">         adjustStyleForInterCharacterRuby();
</span><span class="lines">@@ -1765,11 +1793,10 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     CascadedProperties cascade(direction, writingMode);
</span><del>-    if (!cascade.addMatches(matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly)
-        || !cascade.addMatches(matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly)
-        || !cascade.addMatches(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly)
-        || !cascade.addMatches(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly))
-        return applyMatchedProperties(matchResult, element, DoNotUseMatchedPropertiesCache);
</del><ins>+    cascade.addMatches(matchResult, false, 0, matchResult.matchedProperties().size() - 1, applyInheritedOnly);
+    cascade.addMatches(matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly);
+    cascade.addMatches(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
+    cascade.addMatches(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
</ins><span class="cx"> 
</span><span class="cx">     applyCascadedProperties(cascade, CSSPropertyWebkitRubyPosition, CSSPropertyWebkitRubyPosition);
</span><span class="cx">     
</span><span class="lines">@@ -2623,18 +2650,16 @@
</span><span class="cx">     m_deferredProperties.append(property);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool StyleResolver::CascadedProperties::addStyleProperties(const StyleProperties&amp; properties, StyleRule&amp;, bool isImportant, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType, unsigned linkMatchType)
</del><ins>+void StyleResolver::CascadedProperties::addStyleProperties(const StyleProperties&amp; properties, StyleRule&amp;, bool isImportant, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType, unsigned linkMatchType)
</ins><span class="cx"> {
</span><span class="cx">     for (unsigned i = 0, count = properties.propertyCount(); i &lt; count; ++i) {
</span><span class="cx">         auto current = properties.propertyAt(i);
</span><span class="cx">         if (isImportant != current.isImportant())
</span><span class="cx">             continue;
</span><span class="cx">         if (inheritedOnly &amp;&amp; !current.isInherited()) {
</span><del>-            // If the property value is explicitly inherited, we need to apply further non-inherited properties
-            // as they might override the value inherited here. For this reason we don't allow declarations with
-            // explicitly inherited properties to be cached.
-            if (current.value()-&gt;isInheritedValue())
-                return false;
</del><ins>+            // We apply the inherited properties only when using the property cache.
+            // A match with a value that is explicitely inherited should never have been cached.
+            ASSERT(!current.value()-&gt;isInheritedValue());
</ins><span class="cx">             continue;
</span><span class="cx">         }
</span><span class="cx">         CSSPropertyID propertyID = current.id();
</span><span class="lines">@@ -2651,20 +2676,17 @@
</span><span class="cx">         else
</span><span class="cx">             set(propertyID, *current.value(), linkMatchType);
</span><span class="cx">     }
</span><del>-    return true;
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool StyleResolver::CascadedProperties::addMatches(const MatchResult&amp; matchResult, bool important, int startIndex, int endIndex, bool inheritedOnly)
</del><ins>+void StyleResolver::CascadedProperties::addMatches(const MatchResult&amp; matchResult, bool important, int startIndex, int endIndex, bool inheritedOnly)
</ins><span class="cx"> {
</span><span class="cx">     if (startIndex == -1)
</span><del>-        return true;
</del><ins>+        return;
</ins><span class="cx"> 
</span><span class="cx">     for (int i = startIndex; i &lt;= endIndex; ++i) {
</span><del>-        const MatchedProperties&amp; matchedProperties = matchResult.matchedProperties[i];
-        if (!addStyleProperties(*matchedProperties.properties, *matchResult.matchedRules[i], important, inheritedOnly, static_cast&lt;PropertyWhitelistType&gt;(matchedProperties.whitelistType), matchedProperties.linkMatchType))
-            return false;
</del><ins>+        const MatchedProperties&amp; matchedProperties = matchResult.matchedProperties()[i];
+        addStyleProperties(*matchedProperties.properties, *matchResult.matchedRules[i], important, inheritedOnly, static_cast&lt;PropertyWhitelistType&gt;(matchedProperties.whitelistType), matchedProperties.linkMatchType);
</ins><span class="cx">     }
</span><del>-    return true;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void StyleResolver::CascadedProperties::applyDeferredProperties(StyleResolver&amp; resolver)
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.h (182129 => 182130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.h        2015-03-30 03:05:48 UTC (rev 182129)
+++ trunk/Source/WebCore/css/StyleResolver.h        2015-03-30 03:10:48 UTC (rev 182130)
</span><span class="lines">@@ -277,12 +277,15 @@
</span><span class="cx"> 
</span><span class="cx">     struct MatchResult {
</span><span class="cx">         MatchResult() : isCacheable(true) { }
</span><del>-        Vector&lt;MatchedProperties, 64&gt; matchedProperties;
</del><span class="cx">         Vector&lt;StyleRule*, 64&gt; matchedRules;
</span><span class="cx">         MatchRanges ranges;
</span><span class="cx">         bool isCacheable;
</span><span class="cx"> 
</span><del>-        void addMatchedProperties(const StyleProperties&amp;, StyleRule* = 0, unsigned linkMatchType = SelectorChecker::MatchAll, PropertyWhitelistType = PropertyWhitelistNone);
</del><ins>+        const Vector&lt;MatchedProperties, 64&gt;&amp; matchedProperties() const { return m_matchedProperties; }
+
+        void addMatchedProperties(const StyleProperties&amp;, StyleRule* = nullptr, unsigned linkMatchType = SelectorChecker::MatchAll, PropertyWhitelistType = PropertyWhitelistNone);
+    private:
+        Vector&lt;MatchedProperties, 64&gt; m_matchedProperties;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre>
</div>
</div>

</body>
</html>