<!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>[202358] 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/202358">202358</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-06-22 16:35:25 -0700 (Wed, 22 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>AX: Add support for CSS4 :focus-within pseudo
https://bugs.webkit.org/show_bug.cgi?id=140144

Patch by Benjamin Poulain &lt;bpoulain@apple.com&gt; on 2016-06-22
Reviewed by Antti Koivisto.

Source/WebCore:

Tests: fast/css/pseudo-focus-within-basics.html
       fast/css/pseudo-focus-within-inside-shadow-dom.html
       fast/css/pseudo-focus-within-style-sharing-1.html
       fast/css/pseudo-focus-within-style-sharing-2.html
       fast/selectors/focus-within-style-update.html

* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText):
* css/CSSSelector.h:
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne):
* css/SelectorPseudoClassAndCompatibilityElementMap.in:
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasFocusWithin):
* dom/ContainerNode.cpp:
(WebCore::destroyRenderTreeIfNeeded):
* dom/Element.cpp:
(WebCore::Element::~Element):
(WebCore::Element::setFocus):
(WebCore::Element::unregisterNamedFlowContentElement):
(WebCore::Element::setIsNamedFlowContentElement):
(WebCore::Element::clearIsNamedFlowContentElement):
(WebCore::Element::setStyleAffectedByFocusWithin):
(WebCore::Element::rareDataStyleAffectedByFocusWithin):
(WebCore::Element::rareDataIsNamedFlowContentElement):
* dom/Element.h:
(WebCore::Element::hasFocusWithin):
(WebCore::Element::styleAffectedByFocusWithin):
(WebCore::Element::isNamedFlowContentElement):
(WebCore::Element::setHasFocusWithin):
* dom/ElementRareData.h:
(WebCore::ElementRareData::styleAffectedByFocusWithin):
(WebCore::ElementRareData::setStyleAffectedByFocusWithin):
(WebCore::ElementRareData::isNamedFlowContentElement):
(WebCore::ElementRareData::setIsNamedFlowContentElement):
(WebCore::ElementRareData::ElementRareData):
(WebCore::ElementRareData::resetComputedStyle):
* dom/Node.h:
(WebCore::Node::flagHasFocusWithin):
(WebCore::Node::isNamedFlowContentNode): Deleted.
(WebCore::Node::setIsNamedFlowContentNode): Deleted.
(WebCore::Node::clearIsNamedFlowContentNode): Deleted.
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::clearContentElements):
(WebCore::RenderNamedFlowThread::registerNamedFlowContentElement):
(WebCore::RenderNamedFlowThread::unregisterNamedFlowContentElement):
(WebCore::nextNodeInsideContentElement):
* style/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::updateElementRenderer):
* style/StyleRelations.cpp:
(WebCore::Style::commitRelationsToRenderStyle):
(WebCore::Style::commitRelations):
* style/StyleRelations.h:
* style/StyleSharingResolver.cpp:
(WebCore::Style::SharingResolver::canShareStyleWithElement):

LayoutTests:

* fast/css/css-selector-text-expected.txt:
* fast/css/css-selector-text.html:
* fast/css/css-set-selector-text-expected.txt:
* fast/css/css-set-selector-text.html:
* fast/css/pseudo-focus-within-basics-expected.html: Added.
* fast/css/pseudo-focus-within-basics.html: Added.
* fast/css/pseudo-focus-within-inside-shadow-dom-expected.html: Added.
* fast/css/pseudo-focus-within-inside-shadow-dom.html: Added.
* fast/css/pseudo-focus-within-style-sharing-1-expected.html: Added.
* fast/css/pseudo-focus-within-style-sharing-1.html: Added.
* fast/css/pseudo-focus-within-style-sharing-2-expected.html: Added.
* fast/css/pseudo-focus-within-style-sharing-2.html: Added.
* fast/selectors/focus-within-style-update-expected.txt: Added.
* fast/selectors/focus-within-style-update.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastcsscssselectortextexpectedtxt">trunk/LayoutTests/fast/css/css-selector-text-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcsscssselectortexthtml">trunk/LayoutTests/fast/css/css-selector-text.html</a></li>
<li><a href="#trunkLayoutTestsfastcsscsssetselectortextexpectedtxt">trunk/LayoutTests/fast/css/css-set-selector-text-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcsscsssetselectortexthtml">trunk/LayoutTests/fast/css/css-set-selector-text.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSSelectorcpp">trunk/Source/WebCore/css/CSSSelector.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSSelectorh">trunk/Source/WebCore/css/CSSSelector.h</a></li>
<li><a href="#trunkSourceWebCorecssSelectorCheckercpp">trunk/Source/WebCore/css/SelectorChecker.cpp</a></li>
<li><a href="#trunkSourceWebCorecssSelectorPseudoClassAndCompatibilityElementMapin">trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in</a></li>
<li><a href="#trunkSourceWebCorecssjitSelectorCompilercpp">trunk/Source/WebCore/cssjit/SelectorCompiler.cpp</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodecpp">trunk/Source/WebCore/dom/ContainerNode.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementh">trunk/Source/WebCore/dom/Element.h</a></li>
<li><a href="#trunkSourceWebCoredomElementRareDatah">trunk/Source/WebCore/dom/ElementRareData.h</a></li>
<li><a href="#trunkSourceWebCoredomNodeh">trunk/Source/WebCore/dom/Node.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderNamedFlowThreadcpp">trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleRenderTreeUpdatercpp">trunk/Source/WebCore/style/RenderTreeUpdater.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleStyleRelationscpp">trunk/Source/WebCore/style/StyleRelations.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleStyleRelationsh">trunk/Source/WebCore/style/StyleRelations.h</a></li>
<li><a href="#trunkSourceWebCorestyleStyleSharingResolvercpp">trunk/Source/WebCore/style/StyleSharingResolver.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcsspseudofocuswithinbasicsexpectedhtml">trunk/LayoutTests/fast/css/pseudo-focus-within-basics-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudofocuswithinbasicshtml">trunk/LayoutTests/fast/css/pseudo-focus-within-basics.html</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudofocuswithininsideshadowdomexpectedhtml">trunk/LayoutTests/fast/css/pseudo-focus-within-inside-shadow-dom-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudofocuswithininsideshadowdomhtml">trunk/LayoutTests/fast/css/pseudo-focus-within-inside-shadow-dom.html</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudofocuswithinstylesharing1expectedhtml">trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-1-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudofocuswithinstylesharing1html">trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-1.html</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudofocuswithinstylesharing2expectedhtml">trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-2-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudofocuswithinstylesharing2html">trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-2.html</a></li>
<li><a href="#trunkLayoutTestsfastselectorsfocuswithinstyleupdateexpectedtxt">trunk/LayoutTests/fast/selectors/focus-within-style-update-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastselectorsfocuswithinstyleupdatehtml">trunk/LayoutTests/fast/selectors/focus-within-style-update.html</a></li>
<li><a href="#trunkLayoutTestsfastselectorsfocuswithinwithselectorcheckerexpectedtxt">trunk/LayoutTests/fast/selectors/focus-within-with-selector-checker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastselectorsfocuswithinwithselectorcheckerhtml">trunk/LayoutTests/fast/selectors/focus-within-with-selector-checker.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/LayoutTests/ChangeLog        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2016-06-22  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        AX: Add support for CSS4 :focus-within pseudo
+        https://bugs.webkit.org/show_bug.cgi?id=140144
+
+        Reviewed by Antti Koivisto.
+
+        * fast/css/css-selector-text-expected.txt:
+        * fast/css/css-selector-text.html:
+        * fast/css/css-set-selector-text-expected.txt:
+        * fast/css/css-set-selector-text.html:
+        * fast/css/pseudo-focus-within-basics-expected.html: Added.
+        * fast/css/pseudo-focus-within-basics.html: Added.
+        * fast/css/pseudo-focus-within-inside-shadow-dom-expected.html: Added.
+        * fast/css/pseudo-focus-within-inside-shadow-dom.html: Added.
+        * fast/css/pseudo-focus-within-style-sharing-1-expected.html: Added.
+        * fast/css/pseudo-focus-within-style-sharing-1.html: Added.
+        * fast/css/pseudo-focus-within-style-sharing-2-expected.html: Added.
+        * fast/css/pseudo-focus-within-style-sharing-2.html: Added.
+        * fast/selectors/focus-within-style-update-expected.txt: Added.
+        * fast/selectors/focus-within-style-update.html: Added.
+
</ins><span class="cx"> 2016-06-17  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION: Double tap to zoom does not work on yahoo finance
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsscssselectortextexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/css-selector-text-expected.txt (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/css-selector-text-expected.txt        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/LayoutTests/fast/css/css-selector-text-expected.txt        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -216,6 +216,26 @@
</span><span class="cx"> PASS parseThenSerializeRule('a#b::-webkit-input-placeholder { }') is 'a#b::-webkit-input-placeholder { }'
</span><span class="cx"> PASS parseThenSerializeRule('a[b].c#d::-webkit-input-placeholder { }') is 'a[b].c#d::-webkit-input-placeholder { }'
</span><span class="cx"> 
</span><ins>+PASS parseThenSerializeRule('a[b]:default { }') is 'a[b]:default { }'
+PASS parseThenSerializeRule('a.b:default { }') is 'a.b:default { }'
+PASS parseThenSerializeRule('a#b:default { }') is 'a#b:default { }'
+PASS parseThenSerializeRule('a[b].c#d:default { }') is 'a[b].c#d:default { }'
+
+PASS parseThenSerializeRule('a[b]:in-range { }') is 'a[b]:in-range { }'
+PASS parseThenSerializeRule('a.b:in-range { }') is 'a.b:in-range { }'
+PASS parseThenSerializeRule('a#b:in-range { }') is 'a#b:in-range { }'
+PASS parseThenSerializeRule('a[b].c#d:in-range { }') is 'a[b].c#d:in-range { }'
+
+PASS parseThenSerializeRule('a[b]:out-of-range { }') is 'a[b]:out-of-range { }'
+PASS parseThenSerializeRule('a.b:out-of-range { }') is 'a.b:out-of-range { }'
+PASS parseThenSerializeRule('a#b:out-of-range { }') is 'a#b:out-of-range { }'
+PASS parseThenSerializeRule('a[b].c#d:out-of-range { }') is 'a[b].c#d:out-of-range { }'
+
+PASS parseThenSerializeRule('a[b]:focus-within { }') is 'a[b]:focus-within { }'
+PASS parseThenSerializeRule('a.b:focus-within { }') is 'a.b:focus-within { }'
+PASS parseThenSerializeRule('a#b:focus-within { }') is 'a#b:focus-within { }'
+PASS parseThenSerializeRule('a[b].c#d:focus-within { }') is 'a[b].c#d:focus-within { }'
+
</ins><span class="cx"> PASS parseThenSerializeRule('input:not([type=&quot;file&quot;]):focus { }') is 'input:not([type=&quot;file&quot;]):focus { }'
</span><span class="cx"> PASS parseThenSerializeRule(':-webkit-any([type=&quot;file&quot;]) { }') is ':-webkit-any([type=&quot;file&quot;]) { }'
</span><span class="cx"> PASS parseThenSerializeRule(':-webkit-any(:hover) { }') is ':-webkit-any(:hover) { }'
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsscssselectortexthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/css-selector-text.html (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/css-selector-text.html        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/LayoutTests/fast/css/css-selector-text.html        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -307,6 +307,34 @@
</span><span class="cx"> 
</span><span class="cx"> debug('');
</span><span class="cx"> 
</span><ins>+testSelectorRoundTrip(&quot;a[b]:default&quot;);
+testSelectorRoundTrip(&quot;a.b:default&quot;);
+testSelectorRoundTrip(&quot;a#b:default&quot;);
+testSelectorRoundTrip(&quot;a[b].c#d:default&quot;);
+
+debug('');
+
+testSelectorRoundTrip(&quot;a[b]:in-range&quot;);
+testSelectorRoundTrip(&quot;a.b:in-range&quot;);
+testSelectorRoundTrip(&quot;a#b:in-range&quot;);
+testSelectorRoundTrip(&quot;a[b].c#d:in-range&quot;);
+
+debug('');
+
+testSelectorRoundTrip(&quot;a[b]:out-of-range&quot;);
+testSelectorRoundTrip(&quot;a.b:out-of-range&quot;);
+testSelectorRoundTrip(&quot;a#b:out-of-range&quot;);
+testSelectorRoundTrip(&quot;a[b].c#d:out-of-range&quot;);
+
+debug('');
+
+testSelectorRoundTrip(&quot;a[b]:focus-within&quot;);
+testSelectorRoundTrip(&quot;a.b:focus-within&quot;);
+testSelectorRoundTrip(&quot;a#b:focus-within&quot;);
+testSelectorRoundTrip(&quot;a[b].c#d:focus-within&quot;);
+
+debug('');
+
</ins><span class="cx"> testSelectorRoundTrip('input:not([type=&quot;file&quot;]):focus');
</span><span class="cx"> testSelectorRoundTrip(':-webkit-any([type=&quot;file&quot;])');
</span><span class="cx"> testSelectorRoundTrip(':-webkit-any(:hover)');
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsscsssetselectortextexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/css-set-selector-text-expected.txt (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/css-set-selector-text-expected.txt        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/LayoutTests/fast/css/css-set-selector-text-expected.txt        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -218,6 +218,26 @@
</span><span class="cx"> PASS setThenReadSelectorText('a#b::-webkit-input-placeholder') is 'a#b::-webkit-input-placeholder'
</span><span class="cx"> PASS setThenReadSelectorText('a[b].c#d::-webkit-input-placeholder') is 'a[b].c#d::-webkit-input-placeholder'
</span><span class="cx"> 
</span><ins>+PASS setThenReadSelectorText('a[b]:default') is 'a[b]:default'
+PASS setThenReadSelectorText('a.b:default') is 'a.b:default'
+PASS setThenReadSelectorText('a#b:default') is 'a#b:default'
+PASS setThenReadSelectorText('a[b].c#d:default') is 'a[b].c#d:default'
+
+PASS setThenReadSelectorText('a[b]:in-range') is 'a[b]:in-range'
+PASS setThenReadSelectorText('a.b:in-range') is 'a.b:in-range'
+PASS setThenReadSelectorText('a#b:in-range') is 'a#b:in-range'
+PASS setThenReadSelectorText('a[b].c#d:in-range') is 'a[b].c#d:in-range'
+
+PASS setThenReadSelectorText('a[b]:out-of-range') is 'a[b]:out-of-range'
+PASS setThenReadSelectorText('a.b:out-of-range') is 'a.b:out-of-range'
+PASS setThenReadSelectorText('a#b:out-of-range') is 'a#b:out-of-range'
+PASS setThenReadSelectorText('a[b].c#d:out-of-range') is 'a[b].c#d:out-of-range'
+
+PASS setThenReadSelectorText('a[b]:focus-within') is 'a[b]:focus-within'
+PASS setThenReadSelectorText('a.b:focus-within') is 'a.b:focus-within'
+PASS setThenReadSelectorText('a#b:focus-within') is 'a#b:focus-within'
+PASS setThenReadSelectorText('a[b].c#d:focus-within') is 'a[b].c#d:focus-within'
+
</ins><span class="cx"> PASS setThenReadSelectorText('input:not([type=&quot;file&quot;]):focus') is 'input:not([type=&quot;file&quot;]):focus'
</span><span class="cx"> PASS setThenReadSelectorText(':-webkit-any([type=&quot;file&quot;])') is ':-webkit-any([type=&quot;file&quot;])'
</span><span class="cx"> PASS setThenReadSelectorText(':-webkit-any(:hover)') is ':-webkit-any(:hover)'
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsscsssetselectortexthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/css-set-selector-text.html (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/css-set-selector-text.html        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/LayoutTests/fast/css/css-set-selector-text.html        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -311,6 +311,34 @@
</span><span class="cx"> 
</span><span class="cx"> debug('');
</span><span class="cx"> 
</span><ins>+testSelectorRoundTrip(&quot;a[b]:default&quot;);
+testSelectorRoundTrip(&quot;a.b:default&quot;);
+testSelectorRoundTrip(&quot;a#b:default&quot;);
+testSelectorRoundTrip(&quot;a[b].c#d:default&quot;);
+
+debug('');
+
+testSelectorRoundTrip(&quot;a[b]:in-range&quot;);
+testSelectorRoundTrip(&quot;a.b:in-range&quot;);
+testSelectorRoundTrip(&quot;a#b:in-range&quot;);
+testSelectorRoundTrip(&quot;a[b].c#d:in-range&quot;);
+
+debug('');
+
+testSelectorRoundTrip(&quot;a[b]:out-of-range&quot;);
+testSelectorRoundTrip(&quot;a.b:out-of-range&quot;);
+testSelectorRoundTrip(&quot;a#b:out-of-range&quot;);
+testSelectorRoundTrip(&quot;a[b].c#d:out-of-range&quot;);
+
+debug('');
+
+testSelectorRoundTrip(&quot;a[b]:focus-within&quot;);
+testSelectorRoundTrip(&quot;a.b:focus-within&quot;);
+testSelectorRoundTrip(&quot;a#b:focus-within&quot;);
+testSelectorRoundTrip(&quot;a[b].c#d:focus-within&quot;);
+
+debug('');
+
</ins><span class="cx"> testSelectorRoundTrip('input:not([type=&quot;file&quot;]):focus');
</span><span class="cx"> testSelectorRoundTrip(':-webkit-any([type=&quot;file&quot;])');
</span><span class="cx"> testSelectorRoundTrip(':-webkit-any(:hover)');
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudofocuswithinbasicsexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-focus-within-basics-expected.html (0 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-focus-within-basics-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-focus-within-basics-expected.html        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html class=&quot;focus-within&quot;&gt;
+&lt;head&gt;
+&lt;style&gt;
+    * {
+        border: none;
+    }
+    .focus-within {
+        border: 2px solid green;
+    }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body class=&quot;focus-within&quot;&gt;
+    &lt;form id=&quot;form&quot;&gt;
+    &lt;/form&gt;
+    &lt;div class=&quot;focus-within&quot;&gt;
+        &lt;input form=&quot;form&quot; id=&quot;input&quot; autofocus  class=&quot;focus-within&quot;&gt;
+    &lt;/div&gt;
+    &lt;script&gt;
+        document.getElementById(&quot;input&quot;).focus();
+    &lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudofocuswithinbasicshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-focus-within-basics.html (0 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-focus-within-basics.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-focus-within-basics.html        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+    * {
+        border: none;
+    }
+    :focus-within {
+        border: 2px solid green;
+    }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;form id=&quot;form&quot;&gt;
+    &lt;/form&gt;
+    &lt;div&gt;
+        &lt;input form=&quot;form&quot; id=&quot;input&quot; autofocus&gt;
+    &lt;/div&gt;
+    &lt;script&gt;
+        document.getElementById(&quot;input&quot;).focus();
+    &lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudofocuswithininsideshadowdomexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-focus-within-inside-shadow-dom-expected.html (0 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-focus-within-inside-shadow-dom-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-focus-within-inside-shadow-dom-expected.html        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html class=&quot;focus-within&quot;&gt;
+&lt;head&gt;
+&lt;style&gt;
+    * {
+        border: none;
+    }
+    .focus-within {
+        border: 2px solid green;
+    }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body class=&quot;focus-within&quot;&gt;
+    &lt;div id=&quot;root&quot; class=&quot;focus-within&quot;&gt;
+    &lt;/div&gt;
+    &lt;script&gt;
+        let rootElement = document.getElementById('root');
+        let firstRoot = rootElement.attachShadow({mode: 'closed'});
+        let insideDiv = document.createElement(&quot;div&quot;);
+        insideDiv.innerText = &quot;Foobar&quot;;
+        insideDiv.className = &quot;focus-within&quot;;
+        let inputElement = document.createElement(&quot;input&quot;)
+        inputElement.className = &quot;focus-within&quot;;
+        insideDiv.appendChild(inputElement);
+        firstRoot.appendChild(insideDiv);
+        inputElement.focus();
+    &lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudofocuswithininsideshadowdomhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-focus-within-inside-shadow-dom.html (0 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-focus-within-inside-shadow-dom.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-focus-within-inside-shadow-dom.html        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+    * {
+        border: none;
+    }
+    :focus-within {
+        border: 2px solid green;
+    }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div id=&quot;root&quot;&gt;
+    &lt;/div&gt;
+    &lt;script&gt;
+        let rootElement = document.getElementById('root');
+        let firstRoot = rootElement.attachShadow({mode: 'closed'});
+        let insideDiv = document.createElement(&quot;div&quot;);
+        insideDiv.innerText = &quot;Foobar&quot;;
+        let inputElement = document.createElement(&quot;input&quot;)
+        insideDiv.appendChild(inputElement);
+        firstRoot.appendChild(insideDiv);
+        inputElement.focus();
+    &lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudofocuswithinstylesharing1expectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-1-expected.html (0 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-1-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-1-expected.html        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html class=&quot;focus-within&quot;&gt;
+&lt;head&gt;
+&lt;style&gt;
+    * {
+        border: none;
+    }
+    .focus-within {
+        border: 2px solid green;
+    }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body class=&quot;focus-within&quot;&gt;
+    &lt;div class=&quot;focus-within&quot;&gt;
+        &lt;input form=&quot;form&quot; id=&quot;input&quot; autofocus  class=&quot;focus-within&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        Foo
+    &lt;/div&gt;
+    &lt;div&gt;
+        Bar
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudofocuswithinstylesharing1html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-1.html (0 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-1.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-1.html        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+    * {
+        border: none;
+    }
+    :focus-within {
+        border: 2px solid green;
+    }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div&gt;
+        &lt;input form=&quot;form&quot; id=&quot;input&quot; autofocus&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        Foo
+    &lt;/div&gt;
+    &lt;div&gt;
+        Bar
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudofocuswithinstylesharing2expectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-2-expected.html (0 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-2-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-2-expected.html        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html class=&quot;focus-within&quot;&gt;
+&lt;head&gt;
+&lt;style&gt;
+    * {
+        border: none;
+    }
+    .focus-within {
+        border: 2px solid green;
+    }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body class=&quot;focus-within&quot;&gt;
+    &lt;div class=&quot;focus-within&quot;&gt;
+        &lt;input&gt;
+        &lt;input&gt;
+        &lt;input&gt;
+        &lt;input class=&quot;focus-within&quot;&gt;
+        &lt;input&gt;
+        &lt;input&gt;
+        &lt;input&gt;
+    &lt;/div&gt;
+    &lt;script&gt;
+        let midInput = document.getElementsByTagName(&quot;input&quot;)[3];
+        midInput.focus();
+    &lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudofocuswithinstylesharing2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-2.html (0 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-2.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-focus-within-style-sharing-2.html        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+    * {
+        border: none;
+    }
+    :focus-within {
+        border: 2px solid green;
+    }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div&gt;
+        &lt;input&gt;
+        &lt;input&gt;
+        &lt;input&gt;
+        &lt;input&gt;
+        &lt;input&gt;
+        &lt;input&gt;
+        &lt;input&gt;
+    &lt;/div&gt;
+    &lt;script&gt;
+        let midInput = document.getElementsByTagName(&quot;input&quot;)[3];
+        midInput.focus();
+    &lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsfocuswithinstyleupdateexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/focus-within-style-update-expected.txt (0 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/focus-within-style-update-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/focus-within-style-update-expected.txt        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+Check the basic features of the :focus-within pseudo class
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Initial State
+PASS elementsStyledWithFocusWithinSelector() is []
+PASS elementsMatchingFocusWithinSelector() is []
+Focus target1
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+Focus target2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+Set display none on target2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS target2.matches(&quot;:focus&quot;) is true
+Focus target1
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+Try to focus target2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS target1.matches(&quot;:focus&quot;) is true
+PASS target2.matches(&quot;:focus&quot;) is false
+Set display back on target2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+Focus target2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+Set display none on container2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS target2.matches(&quot;:focus&quot;) is true
+Focus target1
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+Try to focus target2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS target1.matches(&quot;:focus&quot;) is true
+PASS target2.matches(&quot;:focus&quot;) is false
+Set display back on container2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+Detach container1 from the document
+PASS elementsStyledWithFocusWithinSelector() is []
+PASS elementsMatchingFocusWithinSelector() is []
+PASS container1.querySelectorAll(&quot;:focus-within&quot;).length is 0
+PASS target1.matches(&quot;:focus&quot;) is false
+PASS target2.matches(&quot;:focus&quot;) is false
+Try to focus target1
+PASS elementsStyledWithFocusWithinSelector() is []
+PASS elementsMatchingFocusWithinSelector() is []
+PASS container1.querySelectorAll(&quot;:focus-within&quot;).length is 0
+PASS target1.matches(&quot;:focus&quot;) is false
+PASS target2.matches(&quot;:focus&quot;) is false
+Focus target2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+Attach container1 in container2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+Focus target1
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+Move target1 in container2
+PASS elementsStyledWithFocusWithinSelector() is []
+PASS elementsMatchingFocusWithinSelector() is []
+PASS target1.matches(&quot;:focus&quot;) is false
+PASS target2.matches(&quot;:focus&quot;) is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsfocuswithinstyleupdatehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/focus-within-style-update.html (0 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/focus-within-style-update.html                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/focus-within-style-update.html        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -0,0 +1,170 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html id=&quot;html&quot;&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;style id=&quot;style&quot;&gt;
+* {
+    background-color: white;
+}
+:focus-within {
+    background-color: rgb(1, 2, 3);
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body id=&quot;body&quot;&gt;
+    &lt;div id=&quot;webkit-test&quot;&gt;
+        &lt;div id=&quot;container1&quot;&gt;
+            &lt;div id=&quot;sibling1&quot;&gt;&lt;/div&gt;
+            &lt;div id=&quot;sibling2&quot;&gt;
+                &lt;input id=&quot;target1&quot;&gt;
+            &lt;/div&gt;
+            &lt;div id=&quot;sibling3&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+        &lt;div id=&quot;container2&quot;&gt;
+            &lt;div id=&quot;sibling4&quot;&gt;&lt;/div&gt;
+            &lt;div id=&quot;sibling5&quot;&gt;
+                &lt;textarea id=&quot;target2&quot;&gt;&lt;/textarea&gt;
+            &lt;/div&gt;
+            &lt;div id=&quot;sibling6&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;script&gt;
+&quot;use strict&quot;;
+description('Check the basic features of the :focus-within pseudo class');
+
+function elementsStyledWithFocusWithinSelector() {
+    let elements = [];
+    for (let element of document.querySelectorAll(&quot;*&quot;)) {
+        if (getComputedStyle(element).backgroundColor === 'rgb(1, 2, 3)') {
+            elements.push(element.id);
+        }
+    }
+    return elements;
+}
+
+function elementsMatchingFocusWithinSelector() {
+    let elements = [];
+    for (let element of document.querySelectorAll(&quot;:focus-within&quot;)) {
+        elements.push(element.id);
+    }
+    return elements;
+}
+
+debug(&quot;Initial State&quot;);
+shouldBe('elementsStyledWithFocusWithinSelector()', '[]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[]');
+
+debug(&quot;Focus target1&quot;);
+var target1 = document.getElementById(&quot;target1&quot;);
+target1.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+
+debug(&quot;Focus target2&quot;);
+var target2 = document.getElementById(&quot;target2&quot;);
+target2.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+
+debug(&quot;Set display none on target2&quot;);
+target2.style.display = &quot;none&quot;;
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBeTrue('target2.matches(&quot;:focus&quot;)');
+
+debug(&quot;Focus target1&quot;);
+target1.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+
+debug(&quot;Try to focus target2&quot;);
+target2.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBeTrue('target1.matches(&quot;:focus&quot;)');
+shouldBeFalse('target2.matches(&quot;:focus&quot;)');
+
+debug(&quot;Set display back on target2&quot;);
+target2.style.display = &quot;revert&quot;;
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+
+debug(&quot;Focus target2&quot;);
+target2.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+
+debug(&quot;Set display none on container2&quot;);
+var container2 = document.getElementById(&quot;container2&quot;);
+container2.style.display = &quot;none&quot;;
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBeTrue('target2.matches(&quot;:focus&quot;)');
+
+debug(&quot;Focus target1&quot;);
+target1.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+
+debug(&quot;Try to focus target2&quot;);
+target2.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBeTrue('target1.matches(&quot;:focus&quot;)');
+shouldBeFalse('target2.matches(&quot;:focus&quot;)');
+
+debug(&quot;Set display back on container2&quot;);
+var container2 = document.getElementById(&quot;container2&quot;);
+container2.style.display = &quot;revert&quot;;
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+
+debug(&quot;Detach container1 from the document&quot;);
+var container1 = document.getElementById(&quot;container1&quot;);
+container1.parentElement.removeChild(container1);
+shouldBe('elementsStyledWithFocusWithinSelector()', '[]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[]');
+shouldBe('container1.querySelectorAll(&quot;:focus-within&quot;).length', '0');
+shouldBeFalse('target1.matches(&quot;:focus&quot;)');
+shouldBeFalse('target2.matches(&quot;:focus&quot;)');
+
+debug(&quot;Try to focus target1&quot;);
+target1.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[]');
+shouldBe('container1.querySelectorAll(&quot;:focus-within&quot;).length', '0');
+shouldBeFalse('target1.matches(&quot;:focus&quot;)');
+shouldBeFalse('target2.matches(&quot;:focus&quot;)');
+
+debug(&quot;Focus target2&quot;);
+target2.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+
+debug(&quot;Attach container1 in container2&quot;);
+container2.appendChild(container1);
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+
+debug(&quot;Focus target1&quot;);
+target1.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+
+debug(&quot;Move target1 in container2&quot;);
+container2.appendChild(target1);
+shouldBe('elementsStyledWithFocusWithinSelector()', '[]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[]');
+shouldBeFalse('target1.matches(&quot;:focus&quot;)');
+shouldBeFalse('target2.matches(&quot;:focus&quot;)');
+
+gc();
+
+// Clean up the test.
+document.getElementById(&quot;webkit-test&quot;).style.display = &quot;none&quot;;
+document.getElementById(&quot;style&quot;).innerHTML = &quot;&quot;;
+
+&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="trunkLayoutTestsfastselectorsfocuswithinwithselectorcheckerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/focus-within-with-selector-checker-expected.txt (0 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/focus-within-with-selector-checker-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/focus-within-with-selector-checker-expected.txt        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+Test :focus-within with selectors not compiled by CSS JIT
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Initial State
+PASS elementsStyledWithFocusWithinSelector() is []
+PASS elementsMatchingFocusWithinSelector() is []
+Focus target1
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+Focus target2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+Set display none on target2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS target2.matches(&quot;:focus&quot;) is true
+Focus target1
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+Try to focus target2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS target1.matches(&quot;:focus&quot;) is true
+PASS target2.matches(&quot;:focus&quot;) is false
+Set display back on target2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+Focus target2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+Set display none on container2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS target2.matches(&quot;:focus&quot;) is true
+Focus target1
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+Try to focus target2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS target1.matches(&quot;:focus&quot;) is true
+PASS target2.matches(&quot;:focus&quot;) is false
+Set display back on container2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+Detach container1 from the document
+PASS elementsStyledWithFocusWithinSelector() is []
+PASS elementsMatchingFocusWithinSelector() is []
+PASS container1.querySelectorAll(&quot;:focus-within&quot;).length is 0
+PASS target1.matches(&quot;:focus&quot;) is false
+PASS target2.matches(&quot;:focus&quot;) is false
+Try to focus target1
+PASS elementsStyledWithFocusWithinSelector() is []
+PASS elementsMatchingFocusWithinSelector() is []
+PASS container1.querySelectorAll(&quot;:focus-within&quot;).length is 0
+PASS target1.matches(&quot;:focus&quot;) is false
+PASS target2.matches(&quot;:focus&quot;) is false
+Focus target2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+Attach container1 in container2
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]
+Focus target1
+PASS elementsStyledWithFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+PASS elementsMatchingFocusWithinSelector() is [&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]
+Move target1 in container2
+PASS elementsStyledWithFocusWithinSelector() is []
+PASS elementsMatchingFocusWithinSelector() is []
+PASS target1.matches(&quot;:focus&quot;) is false
+PASS target2.matches(&quot;:focus&quot;) is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsfocuswithinwithselectorcheckerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/focus-within-with-selector-checker.html (0 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/focus-within-with-selector-checker.html                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/focus-within-with-selector-checker.html        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -0,0 +1,173 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html id=&quot;html&quot;&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;style id=&quot;style&quot;&gt;
+* {
+    background-color: white;
+    color: rgb(2, 3, 4);
+}
+:matches(:root, :nth-of-type(n), :not(#specificity-trick), :nth-last-of-type(n)):focus-within {
+    background-color: rgb(1, 2, 3);
+}
+:matches(:root, :nth-last-of-type(n), :not(#specificity-trick)):focus-within {
+    color: rgb(5, 6, 7);
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body id=&quot;body&quot;&gt;
+    &lt;div id=&quot;webkit-test&quot;&gt;
+        &lt;div id=&quot;container1&quot;&gt;
+            &lt;div id=&quot;sibling1&quot;&gt;&lt;/div&gt;
+            &lt;div id=&quot;sibling2&quot;&gt;
+                &lt;input id=&quot;target1&quot;&gt;
+            &lt;/div&gt;
+            &lt;div id=&quot;sibling3&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+        &lt;div id=&quot;container2&quot;&gt;
+            &lt;div id=&quot;sibling4&quot;&gt;&lt;/div&gt;
+            &lt;div id=&quot;sibling5&quot;&gt;
+                &lt;textarea id=&quot;target2&quot;&gt;&lt;/textarea&gt;
+            &lt;/div&gt;
+            &lt;div id=&quot;sibling6&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;script&gt;
+&quot;use strict&quot;;
+description('Test :focus-within with selectors not compiled by CSS JIT');
+
+function elementsStyledWithFocusWithinSelector() {
+    let elements = [];
+    for (let element of document.querySelectorAll(&quot;*&quot;)) {
+        let computedStyle = getComputedStyle(element);
+        if (computedStyle.backgroundColor === 'rgb(1, 2, 3)' &amp;&amp; computedStyle.color === 'rgb(5, 6, 7)') {
+            elements.push(element.id);
+        }
+    }
+    return elements;
+}
+
+function elementsMatchingFocusWithinSelector() {
+    let elements = [];
+    for (let element of document.querySelectorAll(&quot;:matches(:root, :nth-of-type(n), :not(#specificity-trick), :nth-last-of-type(n)):focus-within&quot;)) {
+        elements.push(element.id);
+    }
+    return elements;
+}
+
+debug(&quot;Initial State&quot;);
+shouldBe('elementsStyledWithFocusWithinSelector()', '[]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[]');
+
+debug(&quot;Focus target1&quot;);
+var target1 = document.getElementById(&quot;target1&quot;);
+target1.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+
+debug(&quot;Focus target2&quot;);
+var target2 = document.getElementById(&quot;target2&quot;);
+target2.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+
+debug(&quot;Set display none on target2&quot;);
+target2.style.display = &quot;none&quot;;
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBeTrue('target2.matches(&quot;:focus&quot;)');
+
+debug(&quot;Focus target1&quot;);
+target1.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+
+debug(&quot;Try to focus target2&quot;);
+target2.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBeTrue('target1.matches(&quot;:focus&quot;)');
+shouldBeFalse('target2.matches(&quot;:focus&quot;)');
+
+debug(&quot;Set display back on target2&quot;);
+target2.style.display = &quot;revert&quot;;
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+
+debug(&quot;Focus target2&quot;);
+target2.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+
+debug(&quot;Set display none on container2&quot;);
+var container2 = document.getElementById(&quot;container2&quot;);
+container2.style.display = &quot;none&quot;;
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBeTrue('target2.matches(&quot;:focus&quot;)');
+
+debug(&quot;Focus target1&quot;);
+target1.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+
+debug(&quot;Try to focus target2&quot;);
+target2.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBeTrue('target1.matches(&quot;:focus&quot;)');
+shouldBeFalse('target2.matches(&quot;:focus&quot;)');
+
+debug(&quot;Set display back on container2&quot;);
+var container2 = document.getElementById(&quot;container2&quot;);
+container2.style.display = &quot;revert&quot;;
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+
+debug(&quot;Detach container1 from the document&quot;);
+var container1 = document.getElementById(&quot;container1&quot;);
+container1.parentElement.removeChild(container1);
+shouldBe('elementsStyledWithFocusWithinSelector()', '[]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[]');
+shouldBe('container1.querySelectorAll(&quot;:focus-within&quot;).length', '0');
+shouldBeFalse('target1.matches(&quot;:focus&quot;)');
+shouldBeFalse('target2.matches(&quot;:focus&quot;)');
+
+debug(&quot;Try to focus target1&quot;);
+target1.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[]');
+shouldBe('container1.querySelectorAll(&quot;:focus-within&quot;).length', '0');
+shouldBeFalse('target1.matches(&quot;:focus&quot;)');
+shouldBeFalse('target2.matches(&quot;:focus&quot;)');
+
+debug(&quot;Focus target2&quot;);
+target2.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+
+debug(&quot;Attach container1 in container2&quot;);
+container2.appendChild(container1);
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;sibling5&quot;, &quot;target2&quot;]');
+
+debug(&quot;Focus target1&quot;);
+target1.focus();
+shouldBe('elementsStyledWithFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[&quot;html&quot;, &quot;body&quot;, &quot;webkit-test&quot;, &quot;container2&quot;, &quot;container1&quot;, &quot;sibling2&quot;, &quot;target1&quot;]');
+
+debug(&quot;Move target1 in container2&quot;);
+container2.appendChild(target1);
+shouldBe('elementsStyledWithFocusWithinSelector()', '[]');
+shouldBe('elementsMatchingFocusWithinSelector()', '[]');
+shouldBeFalse('target1.matches(&quot;:focus&quot;)');
+shouldBeFalse('target2.matches(&quot;:focus&quot;)');
+
+// Clean up the test.
+document.getElementById(&quot;webkit-test&quot;).style.display = &quot;none&quot;;
+document.getElementById(&quot;style&quot;).innerHTML = &quot;&quot;;
+
+&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 (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/ChangeLog        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -1,3 +1,68 @@
</span><ins>+2016-06-22  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        AX: Add support for CSS4 :focus-within pseudo
+        https://bugs.webkit.org/show_bug.cgi?id=140144
+
+        Reviewed by Antti Koivisto.
+
+        Tests: fast/css/pseudo-focus-within-basics.html
+               fast/css/pseudo-focus-within-inside-shadow-dom.html
+               fast/css/pseudo-focus-within-style-sharing-1.html
+               fast/css/pseudo-focus-within-style-sharing-2.html
+               fast/selectors/focus-within-style-update.html
+
+        * css/CSSSelector.cpp:
+        (WebCore::CSSSelector::selectorText):
+        * css/CSSSelector.h:
+        * css/SelectorChecker.cpp:
+        (WebCore::SelectorChecker::checkOne):
+        * css/SelectorPseudoClassAndCompatibilityElementMap.in:
+        * cssjit/SelectorCompiler.cpp:
+        (WebCore::SelectorCompiler::addPseudoClassType):
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching):
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasFocusWithin):
+        * dom/ContainerNode.cpp:
+        (WebCore::destroyRenderTreeIfNeeded):
+        * dom/Element.cpp:
+        (WebCore::Element::~Element):
+        (WebCore::Element::setFocus):
+        (WebCore::Element::unregisterNamedFlowContentElement):
+        (WebCore::Element::setIsNamedFlowContentElement):
+        (WebCore::Element::clearIsNamedFlowContentElement):
+        (WebCore::Element::setStyleAffectedByFocusWithin):
+        (WebCore::Element::rareDataStyleAffectedByFocusWithin):
+        (WebCore::Element::rareDataIsNamedFlowContentElement):
+        * dom/Element.h:
+        (WebCore::Element::hasFocusWithin):
+        (WebCore::Element::styleAffectedByFocusWithin):
+        (WebCore::Element::isNamedFlowContentElement):
+        (WebCore::Element::setHasFocusWithin):
+        * dom/ElementRareData.h:
+        (WebCore::ElementRareData::styleAffectedByFocusWithin):
+        (WebCore::ElementRareData::setStyleAffectedByFocusWithin):
+        (WebCore::ElementRareData::isNamedFlowContentElement):
+        (WebCore::ElementRareData::setIsNamedFlowContentElement):
+        (WebCore::ElementRareData::ElementRareData):
+        (WebCore::ElementRareData::resetComputedStyle):
+        * dom/Node.h:
+        (WebCore::Node::flagHasFocusWithin):
+        (WebCore::Node::isNamedFlowContentNode): Deleted.
+        (WebCore::Node::setIsNamedFlowContentNode): Deleted.
+        (WebCore::Node::clearIsNamedFlowContentNode): Deleted.
+        * rendering/RenderNamedFlowThread.cpp:
+        (WebCore::RenderNamedFlowThread::clearContentElements):
+        (WebCore::RenderNamedFlowThread::registerNamedFlowContentElement):
+        (WebCore::RenderNamedFlowThread::unregisterNamedFlowContentElement):
+        (WebCore::nextNodeInsideContentElement):
+        * style/RenderTreeUpdater.cpp:
+        (WebCore::RenderTreeUpdater::updateElementRenderer):
+        * style/StyleRelations.cpp:
+        (WebCore::Style::commitRelationsToRenderStyle):
+        (WebCore::Style::commitRelations):
+        * style/StyleRelations.h:
+        * style/StyleSharingResolver.cpp:
+        (WebCore::Style::SharingResolver::canShareStyleWithElement):
+
</ins><span class="cx"> 2016-06-22  Oliver Hunt  &lt;oliver@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Integrate WebKit's CFURLConnection with App Transport Security
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSSelectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSSelector.cpp (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSSelector.cpp        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/css/CSSSelector.cpp        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -497,6 +497,9 @@
</span><span class="cx">             case CSSSelector::PseudoClassFocus:
</span><span class="cx">                 str.appendLiteral(&quot;:focus&quot;);
</span><span class="cx">                 break;
</span><ins>+            case CSSSelector::PseudoClassFocusWithin:
+                str.appendLiteral(&quot;:focus-within&quot;);
+                break;
</ins><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx">             case CSSSelector::PseudoClassFuture:
</span><span class="cx">                 str.appendLiteral(&quot;:future&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSSelectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSSelector.h (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSSelector.h        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/css/CSSSelector.h        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -112,6 +112,7 @@
</span><span class="cx">             PseudoClassHover,
</span><span class="cx">             PseudoClassDrag,
</span><span class="cx">             PseudoClassFocus,
</span><ins>+            PseudoClassFocusWithin,
</ins><span class="cx">             PseudoClassActive,
</span><span class="cx">             PseudoClassChecked,
</span><span class="cx">             PseudoClassEnabled,
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorCheckercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorChecker.cpp        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -944,6 +944,9 @@
</span><span class="cx">             break;
</span><span class="cx">         case CSSSelector::PseudoClassFocus:
</span><span class="cx">             return matchesFocusPseudoClass(element);
</span><ins>+        case CSSSelector::PseudoClassFocusWithin:
+            addStyleRelation(checkingContext, element, Style::Relation::AffectedByFocusWithin);
+            return element.hasFocusWithin();
</ins><span class="cx">         case CSSSelector::PseudoClassHover:
</span><span class="cx">             if (m_strictParsing || element.isLink() || canMatchHoverOrActiveInQuirksMode(context)) {
</span><span class="cx">                 addStyleRelation(checkingContext, element, Style::Relation::AffectedByHover);
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorPseudoClassAndCompatibilityElementMapin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> first-line, PseudoClassUnknown, PseudoElementFirstLine
</span><span class="cx"> first-of-type
</span><span class="cx"> focus
</span><ins>+focus-within
</ins><span class="cx"> horizontal
</span><span class="cx"> host
</span><span class="cx"> hover
</span></span></pre></div>
<a id="trunkSourceWebCorecssjitSelectorCompilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -323,6 +323,7 @@
</span><span class="cx">     void generateElementIsRoot(Assembler::JumpList&amp; failureCases);
</span><span class="cx">     void generateElementIsScopeRoot(Assembler::JumpList&amp; failureCases);
</span><span class="cx">     void generateElementIsTarget(Assembler::JumpList&amp; failureCases);
</span><ins>+    void generateElementHasFocusWithin(Assembler::JumpList&amp; failureCases);
</ins><span class="cx"> 
</span><span class="cx">     // Helpers.
</span><span class="cx">     void generateAddStyleRelationIfResolvingStyle(Assembler::RegisterID element, Style::Relation::Type, Optional&lt;Assembler::RegisterID&gt; value = { });
</span><span class="lines">@@ -674,6 +675,7 @@
</span><span class="cx">     case CSSSelector::PseudoClassLastChild:
</span><span class="cx">     case CSSSelector::PseudoClassOnlyChild:
</span><span class="cx">     case CSSSelector::PseudoClassPlaceholderShown:
</span><ins>+    case CSSSelector::PseudoClassFocusWithin:
</ins><span class="cx">         fragment.pseudoClasses.add(type);
</span><span class="cx">         if (selectorContext == SelectorContext::QuerySelector)
</span><span class="cx">             return FunctionType::SimpleSelectorChecker;
</span><span class="lines">@@ -2578,6 +2580,9 @@
</span><span class="cx">     if (fragment.pseudoClasses.contains(CSSSelector::PseudoClassTarget))
</span><span class="cx">         generateElementIsTarget(matchingPostTagNameFailureCases);
</span><span class="cx"> 
</span><ins>+    if (fragment.pseudoClasses.contains(CSSSelector::PseudoClassFocusWithin))
+        generateElementHasFocusWithin(matchingPostTagNameFailureCases);
+
</ins><span class="cx">     for (unsigned i = 0; i &lt; fragment.unoptimizedPseudoClasses.size(); ++i)
</span><span class="cx">         generateElementFunctionCallTest(matchingPostTagNameFailureCases, fragment.unoptimizedPseudoClasses[i]);
</span><span class="cx"> 
</span><span class="lines">@@ -3791,6 +3796,12 @@
</span><span class="cx">     failureCases.append(m_assembler.branchPtr(Assembler::NotEqual, Assembler::Address(document, Document::cssTargetMemoryOffset()), elementAddressRegister));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void SelectorCodeGenerator::generateElementHasFocusWithin(Assembler::JumpList&amp; failureCases)
+{
+    generateAddStyleRelationIfResolvingStyle(elementAddressRegister, Style::Relation::AffectedByFocusWithin);
+    failureCases.append(m_assembler.branchTest32(Assembler::Zero, Assembler::Address(elementAddressRegister, Node::nodeFlagsMemoryOffset()), Assembler::TrustedImm32(Node::flagHasFocusWithin())));
+}
+
</ins><span class="cx"> void SelectorCodeGenerator::generateElementIsFirstLink(Assembler::JumpList&amp; failureCases, Assembler::RegisterID element)
</span><span class="cx"> {
</span><span class="cx">     LocalRegister currentElement(m_registerAllocator);
</span></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNode.cpp        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -103,9 +103,11 @@
</span><span class="cx">     bool childIsHTMLSlotElement = false;
</span><span class="cx">     childIsHTMLSlotElement = is&lt;HTMLSlotElement&gt;(child);
</span><span class="cx">     // FIXME: Get rid of the named flow test.
</span><del>-    if (!child.renderer() &amp;&amp; !child.isNamedFlowContentNode() &amp;&amp; !childIsHTMLSlotElement)
</del><ins>+    bool isElement = is&lt;Element&gt;(child);
+    if (!child.renderer() &amp;&amp; !childIsHTMLSlotElement
+        &amp;&amp; !(isElement &amp;&amp; downcast&lt;Element&gt;(child).isNamedFlowContentElement()))
</ins><span class="cx">         return;
</span><del>-    if (is&lt;Element&gt;(child))
</del><ins>+    if (isElement)
</ins><span class="cx">         RenderTreeUpdater::tearDownRenderers(downcast&lt;Element&gt;(child));
</span><span class="cx">     else if (is&lt;Text&gt;(child))
</span><span class="cx">         RenderTreeUpdater::tearDownRenderer(downcast&lt;Text&gt;(child));
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/dom/Element.cpp        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -182,8 +182,8 @@
</span><span class="cx">     if (document().hasLivingRenderTree()) {
</span><span class="cx">         // When the document is not destroyed, an element that was part of a named flow
</span><span class="cx">         // content nodes should have been removed from the content nodes collection
</span><del>-        // and the isNamedFlowContentNode flag reset.
-        ASSERT_WITH_SECURITY_IMPLICATION(!isNamedFlowContentNode());
</del><ins>+        // and the isNamedFlowContentElement flag reset.
+        ASSERT_WITH_SECURITY_IMPLICATION(!isNamedFlowContentElement());
</ins><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -601,6 +601,9 @@
</span><span class="cx"> 
</span><span class="cx">     document().userActionElements().setFocused(this, flag);
</span><span class="cx">     setNeedsStyleRecalc();
</span><ins>+
+    for (Element* element = this; element; element = element-&gt;parentOrShadowHostElement())
+        element-&gt;setHasFocusWithin(flag);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Element::setHovered(bool flag)
</span><span class="lines">@@ -1620,7 +1623,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Element::unregisterNamedFlowContentElement()
</span><span class="cx"> {
</span><del>-    if (isNamedFlowContentNode() &amp;&amp; document().renderView())
</del><ins>+    if (isNamedFlowContentElement() &amp;&amp; document().renderView())
</ins><span class="cx">         document().renderView()-&gt;flowThreadController().unregisterNamedFlowContentElement(*this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1908,6 +1911,16 @@
</span><span class="cx">     setAttributeEventListener(eventType, JSLazyEventListener::create(*this, attributeName, attributeValue));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Element::setIsNamedFlowContentElement()
+{
+    ensureElementRareData().setIsNamedFlowContentElement(true);
+}
+
+void Element::clearIsNamedFlowContentElement()
+{
+    ensureElementRareData().setIsNamedFlowContentElement(false);
+}
+
</ins><span class="cx"> void Element::removeAllEventListeners()
</span><span class="cx"> {
</span><span class="cx">     ContainerNode::removeAllEventListeners();
</span><span class="lines">@@ -2562,6 +2575,11 @@
</span><span class="cx">     ensureElementRareData().setStyleAffectedByEmpty(true);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Element::setStyleAffectedByFocusWithin()
+{
+    ensureElementRareData().setStyleAffectedByFocusWithin(true);
+}
+
</ins><span class="cx"> void Element::setChildrenAffectedByActive()
</span><span class="cx"> {
</span><span class="cx">     ensureElementRareData().setChildrenAffectedByActive(true);
</span><span class="lines">@@ -2607,6 +2625,18 @@
</span><span class="cx">     return elementRareData()-&gt;styleAffectedByEmpty();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool Element::rareDataStyleAffectedByFocusWithin() const
+{
+    ASSERT(hasRareData());
+    return elementRareData()-&gt;styleAffectedByFocusWithin();
+}
+
+bool Element::rareDataIsNamedFlowContentElement() const
+{
+    ASSERT(hasRareData());
+    return elementRareData()-&gt;isNamedFlowContentElement();
+}
+
</ins><span class="cx"> bool Element::rareDataChildrenAffectedByActive() const
</span><span class="cx"> {
</span><span class="cx">     ASSERT(hasRareData());
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.h (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.h        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/dom/Element.h        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -273,10 +273,12 @@
</span><span class="cx">     bool active() const { return isUserActionElement() &amp;&amp; isUserActionElementActive(); }
</span><span class="cx">     bool hovered() const { return isUserActionElement() &amp;&amp; isUserActionElementHovered(); }
</span><span class="cx">     bool focused() const { return isUserActionElement() &amp;&amp; isUserActionElementFocused(); }
</span><ins>+    bool hasFocusWithin() const { return getFlag(HasFocusWithin); };
</ins><span class="cx"> 
</span><span class="cx">     virtual void setActive(bool flag = true, bool pause = false);
</span><span class="cx">     virtual void setHovered(bool flag = true);
</span><span class="cx">     virtual void setFocus(bool flag);
</span><ins>+    void setHasFocusWithin(bool flag);
</ins><span class="cx"> 
</span><span class="cx">     bool tabIndexSetExplicitly() const;
</span><span class="cx">     virtual bool supportsFocus() const;
</span><span class="lines">@@ -296,6 +298,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Methods for indicating the style is affected by dynamic updates (e.g., children changing, our position changing in our sibling list, etc.)
</span><span class="cx">     bool styleAffectedByEmpty() const { return hasRareData() &amp;&amp; rareDataStyleAffectedByEmpty(); }
</span><ins>+    bool styleAffectedByFocusWithin() const { return hasRareData() &amp;&amp; rareDataStyleAffectedByFocusWithin(); }
</ins><span class="cx">     bool childrenAffectedByHover() const { return getFlag(ChildrenAffectedByHoverRulesFlag); }
</span><span class="cx">     bool childrenAffectedByActive() const { return hasRareData() &amp;&amp; rareDataChildrenAffectedByActive(); }
</span><span class="cx">     bool childrenAffectedByDrag() const { return hasRareData() &amp;&amp; rareDataChildrenAffectedByDrag(); }
</span><span class="lines">@@ -309,6 +312,7 @@
</span><span class="cx">     bool hasFlagsSetDuringStylingOfChildren() const;
</span><span class="cx"> 
</span><span class="cx">     void setStyleAffectedByEmpty();
</span><ins>+    void setStyleAffectedByFocusWithin();
</ins><span class="cx">     void setChildrenAffectedByHover() { setFlag(ChildrenAffectedByHoverRulesFlag); }
</span><span class="cx">     void setChildrenAffectedByActive();
</span><span class="cx">     void setChildrenAffectedByDrag();
</span><span class="lines">@@ -521,6 +525,10 @@
</span><span class="cx">     using ContainerNode::setAttributeEventListener;
</span><span class="cx">     void setAttributeEventListener(const AtomicString&amp; eventType, const QualifiedName&amp; attributeName, const AtomicString&amp; value);
</span><span class="cx"> 
</span><ins>+    bool isNamedFlowContentElement() const { return hasRareData() &amp;&amp; rareDataIsNamedFlowContentElement(); }
+    void setIsNamedFlowContentElement();
+    void clearIsNamedFlowContentElement();
+
</ins><span class="cx"> protected:
</span><span class="cx">     Element(const QualifiedName&amp;, Document&amp;, ConstructionType);
</span><span class="cx"> 
</span><span class="lines">@@ -607,6 +615,8 @@
</span><span class="cx">     const RenderStyle&amp; resolveComputedStyle();
</span><span class="cx"> 
</span><span class="cx">     bool rareDataStyleAffectedByEmpty() const;
</span><ins>+    bool rareDataStyleAffectedByFocusWithin() const;
+    bool rareDataIsNamedFlowContentElement() const;
</ins><span class="cx">     bool rareDataChildrenAffectedByHover() const;
</span><span class="cx">     bool rareDataChildrenAffectedByActive() const;
</span><span class="cx">     bool rareDataChildrenAffectedByDrag() const;
</span><span class="lines">@@ -749,6 +759,15 @@
</span><span class="cx">     return element.isHTMLElement() &amp;&amp; element.document().isHTMLDocument();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline void Element::setHasFocusWithin(bool flag)
+{
+    if (hasFocusWithin() == flag)
+        return;
+    setFlag(flag, HasFocusWithin);
+    if (styleAffectedByFocusWithin())
+        setNeedsStyleRecalc();
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::Element)
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementRareDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ElementRareData.h (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ElementRareData.h        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/dom/ElementRareData.h        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2008, 2009, 2010, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2008, 2009, 2010, 2014, 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2008 David Smith &lt;catfish.man@gmail.com&gt;
</span><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="lines">@@ -58,9 +58,15 @@
</span><span class="cx">     bool styleAffectedByEmpty() const { return m_styleAffectedByEmpty; }
</span><span class="cx">     void setStyleAffectedByEmpty(bool value) { m_styleAffectedByEmpty = value; }
</span><span class="cx"> 
</span><ins>+    bool styleAffectedByFocusWithin() const { return m_styleAffectedByFocusWithin; }
+    void setStyleAffectedByFocusWithin(bool value) { m_styleAffectedByFocusWithin = value; }
+
</ins><span class="cx">     RegionOversetState regionOversetState() const { return m_regionOversetState; }
</span><span class="cx">     void setRegionOversetState(RegionOversetState state) { m_regionOversetState = state; }
</span><span class="cx"> 
</span><ins>+    bool isNamedFlowContentElement() const { return m_isNamedFlowContentElement; }
+    void setIsNamedFlowContentElement(bool value) { m_isNamedFlowContentElement = value; }
+
</ins><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx">     bool containsFullScreenElement() { return m_containsFullScreenElement; }
</span><span class="cx">     void setContainsFullScreenElement(bool value) { m_containsFullScreenElement = value; }
</span><span class="lines">@@ -116,6 +122,7 @@
</span><span class="cx">     unsigned m_tabIndexWasSetExplicitly : 1;
</span><span class="cx">     unsigned m_needsFocusAppearanceUpdateSoonAfterAttach : 1;
</span><span class="cx">     unsigned m_styleAffectedByEmpty : 1;
</span><ins>+    unsigned m_styleAffectedByFocusWithin : 1;
</ins><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx">     unsigned m_containsFullScreenElement : 1;
</span><span class="cx"> #endif
</span><span class="lines">@@ -130,6 +137,7 @@
</span><span class="cx">     unsigned m_childrenAffectedByBackwardPositionalRules : 1;
</span><span class="cx">     unsigned m_childrenAffectedByPropertyBasedBackwardPositionalRules : 1;
</span><span class="cx">     unsigned m_hasDisplayContents : 1;
</span><ins>+    unsigned m_isNamedFlowContentElement : 1;
</ins><span class="cx"> 
</span><span class="cx">     RegionOversetState m_regionOversetState;
</span><span class="cx"> 
</span><span class="lines">@@ -160,6 +168,7 @@
</span><span class="cx">     , m_tabIndexWasSetExplicitly(false)
</span><span class="cx">     , m_needsFocusAppearanceUpdateSoonAfterAttach(false)
</span><span class="cx">     , m_styleAffectedByEmpty(false)
</span><ins>+    , m_styleAffectedByFocusWithin(false)
</ins><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx">     , m_containsFullScreenElement(false)
</span><span class="cx"> #endif
</span><span class="lines">@@ -171,6 +180,7 @@
</span><span class="cx">     , m_childrenAffectedByBackwardPositionalRules(false)
</span><span class="cx">     , m_childrenAffectedByPropertyBasedBackwardPositionalRules(false)
</span><span class="cx">     , m_hasDisplayContents(false)
</span><ins>+    , m_isNamedFlowContentElement(false)
</ins><span class="cx">     , m_regionOversetState(RegionUndefined)
</span><span class="cx">     , m_minimumSizeForResizing(defaultMinimumSizeForResizing())
</span><span class="cx"> {
</span><span class="lines">@@ -200,6 +210,7 @@
</span><span class="cx">     m_computedStyle = nullptr;
</span><span class="cx">     m_hasDisplayContents = false;
</span><span class="cx">     setStyleAffectedByEmpty(false);
</span><ins>+    setStyleAffectedByFocusWithin(false);
</ins><span class="cx">     setChildIndex(0);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.h (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.h        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/dom/Node.h        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -247,7 +247,6 @@
</span><span class="cx">     bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); }
</span><span class="cx">     bool isShadowRoot() const { return isDocumentFragment() &amp;&amp; isTreeScope(); }
</span><span class="cx"> 
</span><del>-    bool isNamedFlowContentNode() const { return getFlag(IsNamedFlowContentNodeFlag); }
</del><span class="cx">     bool hasCustomStyleResolveCallbacks() const { return getFlag(HasCustomStyleResolveCallbacksFlag); }
</span><span class="cx"> 
</span><span class="cx">     bool hasSyntheticAttrChildNodes() const { return getFlag(HasSyntheticAttrChildNodesFlag); }
</span><span class="lines">@@ -337,9 +336,6 @@
</span><span class="cx">     bool isLink() const { return getFlag(IsLinkFlag); }
</span><span class="cx">     void setIsLink(bool flag) { setFlag(flag, IsLinkFlag); }
</span><span class="cx"> 
</span><del>-    void setIsNamedFlowContentNode() { setFlag(IsNamedFlowContentNodeFlag); }
-    void clearIsNamedFlowContentNode() { clearFlag(IsNamedFlowContentNodeFlag); }
-
</del><span class="cx">     bool hasEventTargetData() const { return getFlag(HasEventTargetDataFlag); }
</span><span class="cx">     void setHasEventTargetData(bool flag) { setFlag(flag, HasEventTargetDataFlag); }
</span><span class="cx"> 
</span><span class="lines">@@ -572,6 +568,7 @@
</span><span class="cx">     static int32_t flagIsElement() { return IsElementFlag; }
</span><span class="cx">     static int32_t flagIsHTML() { return IsHTMLFlag; }
</span><span class="cx">     static int32_t flagIsLink() { return IsLinkFlag; }
</span><ins>+    static int32_t flagHasFocusWithin() { return HasFocusWithin; }
</ins><span class="cx">     static int32_t flagHasRareData() { return HasRareDataFlag; }
</span><span class="cx">     static int32_t flagIsParsingChildrenFinished() { return IsParsingChildrenFinishedFlag; }
</span><span class="cx">     static int32_t flagChildrenAffectedByFirstChildRulesFlag() { return ChildrenAffectedByFirstChildRulesFlag; }
</span><span class="lines">@@ -602,7 +599,7 @@
</span><span class="cx"> 
</span><span class="cx">         StyleChangeMask = 1 &lt;&lt; nodeStyleChangeShift | 1 &lt;&lt; (nodeStyleChangeShift + 1) | 1 &lt;&lt; (nodeStyleChangeShift + 2),
</span><span class="cx">         IsEditingTextOrUnresolvedCustomElementFlag = 1 &lt;&lt; 17,
</span><del>-        IsNamedFlowContentNodeFlag = 1 &lt;&lt; 18,
</del><ins>+        HasFocusWithin = 1 &lt;&lt; 18,
</ins><span class="cx">         HasSyntheticAttrChildNodesFlag = 1 &lt;&lt; 19,
</span><span class="cx">         HasCustomStyleResolveCallbacksFlag = 1 &lt;&lt; 20,
</span><span class="cx">         HasEventTargetDataFlag = 1 &lt;&lt; 21,
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderNamedFlowThreadcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -74,10 +74,10 @@
</span><span class="cx"> {
</span><span class="cx">     for (auto&amp; contentElement : m_contentElements) {
</span><span class="cx">         ASSERT(contentElement);
</span><del>-        ASSERT(contentElement-&gt;isNamedFlowContentNode());
</del><ins>+        ASSERT(contentElement-&gt;isNamedFlowContentElement());
</ins><span class="cx">         ASSERT(&amp;contentElement-&gt;document() == &amp;document());
</span><span class="cx">         
</span><del>-        contentElement-&gt;clearIsNamedFlowContentNode();
</del><ins>+        contentElement-&gt;clearIsNamedFlowContentElement();
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     m_contentElements.clear();
</span><span class="lines">@@ -497,7 +497,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(&amp;contentElement.document() == &amp;document());
</span><span class="cx"> 
</span><del>-    contentElement.setIsNamedFlowContentNode();
</del><ins>+    contentElement.setIsNamedFlowContentElement();
</ins><span class="cx"> 
</span><span class="cx">     resetMarkForDestruction();
</span><span class="cx"> 
</span><span class="lines">@@ -518,10 +518,10 @@
</span><span class="cx"> void RenderNamedFlowThread::unregisterNamedFlowContentElement(Element&amp; contentElement)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_contentElements.contains(&amp;contentElement));
</span><del>-    ASSERT(contentElement.isNamedFlowContentNode());
</del><ins>+    ASSERT(contentElement.isNamedFlowContentElement());
</ins><span class="cx">     ASSERT(&amp;contentElement.document() == &amp;document());
</span><span class="cx"> 
</span><del>-    contentElement.clearIsNamedFlowContentNode();
</del><ins>+    contentElement.clearIsNamedFlowContentElement();
</ins><span class="cx">     m_contentElements.remove(&amp;contentElement);
</span><span class="cx"> 
</span><span class="cx">     if (canBeDestroyed())
</span><span class="lines">@@ -616,7 +616,7 @@
</span><span class="cx"> // Retrieve the next node to be visited while computing the ranges inside a region.
</span><span class="cx"> static Node* nextNodeInsideContentElement(const Node&amp; currNode, const Element* contentElement)
</span><span class="cx"> {
</span><del>-    ASSERT(contentElement &amp;&amp; contentElement-&gt;isNamedFlowContentNode());
</del><ins>+    ASSERT(contentElement &amp;&amp; contentElement-&gt;isNamedFlowContentElement());
</ins><span class="cx"> 
</span><span class="cx">     if (currNode.renderer() &amp;&amp; currNode.renderer()-&gt;isSVGRoot())
</span><span class="cx">         return NodeTraversal::nextSkippingChildren(currNode, contentElement);
</span></span></pre></div>
<a id="trunkSourceWebCorestyleRenderTreeUpdatercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/RenderTreeUpdater.cpp (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/RenderTreeUpdater.cpp        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/style/RenderTreeUpdater.cpp        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -240,7 +240,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderTreeUpdater::updateElementRenderer(Element&amp; element, Style::ElementUpdate&amp; update)
</span><span class="cx"> {
</span><del>-    bool shouldTearDownRenderers = update.change == Style::Detach &amp;&amp; (element.renderer() || element.isNamedFlowContentNode());
</del><ins>+    bool shouldTearDownRenderers = update.change == Style::Detach &amp;&amp; (element.renderer() || element.isNamedFlowContentElement());
</ins><span class="cx">     if (shouldTearDownRenderers)
</span><span class="cx">         tearDownRenderers(element, TeardownType::KeepHoverAndActive);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleRelationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleRelations.cpp (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleRelations.cpp        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/style/StyleRelations.cpp        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -72,6 +72,7 @@
</span><span class="cx">         case Relation::Unique:
</span><span class="cx">             style.setUnique();
</span><span class="cx">             break;
</span><ins>+        case Relation::AffectedByFocusWithin:
</ins><span class="cx">         case Relation::AffectedByPreviousSibling:
</span><span class="cx">         case Relation::AffectsNextSibling:
</span><span class="cx">         case Relation::ChildrenAffectedByBackwardPositionalRules:
</span><span class="lines">@@ -102,6 +103,9 @@
</span><span class="cx">         case Relation::AffectedByEmpty:
</span><span class="cx">             element.setStyleAffectedByEmpty();
</span><span class="cx">             break;
</span><ins>+        case Relation::AffectedByFocusWithin:
+            element.setStyleAffectedByFocusWithin();
+            break;
</ins><span class="cx">         case Relation::AffectedByHover:
</span><span class="cx">             element.setChildrenAffectedByHover();
</span><span class="cx">             break;
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleRelationsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleRelations.h (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleRelations.h        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/style/StyleRelations.h        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx">         AffectedByActive,
</span><span class="cx">         AffectedByDrag,
</span><span class="cx">         AffectedByEmpty,
</span><ins>+        AffectedByFocusWithin,
</ins><span class="cx">         AffectedByHover,
</span><span class="cx">         AffectedByPreviousSibling,
</span><span class="cx">         // For AffectsNextSibling 'value' tells how many element siblings to mark starting with 'element'.
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleSharingResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleSharingResolver.cpp (202357 => 202358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleSharingResolver.cpp        2016-06-22 23:31:42 UTC (rev 202357)
+++ trunk/Source/WebCore/style/StyleSharingResolver.cpp        2016-06-22 23:35:25 UTC (rev 202358)
</span><span class="lines">@@ -230,6 +230,8 @@
</span><span class="cx">         return false;
</span><span class="cx">     if (candidateElement.affectsNextSiblingElementStyle() || candidateElement.styleIsAffectedByPreviousSibling())
</span><span class="cx">         return false;
</span><ins>+    if (candidateElement.styleAffectedByFocusWithin() || element.styleAffectedByFocusWithin())
+        return false;
</ins><span class="cx"> 
</span><span class="cx">     auto&amp; candidateElementId = candidateElement.idForStyleResolution();
</span><span class="cx">     if (!candidateElementId.isNull() &amp;&amp; m_ruleSets.features().idsInRules.contains(candidateElementId.impl()))
</span></span></pre>
</div>
</div>

</body>
</html>