<!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>[169569] 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/169569">169569</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-06-03 14:26:50 -0700 (Tue, 03 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>CSS JIT: add support for the &quot;any&quot; pseudo class
https://bugs.webkit.org/show_bug.cgi?id=133473

Patch by Yusuke Suzuki &lt;utatane.tea@gmail.com&gt; on 2014-06-03
Reviewed by Benjamin Poulain.

Add support for the :any pseudo class.

Source/WebCore:
Test: fast/selectors/pseudo-class-any.html

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):
(WebCore::SelectorCompiler::minimumRegisterRequirements):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatchesAnyPseudoClass):

LayoutTests:
* fast/selectors/pseudo-class-any-expected.txt: Added.
* fast/selectors/pseudo-class-any.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="#trunkSourceWebCorecssjitSelectorCompilercpp">trunk/Source/WebCore/cssjit/SelectorCompiler.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastselectorspseudoclassanyexpectedtxt">trunk/LayoutTests/fast/selectors/pseudo-class-any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastselectorspseudoclassanyhtml">trunk/LayoutTests/fast/selectors/pseudo-class-any.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (169568 => 169569)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-06-03 21:09:07 UTC (rev 169568)
+++ trunk/LayoutTests/ChangeLog        2014-06-03 21:26:50 UTC (rev 169569)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-06-03  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        CSS JIT: add support for the &quot;any&quot; pseudo class
+        https://bugs.webkit.org/show_bug.cgi?id=133473
+
+        Reviewed by Benjamin Poulain.
+
+        Add support for the :any pseudo class.
+
+        * fast/selectors/pseudo-class-any-expected.txt: Added.
+        * fast/selectors/pseudo-class-any.html: Added.
+
</ins><span class="cx"> 2014-06-02  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Update PlatformTimeRanges to use MediaTime rather than doubles for time values.
</span></span></pre></div>
<a id="trunkLayoutTestsfastselectorspseudoclassanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/pseudo-class-any-expected.txt (0 => 169569)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/pseudo-class-any-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/pseudo-class-any-expected.txt        2014-06-03 21:26:50 UTC (rev 169569)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+The pseudo class :any
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+simple :any selector list matched.
+PASS getComputedStyle(document.getElementById(&quot;target1&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+simple :any selector list matched.
+PASS getComputedStyle(document.getElementById(&quot;target2&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+simple :any selector unmatched.
+PASS getComputedStyle(document.getElementById(&quot;target3&quot;)).backgroundColor is &quot;rgb(0, 0, 0)&quot;
+multiple :any selector list matched.
+PASS getComputedStyle(document.getElementById(&quot;target4&quot;)).backgroundColor is &quot;rgb(2, 3, 4)&quot;
+multiple :any selector list matched.
+PASS getComputedStyle(document.getElementById(&quot;target5&quot;)).backgroundColor is &quot;rgb(2, 3, 4)&quot;
+multiple :any selector list unmatched.
+PASS getComputedStyle(document.getElementById(&quot;target6&quot;)).backgroundColor is &quot;rgb(0, 0, 0)&quot;
+multiple :any selector list unmatched.
+PASS getComputedStyle(document.getElementById(&quot;target7&quot;)).backgroundColor is &quot;rgb(0, 0, 0)&quot;
+multiple :any selector list unmatched.
+PASS getComputedStyle(document.getElementById(&quot;target8&quot;)).backgroundColor is &quot;rgb(0, 0, 0)&quot;
+simple :any selector list including :not matched.
+PASS getComputedStyle(document.getElementById(&quot;target9&quot;)).backgroundColor is &quot;rgb(3, 4, 5)&quot;
+simple :any selector list including :not matched.
+PASS getComputedStyle(document.getElementById(&quot;target10&quot;)).backgroundColor is &quot;rgb(3, 4, 5)&quot;
+simple :any selector list including :not matched.
+PASS getComputedStyle(document.getElementById(&quot;target11&quot;)).backgroundColor is &quot;rgb(3, 4, 5)&quot;
+simple :any selector list including :not unmatched.
+PASS getComputedStyle(document.getElementById(&quot;target12&quot;)).backgroundColor is &quot;rgb(0, 0, 0)&quot;
+simple :any selector list including :not unmatched.
+PASS getComputedStyle(document.getElementById(&quot;target13&quot;)).backgroundColor is &quot;rgb(0, 0, 0)&quot;
+:any selector including attributes matched.
+PASS getComputedStyle(document.getElementById(&quot;target14&quot;)).backgroundColor is &quot;rgb(4, 5, 6)&quot;
+:any selector including attributes matched.
+PASS getComputedStyle(document.getElementById(&quot;target15&quot;)).backgroundColor is &quot;rgb(4, 5, 6)&quot;
+:any selector including attributes unmatched.
+PASS getComputedStyle(document.getElementById(&quot;target16&quot;)).backgroundColor is &quot;rgb(0, 0, 0)&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorspseudoclassanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/pseudo-class-any.html (0 => 169569)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/pseudo-class-any.html                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/pseudo-class-any.html        2014-06-03 21:26:50 UTC (rev 169569)
</span><span class="lines">@@ -0,0 +1,183 @@
</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;
+span.target {
+    background-color:rgb(0,0,0);
+}
+
+a:-webkit-any(.house, .horse) span.target {
+    background-color:rgb(1,2,3);
+}
+
+b.rabbit:-webkit-any(.house, .horse):-webkit-any(.cocoa, .cappuccino) span.target {
+    background-color:rgb(2,3,4);
+}
+
+c.rabbit:-webkit-any(.house, :not(.horse)) span.target {
+    background-color:rgb(3,4,5);
+}
+
+/* Maximum register case */
+d &gt; d:-webkit-any([rel=&quot;drink&quot;][data-cocoa][data-cappuccino], .ok) &gt; d &gt; d span.target {
+    background-color:rgb(4,5,6);
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div style=&quot;display:none&quot;&gt;
+    &lt;!-- a:any(.house, .horse) span.target --&gt;
+    &lt;test1&gt;
+        &lt;a class=&quot;house&quot;&gt;
+            &lt;span class=&quot;target&quot; id=&quot;target1&quot;&gt;&lt;/span&gt;
+        &lt;/a&gt;
+
+        &lt;a class=&quot;house&quot;&gt;
+            &lt;span class=&quot;target&quot; id=&quot;target2&quot;&gt;&lt;/span&gt;
+        &lt;/a&gt;
+
+        &lt;a&gt;
+            &lt;span class=&quot;target&quot; id=&quot;target3&quot;&gt;&lt;/span&gt;
+        &lt;/a&gt;
+    &lt;/test1&gt;
+
+    &lt;!-- b.rabbit:-webkit-any(.house, .horse):-webkit-any(.cocoa, .cappuccino) span.target --&gt;
+    &lt;test2&gt;
+        &lt;b class=&quot;rabbit horse cocoa&quot;&gt;
+            &lt;span class=&quot;target&quot; id=&quot;target4&quot;&gt;&lt;/span&gt;
+        &lt;/b&gt;
+
+        &lt;b class=&quot;rabbit house cappuccino&quot;&gt;
+            &lt;span class=&quot;target&quot; id=&quot;target5&quot;&gt;&lt;/span&gt;
+        &lt;/b&gt;
+
+        &lt;b class=&quot;rabbit house horse&quot;&gt;
+            &lt;span class=&quot;target&quot; id=&quot;target6&quot;&gt;&lt;/span&gt;
+        &lt;/b&gt;
+
+        &lt;b class=&quot;horse cocoa&quot;&gt;
+            &lt;span class=&quot;target&quot; id=&quot;target7&quot;&gt;&lt;/span&gt;
+        &lt;/b&gt;
+
+        &lt;b class=&quot;rabbit cocoa cappuccino&quot;&gt;
+            &lt;span class=&quot;target&quot; id=&quot;target8&quot;&gt;&lt;/span&gt;
+        &lt;/b&gt;
+    &lt;/test2&gt;
+
+    &lt;!-- c.rabbit:-webkit-any(.house, :not(.horse)) span.target --&gt;
+    &lt;test3&gt;
+        &lt;c class=&quot;rabbit house&quot;&gt;
+            &lt;span class=&quot;target&quot; id=&quot;target9&quot;&gt;&lt;/span&gt;
+        &lt;/c&gt;
+
+        &lt;c class=&quot;rabbit cappuccino&quot;&gt;
+            &lt;span class=&quot;target&quot; id=&quot;target10&quot;&gt;&lt;/span&gt;
+        &lt;/c&gt;
+
+        &lt;c class=&quot;rabbit&quot;&gt;
+            &lt;span class=&quot;target&quot; id=&quot;target11&quot;&gt;&lt;/span&gt;
+        &lt;/c&gt;
+
+        &lt;c class=&quot;rabbit horse&quot;&gt;
+            &lt;span class=&quot;target&quot; id=&quot;target12&quot;&gt;&lt;/span&gt;
+        &lt;/c&gt;
+
+        &lt;c class=&quot;house&quot;&gt;
+            &lt;span class=&quot;target&quot; id=&quot;target13&quot;&gt;&lt;/span&gt;
+        &lt;/c&gt;
+    &lt;/test3&gt;
+
+    &lt;!-- d &gt; d:-webkit-any([rel=&quot;drink&quot;][data-cocoa][data-cappuccino], .ok) &gt; d &gt; d span.target --&gt;
+    &lt;test4&gt;
+        &lt;d&gt;  &lt;!-- Matched. --&gt;
+            &lt;d rel=&quot;drink&quot; data-cocoa data-cappuccino&gt;
+                &lt;d data-cocoa&gt;  &lt;!-- Failed. Backtracking from the tail. --&gt;
+                    &lt;d&gt;
+                        &lt;d&gt;
+                            &lt;span class=&quot;target&quot; id=&quot;target14&quot;&gt;&lt;/span&gt;
+                        &lt;/d&gt;
+                    &lt;/d&gt;
+                &lt;/d&gt;
+            &lt;/d&gt;
+        &lt;/d&gt;
+
+        &lt;d&gt;  &lt;!-- Matched. --&gt;
+            &lt;d class=&quot;ok&quot;&gt;
+                &lt;d data-cocoa&gt;  &lt;!-- Failed. Backtracking from the tail. --&gt;
+                    &lt;d&gt;
+                        &lt;d&gt;
+                            &lt;span class=&quot;target&quot; id=&quot;target15&quot;&gt;&lt;/span&gt;
+                        &lt;/d&gt;
+                    &lt;/d&gt;
+                &lt;/d&gt;
+            &lt;/d&gt;
+        &lt;/d&gt;
+
+        &lt;a&gt;  &lt;!-- Failed. --&gt;
+            &lt;d class=&quot;ok&quot;&gt;
+                &lt;d data-cocoa&gt;  &lt;!-- Failed. Backtracking from the tail. --&gt;
+                    &lt;d&gt;
+                        &lt;d&gt;
+                            &lt;span class=&quot;target&quot; id=&quot;target16&quot;&gt;&lt;/span&gt;
+                        &lt;/d&gt;
+                    &lt;/d&gt;
+                &lt;/d&gt;
+            &lt;/d&gt;
+        &lt;/a&gt;
+    &lt;/test4&gt;
+&lt;/div&gt;
+&lt;/body&gt;
+&lt;script&gt;
+description('The pseudo class :any');
+
+debug(&quot;simple :any selector list matched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target1&quot;)).backgroundColor', 'rgb(1, 2, 3)');
+
+debug(&quot;simple :any selector list matched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target2&quot;)).backgroundColor', 'rgb(1, 2, 3)');
+
+debug(&quot;simple :any selector unmatched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target3&quot;)).backgroundColor', 'rgb(0, 0, 0)');
+
+debug(&quot;multiple :any selector list matched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target4&quot;)).backgroundColor', 'rgb(2, 3, 4)');
+
+debug(&quot;multiple :any selector list matched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target5&quot;)).backgroundColor', 'rgb(2, 3, 4)');
+
+debug(&quot;multiple :any selector list unmatched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target6&quot;)).backgroundColor', 'rgb(0, 0, 0)');
+
+debug(&quot;multiple :any selector list unmatched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target7&quot;)).backgroundColor', 'rgb(0, 0, 0)');
+
+debug(&quot;multiple :any selector list unmatched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target8&quot;)).backgroundColor', 'rgb(0, 0, 0)');
+
+debug(&quot;simple :any selector list including :not matched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target9&quot;)).backgroundColor', 'rgb(3, 4, 5)');
+
+debug(&quot;simple :any selector list including :not matched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target10&quot;)).backgroundColor', 'rgb(3, 4, 5)');
+
+debug(&quot;simple :any selector list including :not matched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target11&quot;)).backgroundColor', 'rgb(3, 4, 5)');
+
+debug(&quot;simple :any selector list including :not unmatched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target12&quot;)).backgroundColor', 'rgb(0, 0, 0)');
+
+debug(&quot;simple :any selector list including :not unmatched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target13&quot;)).backgroundColor', 'rgb(0, 0, 0)');
+
+debug(&quot;:any selector including attributes matched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target14&quot;)).backgroundColor', 'rgb(4, 5, 6)');
+
+debug(&quot;:any selector including attributes matched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target15&quot;)).backgroundColor', 'rgb(4, 5, 6)');
+
+debug(&quot;:any selector including attributes unmatched.&quot;);
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target16&quot;)).backgroundColor', 'rgb(0, 0, 0)');
+&lt;/script&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 (169568 => 169569)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-06-03 21:09:07 UTC (rev 169568)
+++ trunk/Source/WebCore/ChangeLog        2014-06-03 21:26:50 UTC (rev 169569)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-06-03  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        CSS JIT: add support for the &quot;any&quot; pseudo class
+        https://bugs.webkit.org/show_bug.cgi?id=133473
+
+        Reviewed by Benjamin Poulain.
+
+        Add support for the :any pseudo class.
+
+        Test: fast/selectors/pseudo-class-any.html
+
+        * cssjit/SelectorCompiler.cpp:
+        (WebCore::SelectorCompiler::addPseudoClassType):
+        (WebCore::SelectorCompiler::minimumRegisterRequirements):
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching):
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatchesAnyPseudoClass):
+
</ins><span class="cx"> 2014-06-02  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Update PlatformTimeRanges to use MediaTime rather than doubles for time values.
</span></span></pre></div>
<a id="trunkSourceWebCorecssjitSelectorCompilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (169568 => 169569)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2014-06-03 21:09:07 UTC (rev 169568)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2014-06-03 21:26:50 UTC (rev 169569)
</span><span class="lines">@@ -157,6 +157,7 @@
</span><span class="cx">     Vector&lt;AttributeMatchingInfo&gt; attributes;
</span><span class="cx">     Vector&lt;std::pair&lt;int, int&gt;&gt; nthChildFilters;
</span><span class="cx">     Vector&lt;SelectorFragment&gt; notFilters;
</span><ins>+    Vector&lt;Vector&lt;SelectorFragment&gt;&gt; anyFilters;
</ins><span class="cx"> 
</span><span class="cx">     bool inFunctionalPseudoClass;
</span><span class="cx"> };
</span><span class="lines">@@ -229,6 +230,7 @@
</span><span class="cx">     void generateElementIsLink(Assembler::JumpList&amp; failureCases);
</span><span class="cx">     void generateElementIsNthChild(Assembler::JumpList&amp; failureCases, const SelectorFragment&amp;);
</span><span class="cx">     void generateElementMatchesNotPseudoClass(Assembler::JumpList&amp; failureCases, const SelectorFragment&amp;);
</span><ins>+    void generateElementMatchesAnyPseudoClass(Assembler::JumpList&amp; failureCases, const SelectorFragment&amp;);
</ins><span class="cx">     void generateElementIsRoot(Assembler::JumpList&amp; failureCases);
</span><span class="cx">     void generateElementIsTarget(Assembler::JumpList&amp; failureCases);
</span><span class="cx"> 
</span><span class="lines">@@ -441,6 +443,42 @@
</span><span class="cx">             return functionType;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+    case CSSSelector::PseudoClassAny:
+        {
+            Vector&lt;SelectorFragment&gt; anyFragments;
+            FunctionType functionType = FunctionType::SimpleSelectorChecker;
+            for (const CSSSelector* rootSelector = selector.selectorList()-&gt;first(); rootSelector; rootSelector = CSSSelectorList::next(rootSelector)) {
+                SelectorFragmentList fragmentList;
+                FunctionType subFunctionType = constructFragments(rootSelector, selectorContext, fragmentList);
+
+                // Since this fragment always unmatch against the element, don't insert it to anyFragments.
+                if (subFunctionType == FunctionType::CannotMatchAnything)
+                    continue;
+
+                if (subFunctionType == FunctionType::CannotCompile)
+                    return FunctionType::CannotCompile;
+
+                // :any() may not contain complex selectors which have combinators.
+                ASSERT(fragmentList.size() == 1);
+                if (fragmentList.size() != 1)
+                    return FunctionType::CannotCompile;
+
+                SelectorFragment subFragment = fragmentList.first();
+                subFragment.inFunctionalPseudoClass = true;
+                anyFragments.append(subFragment);
+                functionType = mostRestrictiveFunctionType(functionType, subFunctionType);
+            }
+
+            // Since all fragments in :any() cannot match anything, this :any() filter cannot match anything.
+            if (anyFragments.isEmpty())
+                return FunctionType::CannotMatchAnything;
+
+            ASSERT(!anyFragments.isEmpty());
+            fragment.anyFilters.append(anyFragments);
+
+            return functionType;
+        }
+
</ins><span class="cx">     default:
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -594,6 +632,15 @@
</span><span class="cx">         unsigned notFilterMinimum = minimumRegisterRequirements(subFragment) + backtrackingRegisterRequirements;
</span><span class="cx">         minimum = std::max(minimum, notFilterMinimum);
</span><span class="cx">     }
</span><ins>+
+    // :any pseudo class filters cause some register pressure.
+    for (const auto&amp; subFragments : selectorFragment.anyFilters) {
+        for (const SelectorFragment&amp; subFragment : subFragments) {
+            unsigned anyFilterMinimum = minimumRegisterRequirements(subFragment) + backtrackingRegisterRequirements;
+            minimum = std::max(minimum, anyFilterMinimum);
+        }
+    }
+
</ins><span class="cx">     return minimum;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1654,6 +1701,8 @@
</span><span class="cx">         generateElementIsNthChild(matchingPostTagNameFailureCases, fragment);
</span><span class="cx">     if (!fragment.notFilters.isEmpty())
</span><span class="cx">         generateElementMatchesNotPseudoClass(matchingPostTagNameFailureCases, fragment);
</span><ins>+    if (!fragment.anyFilters.isEmpty())
+        generateElementMatchesAnyPseudoClass(matchingPostTagNameFailureCases, fragment);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SelectorCodeGenerator::generateElementDataMatching(Assembler::JumpList&amp; failureCases, const SelectorFragment&amp; fragment)
</span><span class="lines">@@ -2566,6 +2615,26 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void SelectorCodeGenerator::generateElementMatchesAnyPseudoClass(Assembler::JumpList&amp; failureCases, const SelectorFragment&amp; fragment)
+{
+    for (const auto&amp; subFragments : fragment.anyFilters) {
+        RELEASE_ASSERT(!subFragments.isEmpty());
+
+        // Don't handle the last fragment in this loop.
+        Assembler::JumpList successCases;
+        for (unsigned i = 0; i &lt; subFragments.size() - 1; ++i) {
+            Assembler::JumpList localFailureCases;
+            generateElementMatching(localFailureCases, localFailureCases, subFragments[i]);
+            successCases.append(m_assembler.jump());
+            localFailureCases.link(&amp;m_assembler);
+        }
+
+        // At the last fragment, optimize the failure jump to jump to the non-local failure directly.
+        generateElementMatching(failureCases, failureCases, subFragments.last());
+        successCases.link(&amp;m_assembler);
+    }
+}
+
</ins><span class="cx"> void SelectorCodeGenerator::generateElementIsRoot(Assembler::JumpList&amp; failureCases)
</span><span class="cx"> {
</span><span class="cx">     LocalRegister document(m_registerAllocator);
</span></span></pre>
</div>
</div>

</body>
</html>