<!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>[200576] trunk/Source/WebCore</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/200576">200576</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-05-09 09:20:20 -0700 (Mon, 09 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Refactor FocusController::findFocusableElementRecursively
https://bugs.webkit.org/show_bug.cgi?id=157415

Reviewed by Darin Adler.

Refactor FocusController::findFocusableElementRecursively and related functions. Extracted two functions:
nextFocusableElementWithinScope and previousFocusableElementWithinScope out of it since they didn't really share
any code other than calling findFocusableElement at the beginning.

Also renamed internal variant of nextFocusableElement and previousFocusableElement to nextFocusableElementOrScopeOwner
and previousFocusableElementOrScopeOwner. It was confusing to have these internal functions in addition to public
member functions that are used in Objective-C DOM API.

No new tests are added since there should be no behavioral change.

* page/FocusController.cpp:
(WebCore::FocusController::findFocusableElementDescendingDownIntoFrameDocument): Added a FIXME.
(WebCore::FocusController::advanceFocusInDocumentOrder): Use findFocusableElementAcrossFocusScope instead of manually
calling findFocusableElementRecursively and findFocusableElementDescendingDownIntoFrameDocument separately.
(WebCore::FocusController::findFocusableElementAcrossFocusScope): Now that findFocusableElementWithinScope calls
findFocusableElementDescendingDownIntoFrameDocument internally, there is no need to keep around &quot;found&quot; local variable.
Introduce a few early exists for a better clarity.
(WebCore::FocusController::findFocusableElementWithinScope): Renamed from findFocusableElementRecursively. Also call
findFocusableElementDescendingDownIntoFrameDocument here instead of findFocusableElementAcrossFocusScope.
(WebCore::FocusController::nextFocusableElementWithinScope): Extracted from findFocusableElementRecursively.
(WebCore::FocusController::previousFocusableElementWithinScope): Ditto.
(WebCore::FocusController::findFocusableElement):
(WebCore::FocusController::nextFocusableElement): Added a FIXME.
(WebCore::FocusController::previousFocusableElement): Ditto.
(WebCore::FocusController::findFocusableElementOrScopeOwner): Renamed from findFocusableElement for clarity.
(WebCore::FocusController::nextFocusableElementOrScopeOwner): Ditto from nextFocusableElement.
(WebCore::FocusController::previousFocusableElementOrScopeOwner): Ditto from nextFocusableElement.
* page/FocusController.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageFocusControllercpp">trunk/Source/WebCore/page/FocusController.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFocusControllerh">trunk/Source/WebCore/page/FocusController.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200575 => 200576)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-09 16:09:17 UTC (rev 200575)
+++ trunk/Source/WebCore/ChangeLog        2016-05-09 16:20:20 UTC (rev 200576)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2016-05-09  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        Refactor FocusController::findFocusableElementRecursively
+        https://bugs.webkit.org/show_bug.cgi?id=157415
+
+        Reviewed by Darin Adler.
+
+        Refactor FocusController::findFocusableElementRecursively and related functions. Extracted two functions:
+        nextFocusableElementWithinScope and previousFocusableElementWithinScope out of it since they didn't really share
+        any code other than calling findFocusableElement at the beginning.
+
+        Also renamed internal variant of nextFocusableElement and previousFocusableElement to nextFocusableElementOrScopeOwner
+        and previousFocusableElementOrScopeOwner. It was confusing to have these internal functions in addition to public
+        member functions that are used in Objective-C DOM API.
+
+        No new tests are added since there should be no behavioral change.
+
+        * page/FocusController.cpp:
+        (WebCore::FocusController::findFocusableElementDescendingDownIntoFrameDocument): Added a FIXME.
+        (WebCore::FocusController::advanceFocusInDocumentOrder): Use findFocusableElementAcrossFocusScope instead of manually
+        calling findFocusableElementRecursively and findFocusableElementDescendingDownIntoFrameDocument separately.
+        (WebCore::FocusController::findFocusableElementAcrossFocusScope): Now that findFocusableElementWithinScope calls
+        findFocusableElementDescendingDownIntoFrameDocument internally, there is no need to keep around &quot;found&quot; local variable.
+        Introduce a few early exists for a better clarity.
+        (WebCore::FocusController::findFocusableElementWithinScope): Renamed from findFocusableElementRecursively. Also call
+        findFocusableElementDescendingDownIntoFrameDocument here instead of findFocusableElementAcrossFocusScope.
+        (WebCore::FocusController::nextFocusableElementWithinScope): Extracted from findFocusableElementRecursively.
+        (WebCore::FocusController::previousFocusableElementWithinScope): Ditto.
+        (WebCore::FocusController::findFocusableElement):
+        (WebCore::FocusController::nextFocusableElement): Added a FIXME.
+        (WebCore::FocusController::previousFocusableElement): Ditto.
+        (WebCore::FocusController::findFocusableElementOrScopeOwner): Renamed from findFocusableElement for clarity.
+        (WebCore::FocusController::nextFocusableElementOrScopeOwner): Ditto from nextFocusableElement.
+        (WebCore::FocusController::previousFocusableElementOrScopeOwner): Ditto from nextFocusableElement.
+        * page/FocusController.h:
+
</ins><span class="cx"> 2016-05-09  Manuel Rego Casasnovas  &lt;rego@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [css-grid] Fix static position for positioned grid items
</span></span></pre></div>
<a id="trunkSourceWebCorepageFocusControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FocusController.cpp (200575 => 200576)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FocusController.cpp        2016-05-09 16:09:17 UTC (rev 200575)
+++ trunk/Source/WebCore/page/FocusController.cpp        2016-05-09 16:20:20 UTC (rev 200576)
</span><span class="lines">@@ -300,7 +300,8 @@
</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>-        Element* foundElement = findFocusableElement(direction, FocusNavigationScope::scopeOwnedByIFrame(owner), 0, event);
</del><ins>+        // FIXME: This can return a non-focusable shadow root.
+        Element* foundElement = findFocusableElementOrScopeOwner(direction, FocusNavigationScope::scopeOwnedByIFrame(owner), 0, event);
</ins><span class="cx">         if (!foundElement)
</span><span class="cx">             break;
</span><span class="cx">         ASSERT(element != foundElement);
</span><span class="lines">@@ -366,8 +367,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Chrome doesn't want focus, so we should wrap focus.
</span><del>-        element = findFocusableElementRecursively(direction, FocusNavigationScope::scopeOf(*m_page.mainFrame().document()), 0, event);
-        element = findFocusableElementDescendingDownIntoFrameDocument(direction, element.get(), event);
</del><ins>+        element = findFocusableElementAcrossFocusScope(direction, FocusNavigationScope::scopeOf(*m_page.mainFrame().document()), nullptr, event);
</ins><span class="cx"> 
</span><span class="cx">         if (!element)
</span><span class="cx">             return false;
</span><span class="lines">@@ -421,57 +421,74 @@
</span><span class="cx"> Element* FocusController::findFocusableElementAcrossFocusScope(FocusDirection direction, const FocusNavigationScope&amp; scope, Node* currentNode, KeyboardEvent* event)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!is&lt;Element&gt;(currentNode) || !isNonFocusableShadowHost(*downcast&lt;Element&gt;(currentNode), *event));
</span><del>-    Element* found;
</del><ins>+
</ins><span class="cx">     if (currentNode &amp;&amp; direction == FocusDirectionForward &amp;&amp; isFocusableShadowHost(*currentNode, *event)) {
</span><del>-        Element* foundInInnerFocusScope = findFocusableElementRecursively(direction, FocusNavigationScope::scopeOwnedByShadowHost(downcast&lt;Element&gt;(*currentNode)), 0, event);
-        found = foundInInnerFocusScope ? foundInInnerFocusScope : findFocusableElementRecursively(direction, scope, currentNode, event);
-    } else
-        found = findFocusableElementRecursively(direction, scope, currentNode, event);
</del><ins>+        if (Element* candidateInInnerScope = findFocusableElementWithinScope(direction, FocusNavigationScope::scopeOwnedByShadowHost(downcast&lt;Element&gt;(*currentNode)), 0, event))
+            return candidateInInnerScope;
+    }
</ins><span class="cx"> 
</span><ins>+    if (Element* candidateInCurrentScope = findFocusableElementWithinScope(direction, scope, currentNode, event))
+        return candidateInCurrentScope;
+
</ins><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><del>-    while (!found &amp;&amp; owner) {
-        FocusNavigationScope currentScope = FocusNavigationScope::scopeOf(*owner);
-        if (direction == FocusDirectionBackward &amp;&amp; isFocusableShadowHost(*owner, *event)) {
-            found = owner;
-            break;
-        }
-        found = findFocusableElementRecursively(direction, currentScope, owner, event);
-        owner = currentScope.owner();
</del><ins>+    while (owner) {
+        FocusNavigationScope outerScope = FocusNavigationScope::scopeOf(*owner);
+        if (direction == FocusDirectionBackward &amp;&amp; isFocusableShadowHost(*owner, *event))
+            return findFocusableElementDescendingDownIntoFrameDocument(direction, owner, event);
+        if (Element* candidateInOuterScope = findFocusableElementWithinScope(direction, outerScope, owner, event))
+            return candidateInOuterScope;
+        owner = outerScope.owner();
</ins><span class="cx">     }
</span><del>-    found = findFocusableElementDescendingDownIntoFrameDocument(direction, found, event);
-    return found;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Element* FocusController::findFocusableElementRecursively(FocusDirection direction, const FocusNavigationScope&amp; scope, Node* start, KeyboardEvent* event)
</del><ins>+Element* FocusController::findFocusableElementWithinScope(FocusDirection direction, const FocusNavigationScope&amp; scope, Node* start, KeyboardEvent* event)
</ins><span class="cx"> {
</span><span class="cx">     // Starting node is exclusive.
</span><del>-    Element* found = findFocusableElement(direction, scope, start, event);
</del><ins>+    Element* candidate = direction == FocusDirectionForward
+        ? nextFocusableElementWithinScope(scope, start, event)
+        : previousFocusableElementWithinScope(scope, start, event);
+    return findFocusableElementDescendingDownIntoFrameDocument(direction, candidate, event);
+}
+
+Element* FocusController::nextFocusableElementWithinScope(const FocusNavigationScope&amp; scope, Node* start, KeyboardEvent* event)
+{
+    Element* found = nextFocusableElementOrScopeOwner(scope, start, event);
</ins><span class="cx">     if (!found)
</span><span class="cx">         return nullptr;
</span><del>-    if (direction == FocusDirectionForward) {
-        if (!isNonFocusableShadowHost(*found, *event))
-            return found;
-        Element* foundInInnerFocusScope = findFocusableElementRecursively(direction, FocusNavigationScope::scopeOwnedByShadowHost(*found), 0, event);
-        return foundInInnerFocusScope ? foundInInnerFocusScope : findFocusableElementRecursively(direction, scope, found, event);
</del><ins>+    if (isNonFocusableShadowHost(*found, *event)) {
+        if (Element* foundInInnerFocusScope = nextFocusableElementWithinScope(FocusNavigationScope::scopeOwnedByShadowHost(*found), 0, event))
+            return foundInInnerFocusScope;
+        return nextFocusableElementWithinScope(scope, found, event);
</ins><span class="cx">     }
</span><del>-    ASSERT(direction == FocusDirectionBackward);
</del><ins>+    return found;
+}
+
+Element* FocusController::previousFocusableElementWithinScope(const FocusNavigationScope&amp; scope, Node* start, KeyboardEvent* event)
+{
+    Element* found = previousFocusableElementOrScopeOwner(scope, start, event);
+    if (!found)
+        return nullptr;
</ins><span class="cx">     if (isFocusableShadowHost(*found, *event)) {
</span><del>-        Element* foundInInnerFocusScope = findFocusableElementRecursively(direction, FocusNavigationScope::scopeOwnedByShadowHost(*found), 0, event);
-        return foundInInnerFocusScope ? foundInInnerFocusScope : found;
</del><ins>+        // Search an inner focusable element in the shadow tree from the end.
+        if (Element* foundInInnerFocusScope = previousFocusableElementWithinScope(FocusNavigationScope::scopeOwnedByShadowHost(*found), 0, event))
+            return foundInInnerFocusScope;
+        return found;
</ins><span class="cx">     }
</span><span class="cx">     if (isNonFocusableShadowHost(*found, *event)) {
</span><del>-        Element* foundInInnerFocusScope = findFocusableElementRecursively(direction, FocusNavigationScope::scopeOwnedByShadowHost(*found), 0, event);
-        return foundInInnerFocusScope ? foundInInnerFocusScope :findFocusableElementRecursively(direction, scope, found, event);
</del><ins>+        if (Element* foundInInnerFocusScope = previousFocusableElementWithinScope(FocusNavigationScope::scopeOwnedByShadowHost(*found), 0, event))
+            return foundInInnerFocusScope;
+        return previousFocusableElementWithinScope(scope, found, event);
</ins><span class="cx">     }
</span><span class="cx">     return found;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Element* FocusController::findFocusableElement(FocusDirection direction, const FocusNavigationScope&amp; scope, Node* node, KeyboardEvent* event)
</del><ins>+Element* FocusController::findFocusableElementOrScopeOwner(FocusDirection direction, const FocusNavigationScope&amp; scope, Node* node, KeyboardEvent* event)
</ins><span class="cx"> {
</span><span class="cx">     return (direction == FocusDirectionForward)
</span><del>-        ? nextFocusableElement(scope, node, event)
-        : previousFocusableElement(scope, node, event);
</del><ins>+        ? nextFocusableElementOrScopeOwner(scope, node, event)
+        : previousFocusableElementOrScopeOwner(scope, node, event);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Element* FocusController::findElementWithExactTabIndex(const FocusNavigationScope&amp; scope, Node* start, int tabIndex, KeyboardEvent* event, FocusDirection direction)
</span><span class="lines">@@ -528,17 +545,19 @@
</span><span class="cx"> 
</span><span class="cx"> Element* FocusController::nextFocusableElement(Node&amp; start)
</span><span class="cx"> {
</span><ins>+    // FIXME: This can return a non-focusable shadow host.
</ins><span class="cx">     Ref&lt;KeyboardEvent&gt; keyEvent = KeyboardEvent::createForDummy();
</span><del>-    return nextFocusableElement(FocusNavigationScope::scopeOf(start), &amp;start, keyEvent.ptr());
</del><ins>+    return nextFocusableElementOrScopeOwner(FocusNavigationScope::scopeOf(start), &amp;start, keyEvent.ptr());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Element* FocusController::previousFocusableElement(Node&amp; start)
</span><span class="cx"> {
</span><ins>+    // FIXME: This can return a non-focusable shadow host.
</ins><span class="cx">     Ref&lt;KeyboardEvent&gt; keyEvent = KeyboardEvent::createForDummy();
</span><del>-    return previousFocusableElement(FocusNavigationScope::scopeOf(start), &amp;start, keyEvent.ptr());
</del><ins>+    return previousFocusableElementOrScopeOwner(FocusNavigationScope::scopeOf(start), &amp;start, keyEvent.ptr());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Element* FocusController::nextFocusableElement(const FocusNavigationScope&amp; scope, Node* start, KeyboardEvent* event)
</del><ins>+Element* FocusController::nextFocusableElementOrScopeOwner(const FocusNavigationScope&amp; scope, Node* start, KeyboardEvent* event)
</ins><span class="cx"> {
</span><span class="cx">     int startTabIndex = 0;
</span><span class="cx">     if (start &amp;&amp; is&lt;Element&gt;(*start))
</span><span class="lines">@@ -575,7 +594,7 @@
</span><span class="cx">     return findElementWithExactTabIndex(scope, &amp;scope.rootNode(), 0, event, FocusDirectionForward);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Element* FocusController::previousFocusableElement(const FocusNavigationScope&amp; scope, Node* start, KeyboardEvent* event)
</del><ins>+Element* FocusController::previousFocusableElementOrScopeOwner(const FocusNavigationScope&amp; scope, Node* start, KeyboardEvent* event)
</ins><span class="cx"> {
</span><span class="cx">     Node* last = nullptr;
</span><span class="cx">     for (Node* node = &amp;scope.rootNode(); node; node = scope.lastChildInScope(node))
</span></span></pre></div>
<a id="trunkSourceWebCorepageFocusControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FocusController.h (200575 => 200576)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FocusController.h        2016-05-09 16:09:17 UTC (rev 200575)
+++ trunk/Source/WebCore/page/FocusController.h        2016-05-09 16:20:20 UTC (rev 200576)
</span><span class="lines">@@ -89,7 +89,11 @@
</span><span class="cx">     bool advanceFocusInDocumentOrder(FocusDirection, KeyboardEvent*, bool initialFocus);
</span><span class="cx"> 
</span><span class="cx">     Element* findFocusableElementAcrossFocusScope(FocusDirection, const FocusNavigationScope&amp; startScope, Node* start, KeyboardEvent*);
</span><del>-    Element* findFocusableElementRecursively(FocusDirection, const FocusNavigationScope&amp;, Node* start, KeyboardEvent*);
</del><ins>+
+    Element* findFocusableElementWithinScope(FocusDirection, const FocusNavigationScope&amp;, Node* start, KeyboardEvent*);
+    Element* nextFocusableElementWithinScope(const FocusNavigationScope&amp;, Node* start, KeyboardEvent*);
+    Element* previousFocusableElementWithinScope(const FocusNavigationScope&amp;, Node* start, KeyboardEvent*);
+
</ins><span class="cx">     Element* findFocusableElementDescendingDownIntoFrameDocument(FocusDirection, Element*, KeyboardEvent*);
</span><span class="cx"> 
</span><span class="cx">     // Searches through the given tree scope, starting from start node, for the next/previous selectable element that comes after/before start node.
</span><span class="lines">@@ -101,12 +105,12 @@
</span><span class="cx">     // @return The focus node that comes after/before start node.
</span><span class="cx">     //
</span><span class="cx">     // See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1
</span><del>-    Element* findFocusableElement(FocusDirection, const FocusNavigationScope&amp;, Node* start, KeyboardEvent*);
</del><ins>+    Element* findFocusableElementOrScopeOwner(FocusDirection, const FocusNavigationScope&amp;, Node* start, KeyboardEvent*);
</ins><span class="cx"> 
</span><span class="cx">     Element* findElementWithExactTabIndex(const FocusNavigationScope&amp;, Node* start, int tabIndex, KeyboardEvent*, FocusDirection);
</span><span class="cx">     
</span><del>-    Element* nextFocusableElement(const FocusNavigationScope&amp;, Node* start, KeyboardEvent*);
-    Element* previousFocusableElement(const FocusNavigationScope&amp;, Node* start, KeyboardEvent*);
</del><ins>+    Element* nextFocusableElementOrScopeOwner(const FocusNavigationScope&amp;, Node* start, KeyboardEvent*);
+    Element* previousFocusableElementOrScopeOwner(const FocusNavigationScope&amp;, Node* start, KeyboardEvent*);
</ins><span class="cx"> 
</span><span class="cx">     bool advanceFocusDirectionallyInContainer(Node* container, const LayoutRect&amp; startingRect, FocusDirection, KeyboardEvent*);
</span><span class="cx">     void findFocusCandidateInContainer(Node&amp; container, const LayoutRect&amp; startingRect, FocusDirection, KeyboardEvent*, FocusCandidate&amp; closest);
</span></span></pre>
</div>
</div>

</body>
</html>