<!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>[200712] 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/200712">200712</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-05-11 15:42:23 -0700 (Wed, 11 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Moving focus by tab could erroneously focus a non-focusable shadow host
https://bugs.webkit.org/show_bug.cgi?id=157585

Reviewed by Antti Koivisto.

Source/WebCore:

The bug was caused by findFocusableElementDescendingDownIntoFrameDocument erroneously returning a shadow host
that contains a focusable element instead of traversing it through to find a focusable element within. Fixed
the bug calling findFocusableElementWithinScope which traverses shadow trees to find a focusable element unlike
findFocusableElementOrScopeOwner which returns a focusable element or a shadow host.

Also done some refactoring for clarity.

Test: fast/shadow-dom/focus-on-iframe.html

* page/FocusController.cpp:
(WebCore::FocusController::findFocusableElementDescendingDownIntoFrameDocument): See above.

(WebCore::FocusController::findFocusableElementAcrossFocusScope): Declare outerScope as late as possible.
(WebCore::nextElementWithGreaterTabIndex): Merged if conditions for clarity.
(WebCore::previousElementWithLowerTabIndex): Removed the check for isNonFocusableShadowHost since
isFocusableOrHasShadowTreeWithoutCustomFocusLogic returns true whenever isNonFocusableShadowHost returns true.

LayoutTests:

Added a regression test for moving focus across iframes.

Also expanded negative-tabindex-on-shadow-host.html to cover reverse traversal.

