<!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>[191186] 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/191186">191186</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2015-10-16 11:01:57 -0700 (Fri, 16 Oct 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove NodeRenderingTraversal
https://bugs.webkit.org/show_bug.cgi?id=150226

Reviewed by Chris Dumez.

It has been reduced to an implementation detail of FocusController. Move the remaining
functions there as they have no general utility (and are wrong for focus navigation too).

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/DOMAllInOne.cpp:
* dom/NodeRenderingTraversal.cpp: Removed.
* dom/NodeRenderingTraversal.h: Removed.
* page/FocusController.cpp:
(WebCore::firstChildInScope):
(WebCore::lastChildInScope):
(WebCore::parentInScope):
(WebCore::nextInScope):
(WebCore::previousInScope):
(WebCore::FocusNavigationScope::FocusNavigationScope):
(WebCore::FocusNavigationScope::focusNavigationScopeOf):
(WebCore::FocusController::findElementWithExactTabIndex):
(WebCore::nextElementWithGreaterTabIndex):
(WebCore::previousElementWithLowerTabIndex):
(WebCore::FocusController::nextFocusableElement):
(WebCore::FocusController::previousFocusableElement):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoredomDOMAllInOnecpp">trunk/Source/WebCore/dom/DOMAllInOne.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFocusControllercpp">trunk/Source/WebCore/page/FocusController.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoredomNodeRenderingTraversalcpp">trunk/Source/WebCore/dom/NodeRenderingTraversal.cpp</a></li>
<li><a href="#trunkSourceWebCoredomNodeRenderingTraversalh">trunk/Source/WebCore/dom/NodeRenderingTraversal.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (191185 => 191186)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2015-10-16 17:56:35 UTC (rev 191185)
+++ trunk/Source/WebCore/CMakeLists.txt        2015-10-16 18:01:57 UTC (rev 191186)
</span><span class="lines">@@ -1487,7 +1487,6 @@
</span><span class="cx">     dom/NodeIterator.cpp
</span><span class="cx">     dom/NodeOrString.cpp
</span><span class="cx">     dom/NodeRareData.cpp
</span><del>-    dom/NodeRenderingTraversal.cpp
</del><span class="cx">     dom/NodeTraversal.cpp
</span><span class="cx">     dom/OverflowEvent.cpp
</span><span class="cx">     dom/PageTransitionEvent.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (191185 => 191186)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-10-16 17:56:35 UTC (rev 191185)
+++ trunk/Source/WebCore/ChangeLog        2015-10-16 18:01:57 UTC (rev 191186)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2015-10-16  Antti Koivisto  &lt;antti@apple.com&gt;
+
+        Remove NodeRenderingTraversal
+        https://bugs.webkit.org/show_bug.cgi?id=150226
+
+        Reviewed by Chris Dumez.
+
+        It has been reduced to an implementation detail of FocusController. Move the remaining
+        functions there as they have no general utility (and are wrong for focus navigation too).
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/DOMAllInOne.cpp:
+        * dom/NodeRenderingTraversal.cpp: Removed.
+        * dom/NodeRenderingTraversal.h: Removed.
+        * page/FocusController.cpp:
+        (WebCore::firstChildInScope):
+        (WebCore::lastChildInScope):
+        (WebCore::parentInScope):
+        (WebCore::nextInScope):
+        (WebCore::previousInScope):
+        (WebCore::FocusNavigationScope::FocusNavigationScope):
+        (WebCore::FocusNavigationScope::focusNavigationScopeOf):
+        (WebCore::FocusController::findElementWithExactTabIndex):
+        (WebCore::nextElementWithGreaterTabIndex):
+        (WebCore::previousElementWithLowerTabIndex):
+        (WebCore::FocusController::nextFocusableElement):
+        (WebCore::FocusController::previousFocusableElement):
+
</ins><span class="cx"> 2015-10-16  David Hyatt  &lt;hyatt@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Build fix. &quot;all&quot; keyword introduction exposed a typo bug in the grid-area property definition.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (191185 => 191186)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-10-16 17:56:35 UTC (rev 191185)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-10-16 18:01:57 UTC (rev 191186)
</span><span class="lines">@@ -4117,8 +4117,6 @@
</span><span class="cx">                 A740B5A514C935AB00A77FA4 /* JSInternalSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B4EA7914C9348400C8F5BF /* JSInternalSettings.h */; };
</span><span class="cx">                 A740B5A714C935AF00A77FA4 /* JSInternalSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B4EA7814C9348400C8F5BF /* JSInternalSettings.cpp */; };
</span><span class="cx">                 A74BB76B13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h in Headers */ = {isa = PBXBuildFile; fileRef = A74BB76A13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                A74F3EF31678B24A00B05A6E /* NodeRenderingTraversal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7211F231678A54200957444 /* NodeRenderingTraversal.cpp */; };
-                A74F3EF51678B24F00B05A6E /* NodeRenderingTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = A7211F241678A54200957444 /* NodeRenderingTraversal.h */; };
</del><span class="cx">                 A75E497610752ACB00C9B896 /* SerializedScriptValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A75E497410752ACB00C9B896 /* SerializedScriptValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A75E497710752ACB00C9B896 /* SerializedScriptValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */; };
</span><span class="cx">                 A75E8B880E1DE2D6007F2481 /* FEBlend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75E8B800E1DE2D6007F2481 /* FEBlend.cpp */; };
</span><span class="lines">@@ -11612,8 +11610,6 @@
</span><span class="cx">                 A7197F23175689C4007B9442 /* PageThrottler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageThrottler.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A7197F2517568AE5007B9442 /* PageThrottler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageThrottler.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A71A70C911AFB02000989D6D /* HTMLMeterElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLMeterElement.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                A7211F231678A54200957444 /* NodeRenderingTraversal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NodeRenderingTraversal.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                A7211F241678A54200957444 /* NodeRenderingTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeRenderingTraversal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 A723F77A1484CA4C008C6DBE /* PlatformExportMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformExportMacros.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A72763BE16689BFB002FCACB /* UserActionElementSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserActionElementSet.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A73F95FC12C97BFE0031AAF9 /* RoundedRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RoundedRect.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -23772,8 +23768,6 @@
</span><span class="cx">                                 7CEAC1061B483D1D00334482 /* NodeOrString.h */,
</span><span class="cx">                                 4FAB48661643A67E00F70C07 /* NodeRareData.cpp */,
</span><span class="cx">                                 63189AE20E83A33300012E41 /* NodeRareData.h */,
</span><del>-                                A7211F231678A54200957444 /* NodeRenderingTraversal.cpp */,
-                                A7211F241678A54200957444 /* NodeRenderingTraversal.h */,
</del><span class="cx">                                 63D7B32C0E78CD3F00F7617C /* NodeRenderStyle.h */,
</span><span class="cx">                                 E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */,
</span><span class="cx">                                 E43105BA16750F1600DB2FB8 /* NodeTraversal.h */,
</span><span class="lines">@@ -26579,7 +26573,6 @@
</span><span class="cx">                                 A818721B0977D3C0005826D9 /* NodeList.h in Headers */,
</span><span class="cx">                                 7CEAC1071B483D1D00334482 /* NodeOrString.h in Headers */,
</span><span class="cx">                                 63189AE30E83A33300012E41 /* NodeRareData.h in Headers */,
</span><del>-                                A74F3EF51678B24F00B05A6E /* NodeRenderingTraversal.h in Headers */,
</del><span class="cx">                                 63D7B32D0E78CD3F00F7617C /* NodeRenderStyle.h in Headers */,
</span><span class="cx">                                 E43105BB16750F1600DB2FB8 /* NodeTraversal.h in Headers */,
</span><span class="cx">                                 9382AAB40D8C386100F357A6 /* NodeWithIndex.h in Headers */,
</span><span class="lines">@@ -30232,7 +30225,6 @@
</span><span class="cx">                                 854FE7340A2297BE0058D7AD /* NodeIterator.cpp in Sources */,
</span><span class="cx">                                 7CEAC1091B483D7F00334482 /* NodeOrString.cpp in Sources */,
</span><span class="cx">                                 4FFC022B1643B710004E1638 /* NodeRareData.cpp in Sources */,
</span><del>-                                A74F3EF31678B24A00B05A6E /* NodeRenderingTraversal.cpp in Sources */,
</del><span class="cx">                                 E43105B816750F0C00DB2FB8 /* NodeTraversal.cpp in Sources */,
</span><span class="cx">                                 33503CC71017A1B1003B47E1 /* Notification.cpp in Sources */,
</span><span class="cx">                                 3390CA550FFC157B00921962 /* NotificationCenter.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoredomDOMAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DOMAllInOne.cpp (191185 => 191186)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DOMAllInOne.cpp        2015-10-16 17:56:35 UTC (rev 191185)
+++ trunk/Source/WebCore/dom/DOMAllInOne.cpp        2015-10-16 18:01:57 UTC (rev 191186)
</span><span class="lines">@@ -113,7 +113,6 @@
</span><span class="cx"> #include &quot;NodeIterator.cpp&quot;
</span><span class="cx"> #include &quot;NodeOrString.cpp&quot;
</span><span class="cx"> #include &quot;NodeRareData.cpp&quot;
</span><del>-#include &quot;NodeRenderingTraversal.cpp&quot;
</del><span class="cx"> #include &quot;NodeTraversal.cpp&quot;
</span><span class="cx"> #include &quot;OverflowEvent.cpp&quot;
</span><span class="cx"> #include &quot;PageTransitionEvent.cpp&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeRenderingTraversalcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/dom/NodeRenderingTraversal.cpp (191185 => 191186)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/NodeRenderingTraversal.cpp        2015-10-16 17:56:35 UTC (rev 191185)
+++ trunk/Source/WebCore/dom/NodeRenderingTraversal.cpp        2015-10-16 18:01:57 UTC (rev 191186)
</span><span class="lines">@@ -1,111 +0,0 @@
</span><del>-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;NodeRenderingTraversal.h&quot;
-
-#include &quot;ShadowRoot.h&quot;
-
-namespace WebCore {
-
-namespace NodeRenderingTraversal {
-
-static ContainerNode* traverseParent(const Node* node)
-{
-    if (node-&gt;isShadowRoot())
-        return nullptr;
-
-    ContainerNode* parent = node-&gt;parentNode();
-    if (parent &amp;&amp; parent-&gt;shadowRoot())
-        return nullptr;
-
-    return parent;
-}
-
-static Node* traverseFirstChild(const Node* node)
-{
-    ASSERT(node);
-    if (node-&gt;shadowRoot())
-        return nullptr;
-    return node-&gt;firstChild();
-}
-
-static Node* traverseLastChild(const Node* node)
-{
-    ASSERT(node);
-    if (node-&gt;shadowRoot())
-        return nullptr;
-    return node-&gt;lastChild();
-}
-
-static Node* traverseNextSibling(const Node* node)
-{
-    ASSERT(node);
-    return node-&gt;nextSibling();
-}
-
-static Node* traversePreviousSibling(const Node* node)
-{
-    ASSERT(node);
-    return node-&gt;previousSibling();
-}
-
-Node* nextInScope(const Node* node)
-{
-    if (Node* next = traverseFirstChild(node))
-        return next;
-    if (Node* next = traverseNextSibling(node))
-        return next;
-    const Node* current = node;
-    while (current &amp;&amp; !traverseNextSibling(current))
-        current = traverseParent(current);
-    return current ? traverseNextSibling(current) : 0;
-}
-
-Node* previousInScope(const Node* node)
-{
-    if (Node* current = traversePreviousSibling(node)) {
-        while (Node* child = traverseLastChild(current))
-            current = child;
-        return current;
-    }
-    return traverseParent(node);
-}
-
-Node* parentInScope(const Node* node)
-{
-    return traverseParent(node);
-}
-
-Node* lastChildInScope(const Node* node)
-{
-    return traverseLastChild(node);
-}
-
-}
-
-} // namespace
</del></span></pre></div>
<a id="trunkSourceWebCoredomNodeRenderingTraversalh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/dom/NodeRenderingTraversal.h (191185 => 191186)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/NodeRenderingTraversal.h        2015-10-16 17:56:35 UTC (rev 191185)
+++ trunk/Source/WebCore/dom/NodeRenderingTraversal.h        2015-10-16 18:01:57 UTC (rev 191186)
</span><span class="lines">@@ -1,46 +0,0 @@
</span><del>-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef NodeRenderingTraversal_h
-#define NodeRenderingTraversal_h
-
-#include &quot;ContainerNode.h&quot;
-
-namespace WebCore {
-
-namespace NodeRenderingTraversal {
-
-Node* nextInScope(const Node*);
-Node* previousInScope(const Node*);
-Node* parentInScope(const Node*);
-Node* lastChildInScope(const Node*);
-
-}
-
-} // namespace WebCore
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCorepageFocusControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FocusController.cpp (191185 => 191186)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FocusController.cpp        2015-10-16 17:56:35 UTC (rev 191185)
+++ trunk/Source/WebCore/page/FocusController.cpp        2015-10-16 18:01:57 UTC (rev 191186)
</span><span class="lines">@@ -50,7 +50,6 @@
</span><span class="cx"> #include &quot;HitTestResult.h&quot;
</span><span class="cx"> #include &quot;KeyboardEvent.h&quot;
</span><span class="cx"> #include &quot;MainFrame.h&quot;
</span><del>-#include &quot;NodeRenderingTraversal.h&quot;
</del><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;Range.h&quot;
</span><span class="cx"> #include &quot;RenderWidget.h&quot;
</span><span class="lines">@@ -68,6 +67,57 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx"> 
</span><ins>+// FIXME: Focus navigation should work with shadow trees that have slots.
+static Node* firstChildInScope(const Node* node)
+{
+    ASSERT(node);
+    if (node-&gt;shadowRoot())
+        return nullptr;
+    return node-&gt;firstChild();
+}
+
+static Node* lastChildInScope(const Node* node)
+{
+    ASSERT(node);
+    if (node-&gt;shadowRoot())
+        return nullptr;
+    return node-&gt;lastChild();
+}
+
+static Node* parentInScope(const Node* node)
+{
+    if (node-&gt;isShadowRoot())
+        return nullptr;
+
+    ContainerNode* parent = node-&gt;parentNode();
+    if (parent &amp;&amp; parent-&gt;shadowRoot())
+        return nullptr;
+
+    return parent;
+}
+
+static Node* nextInScope(const Node* node)
+{
+    if (Node* next = firstChildInScope(node))
+        return next;
+    if (Node* next = node-&gt;nextSibling())
+        return next;
+    const Node* current = node;
+    while (current &amp;&amp; !current-&gt;nextSibling())
+        current = parentInScope(current);
+    return current ? current-&gt;nextSibling() : nullptr;
+}
+
+static Node* previousInScope(const Node* node)
+{
+    if (Node* current = node-&gt;previousSibling()) {
+        while (Node* child = lastChildInScope(current))
+            current = child;
+        return current;
+    }
+    return parentInScope(node);
+}
+
</ins><span class="cx"> FocusNavigationScope::FocusNavigationScope(TreeScope* treeScope)
</span><span class="cx">     : m_rootTreeScope(treeScope)
</span><span class="cx"> {
</span><span class="lines">@@ -93,7 +143,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(node);
</span><span class="cx">     Node* root = node;
</span><del>-    for (Node* n = node; n; n = NodeRenderingTraversal::parentInScope(n))
</del><ins>+    for (Node* n = node; n; n = parentInScope(n))
</ins><span class="cx">         root = n;
</span><span class="cx">     // The result is not always a ShadowRoot nor a DocumentNode since
</span><span class="cx">     // a starting node is in an orphaned tree in composed shadow tree.
</span><span class="lines">@@ -410,7 +460,6 @@
</span><span class="cx"> Element* FocusController::findElementWithExactTabIndex(Node* start, int tabIndex, KeyboardEvent* event, FocusDirection direction)
</span><span class="cx"> {
</span><span class="cx">     // Search is inclusive of start
</span><del>-    using namespace NodeRenderingTraversal;
</del><span class="cx">     for (Node* node = start; node; node = direction == FocusDirectionForward ? nextInScope(node) : previousInScope(node)) {
</span><span class="cx">         if (!is&lt;Element&gt;(*node))
</span><span class="cx">             continue;
</span><span class="lines">@@ -426,7 +475,7 @@
</span><span class="cx">     // Search is inclusive of start
</span><span class="cx">     int winningTabIndex = std::numeric_limits&lt;short&gt;::max() + 1;
</span><span class="cx">     Element* winner = nullptr;
</span><del>-    for (Node* node = start; node; node = NodeRenderingTraversal::nextInScope(node)) {
</del><ins>+    for (Node* node = start; node; node = nextInScope(node)) {
</ins><span class="cx">         if (!is&lt;Element&gt;(*node))
</span><span class="cx">             continue;
</span><span class="cx">         Element&amp; element = downcast&lt;Element&gt;(*node);
</span><span class="lines">@@ -444,7 +493,7 @@
</span><span class="cx">     // Search is inclusive of start
</span><span class="cx">     int winningTabIndex = 0;
</span><span class="cx">     Element* winner = nullptr;
</span><del>-    for (Node* node = start; node; node = NodeRenderingTraversal::previousInScope(node)) {
</del><ins>+    for (Node* node = start; node; node = previousInScope(node)) {
</ins><span class="cx">         if (!is&lt;Element&gt;(*node))
</span><span class="cx">             continue;
</span><span class="cx">         Element&amp; element = downcast&lt;Element&gt;(*node);
</span><span class="lines">@@ -459,8 +508,6 @@
</span><span class="cx"> 
</span><span class="cx"> Element* FocusController::nextFocusableElement(FocusNavigationScope scope, Node* start, KeyboardEvent* event)
</span><span class="cx"> {
</span><del>-    using namespace NodeRenderingTraversal;
-
</del><span class="cx">     if (start) {
</span><span class="cx">         int tabIndex = adjustedTabIndex(*start, *event);
</span><span class="cx">         // If a node is excluded from the normal tabbing cycle, the next focusable node is determined by tree order
</span><span class="lines">@@ -497,7 +544,7 @@
</span><span class="cx"> Element* FocusController::previousFocusableElement(FocusNavigationScope scope, Node* start, KeyboardEvent* event)
</span><span class="cx"> {
</span><span class="cx">     Node* last = nullptr;
</span><del>-    for (Node* node = scope.rootNode(); node; node = NodeRenderingTraversal::lastChildInScope(node))
</del><ins>+    for (Node* node = scope.rootNode(); node; node = lastChildInScope(node))
</ins><span class="cx">         last = node;
</span><span class="cx">     ASSERT(last);
</span><span class="cx"> 
</span><span class="lines">@@ -506,7 +553,7 @@
</span><span class="cx">     Node* startingNode;
</span><span class="cx">     int startingTabIndex;
</span><span class="cx">     if (start) {
</span><del>-        startingNode = NodeRenderingTraversal::previousInScope(start);
</del><ins>+        startingNode = previousInScope(start);
</ins><span class="cx">         startingTabIndex = adjustedTabIndex(*start, *event);
</span><span class="cx">     } else {
</span><span class="cx">         startingNode = last;
</span><span class="lines">@@ -515,7 +562,7 @@
</span><span class="cx"> 
</span><span class="cx">     // However, if a node is excluded from the normal tabbing cycle, the previous focusable node is determined by tree order
</span><span class="cx">     if (startingTabIndex &lt; 0) {
</span><del>-        for (Node* node = startingNode; node; node = NodeRenderingTraversal::previousInScope(node)) {
</del><ins>+        for (Node* node = startingNode; node; node = previousInScope(node)) {
</ins><span class="cx">             if (!is&lt;Element&gt;(*node))
</span><span class="cx">                 continue;
</span><span class="cx">             Element&amp; element = downcast&lt;Element&gt;(*node);
</span></span></pre>
</div>
</div>

</body>
</html>