* fast/shadow-dom/focus-on-iframe-expected.txt: Added.
* fast/shadow-dom/focus-on-iframe.html: Added.
* fast/shadow-dom/negative-tabindex-on-shadow-host-expected.txt:
* fast/shadow-dom/negative-tabindex-on-shadow-host.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastshadowdomnegativetabindexonshadowhostexpectedtxt">trunk/LayoutTests/fast/shadow-dom/negative-tabindex-on-shadow-host-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastshadowdomnegativetabindexonshadowhosthtml">trunk/LayoutTests/fast/shadow-dom/negative-tabindex-on-shadow-host.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageFocusControllercpp">trunk/Source/WebCore/page/FocusController.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastshadowdomfocusoniframeexpectedtxt">trunk/LayoutTests/fast/shadow-dom/focus-on-iframe-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastshadowdomfocusoniframehtml">trunk/LayoutTests/fast/shadow-dom/focus-on-iframe.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (200711 => 200712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-05-11 22:20:40 UTC (rev 200711)
+++ trunk/LayoutTests/ChangeLog        2016-05-11 22:42:23 UTC (rev 200712)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-05-11  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        Moving focus by tab could erroneously focus a non-focusable shadow host
+        https://bugs.webkit.org/show_bug.cgi?id=157585
+
+        Reviewed by Antti Koivisto.
+
+        Added a regression test for moving focus across iframes.
+
+        Also expanded negative-tabindex-on-shadow-host.html to cover reverse traversal.
+
+        * fast/shadow-dom/focus-on-iframe-expected.txt: Added.
+        * fast/shadow-dom/focus-on-iframe.html: Added.
+        * fast/shadow-dom/negative-tabindex-on-shadow-host-expected.txt:
+        * fast/shadow-dom/negative-tabindex-on-shadow-host.html:
+
</ins><span class="cx"> 2016-05-11  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Change IDBObjectStore.createIndex to take an IDL dictionary
</span></span></pre></div>
<a id="trunkLayoutTestsfastshadowdomfocusoniframeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shadow-dom/focus-on-iframe-expected.txt (0 => 200712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shadow-dom/focus-on-iframe-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/focus-on-iframe-expected.txt        2016-05-11 22:42:23 UTC (rev 200712)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+Tests for setting a negative tabindex on shadow host. Elements inside such a shadow tree should not be in the sequential navigation order.
+To manually test, press tab key four times. It should traverse focusable elements in the increasing numerical order.
+
+1. First sequentially focusable element
+2. An iframe without a focusable element
+3. First focusable element inside an iframe
+4. Second focusable element inside an iframe
+5. An iframe without a focusable shadow host or shadow content
+6. Focusable content inside a shadow tree
+7. A focusable element with a high tabindex
+8. Focusable content inside the first shadow tree
+9. Focusable content inside the second shadow tree
+8. Focusable content inside the first shadow tree
+7. A focusable element with a high tabindex
+6. Focusable content inside a shadow tree
+5. An iframe without a focusable shadow host or shadow content
+4. Second focusable element inside an iframe
+3. First focusable element inside an iframe
+2. An iframe without a focusable element
+1. First sequentially focusable element
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshadowdomfocusoniframehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shadow-dom/focus-on-iframe.html (0 => 200712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shadow-dom/focus-on-iframe.html                                (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/focus-on-iframe.html        2016-05-11 22:42:23 UTC (rev 200712)
</span><span class="lines">@@ -0,0 +1,115 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;p&gt;Tests for setting a negative tabindex on shadow host. Elements inside such a shadow tree should not be in the sequential navigation order.&lt;br&gt;
+To manually test, press tab key four times. It should traverse focusable elements in the increasing numerical order.&lt;/p&gt;
+&lt;div id=&quot;test-content&quot;&gt;
+&lt;div id=&quot;first&quot; tabindex=&quot;1&quot;&gt;1. First sequentially focusable element&lt;/div&gt;
+&lt;iframe src=&quot;about:blank&quot;&gt;2. An iframe without a focusable element&lt;/iframe&gt;
+&lt;iframe src=&quot;about:blank&quot;&gt;An iframe with a focusable element should not be focused&lt;/iframe&gt;
+&lt;iframe src=&quot;about:blank&quot;&gt;5. An iframe without a focusable shadow host or shadow content&lt;/iframe&gt;
+&lt;iframe src=&quot;about:blank&quot;&gt;An iframe with a focusable shadow content should not be focused (1)&lt;/iframe&gt;
+&lt;iframe src=&quot;about:blank&quot;&gt;An iframe with a focusable shadow content should not be focused (2)&lt;/iframe&gt;
+&lt;/div&gt;
+&lt;pre&gt;&lt;/pre&gt;
+&lt;script&gt;
+
+var oldActiveElement = null;
+function log()
+{
+    setTimeout(function () {
+        var newActiveElement = document.activeElement;
+
+        if (newActiveElement instanceof HTMLIFrameElement) {
+            var contentDocument = newActiveElement.contentDocument;
+            var activeElementInsideFrame = contentDocument.activeElement;
+            if (activeElementInsideFrame != contentDocument.body &amp;&amp; activeElementInsideFrame != contentDocument.documentElement /* Firefox */)
+                newActiveElement = activeElementInsideFrame;
+        }
+
+        if (newActiveElement.shadowRoot) {
+            var activeElementInShadow = newActiveElement.shadowRoot.activeElement;
+            if (activeElementInShadow)
+                newActiveElement = activeElementInShadow;
+        }
+
+        if (oldActiveElement == newActiveElement || newActiveElement == document.body)
+            return;
+        oldActiveElement = newActiveElement;
+        document.querySelector('pre').textContent += newActiveElement.textContent + '\n';
+    }, 0);
+}
+
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+window.onload = function () {
+    document.onkeydown = log;
+
+    var iframes = document.querySelectorAll('iframe');
+    for (var i = 0; i &lt; iframes.length; i++)
+        iframes[i].contentDocument.onkeydown = log;
+
+    iframes[0].contentDocument.body.innerHTML = 'Content of an iframe without a focusable element should not be focused';
+    iframes[1].contentDocument.body.innerHTML = `
+        &lt;div tabindex=&quot;0&quot; onfocus=&quot;top.log(this)&quot;&gt;3. First focusable element inside an iframe&lt;/div&gt;
+        &lt;div tabindex=&quot;0&quot; onfocus=&quot;top.log(this)&quot;&gt;4. Second focusable element inside an iframe&lt;/div&gt;`;
+
+    iframes[2].contentDocument.body.innerHTML = '&lt;div&gt;A non-focusable shadow host without a focusable content should not be focused&lt;/div&gt;';
+    var host = iframes[2].contentDocument.body.querySelector('div');
+    var shadowRoot = host.attachShadow({mode: 'closed'});
+    shadowRoot.innerHTML = '&lt;slot&gt;&lt;/slot&gt;';
+
+    iframes[3].contentDocument.body.innerHTML = '&lt;div&gt;&lt;/div&gt;';
+    var host = iframes[3].contentDocument.querySelector('div');
+    var shadowRoot = host.attachShadow({mode: 'open'});
+    shadowRoot.innerHTML = '&lt;div tabindex=&quot;0&quot; onfocus=&quot;top.log(this)&quot;&gt;6. Focusable content inside a shadow tree&lt;/div&gt;';
+
+    iframes[4].contentDocument.body.innerHTML = '&lt;div&gt;&lt;/div&gt;&lt;i tabindex=&quot;1&quot;&gt;7. A focusable element with a high tabindex&lt;/i&gt;&lt;span&gt;&lt;/span&gt;';
+    host = iframes[4].contentDocument.querySelector('div');
+    shadowRoot = host.attachShadow({mode: 'open'});
+    shadowRoot.innerHTML = '&lt;div tabindex=&quot;0&quot; onfocus=&quot;top.log(this)&quot;&gt;8. Focusable content inside the first shadow tree&lt;/div&gt;';
+
+    host = iframes[4].contentDocument.querySelector('span');
+    shadowRoot = host.attachShadow({mode: 'open'});
+    shadowRoot.innerHTML = '&lt;div tabindex=&quot;0&quot; onfocus=&quot;top.log(this)&quot;&gt;9. Focusable content inside the second shadow tree&lt;/div&gt;';
+
+    document.getElementById('first').focus();
+    document.onkeydown();
+
+    if (window.eventSender)
+        moveFocusForward(8);
+}
+
+function moveFocusForward(focusCount)
+{
+    setTimeout(function () {
+        if (!focusCount)
+            return moveFocusBackward(8);
+        eventSender.keyDown('\t');
+        setTimeout(function () {
+            moveFocusForward(focusCount - 1);            
+        }, 1);
+    }, 1);
+}
+
+function moveFocusBackward(focusCount)
+{
+    setTimeout(function () {
+        if (!focusCount) {
+            document.getElementById('test-content').style.display = 'none';
+            testRunner.notifyDone();
+            return;
+        }
+        eventSender.keyDown('\t', ['shiftKey']);
+        setTimeout(function () {
+            moveFocusBackward(focusCount - 1);            
+        }, 1);
+    }, 1);
+}
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshadowdomnegativetabindexonshadowhostexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/shadow-dom/negative-tabindex-on-shadow-host-expected.txt (200711 => 200712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shadow-dom/negative-tabindex-on-shadow-host-expected.txt        2016-05-11 22:20:40 UTC (rev 200711)
+++ trunk/LayoutTests/fast/shadow-dom/negative-tabindex-on-shadow-host-expected.txt        2016-05-11 22:42:23 UTC (rev 200712)
</span><span class="lines">@@ -7,4 +7,9 @@
</span><span class="cx"> 4.1. Focusable element inside a shadow host with no tabindex
</span><span class="cx"> 4.2. Shadow host with no tabindex
</span><span class="cx"> 5. Last sequentially focusable element outside shadow trees
</span><ins>+4.1. Focusable element inside a shadow host with no tabindex
+4.2. Shadow host with no tabindex
+3. Focusable element inside a shadow host with a positive tabindex
+2. Shadow host with a positive tabindex
+1. First sequentially focusable element outside shadow trees
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsfastshadowdomnegativetabindexonshadowhosthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/shadow-dom/negative-tabindex-on-shadow-host.html (200711 => 200712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shadow-dom/negative-tabindex-on-shadow-host.html        2016-05-11 22:20:40 UTC (rev 200711)
+++ trunk/LayoutTests/fast/shadow-dom/negative-tabindex-on-shadow-host.html        2016-05-11 22:42:23 UTC (rev 200712)
</span><span class="lines">@@ -40,6 +40,11 @@
</span><span class="cx">     eventSender.keyDown('\t');
</span><span class="cx">     eventSender.keyDown('\t');
</span><span class="cx">     eventSender.keyDown('\t');
</span><ins>+
+    eventSender.keyDown('\t', ['shiftKey']);
+    eventSender.keyDown('\t', ['shiftKey']);
+    eventSender.keyDown('\t', ['shiftKey']);
+    eventSender.keyDown('\t', ['shiftKey']);
</ins><span class="cx">     document.getElementById('test-content').style.display = 'none';
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200711 => 200712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-11 22:20:40 UTC (rev 200711)
+++ trunk/Source/WebCore/ChangeLog        2016-05-11 22:42:23 UTC (rev 200712)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2016-05-11  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        Moving focus by tab could erroneously focus a non-focusable shadow host
+        https://bugs.webkit.org/show_bug.cgi?id=157585
+
+        Reviewed by Antti Koivisto.
+
+        The bug was caused by findFocusableElementDescendingDownIntoFrameDocument erroneously returning a shadow host
+        that contains a focusable element instead of traversing it through to find a focusable element within. Fixed
+        the bug calling findFocusableElementWithinScope which traverses shadow trees to find a focusable element unlike
+        findFocusableElementOrScopeOwner which returns a focusable element or a shadow host.
+
+        Also done some refactoring for clarity.
+
+        Test: fast/shadow-dom/focus-on-iframe.html
+
+        * page/FocusController.cpp:
+        (WebCore::FocusController::findFocusableElementDescendingDownIntoFrameDocument): See above.
+
+        (WebCore::FocusController::findFocusableElementAcrossFocusScope): Declare outerScope as late as possible.
+        (WebCore::nextElementWithGreaterTabIndex): Merged if conditions for clarity.
+        (WebCore::previousElementWithLowerTabIndex): Removed the check for isNonFocusableShadowHost since
+        isFocusableOrHasShadowTreeWithoutCustomFocusLogic returns true whenever isNonFocusableShadowHost returns true.
+
</ins><span class="cx"> 2016-05-11  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Updating bindings tests results after r200699
</span></span></pre></div>
<a id="trunkSourceWebCorepageFocusControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FocusController.cpp (200711 => 200712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FocusController.cpp        2016-05-11 22:20:40 UTC (rev 200711)
+++ trunk/Source/WebCore/page/FocusController.cpp        2016-05-11 22:42:23 UTC (rev 200712)
</span><span class="lines">@@ -300,8 +300,7 @@
</span><span class="cx">         HTMLFrameOwnerElement&amp; owner = downcast&lt;HTMLFrameOwnerElement&gt;(*element);
</span><span class="cx">         if (!owner.contentFrame())
</span><span class="cx">             break;
</span><del>-        // FIXME: This can return a non-focusable shadow root.
-        Element* foundElement = findFocusableElementOrScopeOwner(direction, FocusNavigationScope::scopeOwnedByIFrame(owner), 0, event);
</del><ins>+        Element* foundElement = findFocusableElementWithinScope(direction, FocusNavigationScope::scopeOwnedByIFrame(owner), nullptr, event);
</ins><span class="cx">         if (!foundElement)
</span><span class="cx">             break;
</span><span class="cx">         ASSERT(element != foundElement);
</span><span class="lines">@@ -433,9 +432,10 @@
</span><span class="cx">     // If there's no focusable node to advance to, move up the focus scopes until we find one.
</span><span class="cx">     Element* owner = scope.owner();
</span><span class="cx">     while (owner) {
</span><del>-        FocusNavigationScope outerScope = FocusNavigationScope::scopeOf(*owner);
</del><span class="cx">         if (direction == FocusDirectionBackward &amp;&amp; isFocusableShadowHost(*owner, *event))
</span><span class="cx">             return findFocusableElementDescendingDownIntoFrameDocument(direction, owner, event);
</span><ins>+
+        auto outerScope = FocusNavigationScope::scopeOf(*owner);
</ins><span class="cx">         if (Element* candidateInOuterScope = findFocusableElementWithinScope(direction, outerScope, owner, event))
</span><span class="cx">             return candidateInOuterScope;
</span><span class="cx">         owner = outerScope.owner();
</span><span class="lines">@@ -514,11 +514,9 @@
</span><span class="cx">             continue;
</span><span class="cx">         Element&amp; candidate = downcast&lt;Element&gt;(*node);
</span><span class="cx">         int candidateTabIndex = candidate.tabIndex();
</span><del>-        if (isFocusableOrHasShadowTreeWithoutCustomFocusLogic(candidate, event) &amp;&amp; candidateTabIndex &gt; tabIndex) {
-            if (!winner || candidateTabIndex &lt; winningTabIndex) {
-                winner = &amp;candidate;
-                winningTabIndex = candidateTabIndex;
-            }
</del><ins>+        if (isFocusableOrHasShadowTreeWithoutCustomFocusLogic(candidate, event) &amp;&amp; candidateTabIndex &gt; tabIndex &amp;&amp; (!winner || candidateTabIndex &lt; winningTabIndex)) {
+            winner = &amp;candidate;
+            winningTabIndex = candidateTabIndex;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -535,7 +533,7 @@
</span><span class="cx">             continue;
</span><span class="cx">         Element&amp; element = downcast&lt;Element&gt;(*node);
</span><span class="cx">         int currentTabIndex = shadowAdjustedTabIndex(element, event);
</span><del>-        if ((isFocusableOrHasShadowTreeWithoutCustomFocusLogic(element, event) || isNonFocusableShadowHost(element, event)) &amp;&amp; currentTabIndex &lt; tabIndex &amp;&amp; currentTabIndex &gt; winningTabIndex) {
</del><ins>+        if (isFocusableOrHasShadowTreeWithoutCustomFocusLogic(element, event) &amp;&amp; currentTabIndex &lt; tabIndex &amp;&amp; currentTabIndex &gt; winningTabIndex) {
</ins><span class="cx">             winner = &amp;element;
</span><span class="cx">             winningTabIndex = currentTabIndex;
</span><span class="cx">         }
</span></span></pre>
</div>
</div>

</body>
</html>