Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1446)

Unified Diff: Source/core/page/FocusController.cpp

Issue 1187273002: Skip the whole shadow tree when its tabindex is -1. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/dom/shadow/focus-navigation-with-delegatesFocus-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/FocusController.cpp
diff --git a/Source/core/page/FocusController.cpp b/Source/core/page/FocusController.cpp
index db3dc8cc5b048b47bc5494a8fb43bec9202693f0..ec016f6a5c0a909e81a6dc5b2e5870853f9a3349 100644
--- a/Source/core/page/FocusController.cpp
+++ b/Source/core/page/FocusController.cpp
@@ -554,24 +554,25 @@ Element* FocusController::findFocusableElementRecursivelyForward(const FocusNavi
if (!found)
return nullptr;
if (isShadowHostDelegatesFocus(*found)) {
- if (isShadowHostWithoutCustomFocusLogic(*found)) {
+ // If tabindex is positive, find focusable node inside its shadow tree.
+ if (found->tabIndex() >= 0 && isShadowHostWithoutCustomFocusLogic(*found)) {
FocusNavigationScope innerScope = FocusNavigationScope::ownedByShadowHost(*found);
- Element* foundInInnerFocusScope = findFocusableElementRecursivelyForward(innerScope, nullptr);
- return foundInInnerFocusScope ? foundInInnerFocusScope : findFocusableElementRecursivelyForward(scope, found);
+ if (Element* foundInInnerFocusScope = findFocusableElementRecursivelyForward(innerScope, nullptr))
+ return foundInInnerFocusScope;
}
- // Skip to the next node.
- if (!isNonFocusableFocusScopeOwner(*found))
kochi 2015/06/17 07:11:49 In the previous CL[1], I added this line (563) but
- found = findFocusableElementRecursivelyForward(scope, found);
+ // Skip to the next node in the same scope.
+ found = findFocusableElementRecursivelyForward(scope, found);
}
if (!found || !isNonFocusableFocusScopeOwner(*found))
return found;
- // Now |found| is on a focusable scope owner (either shadow host or <shadow>)
+ // Now |found| is on a non focusable scope owner (either shadow host or <shadow>)
kochi 2015/06/17 07:11:49 The comment was wrong ;(
// Find inside the inward scope and return it if found. Otherwise continue searching in the same
// scope.
FocusNavigationScope innerScope = FocusNavigationScope::ownedByNonFocusableFocusScopeOwner(*found);
- Element* foundInInnerFocusScope = findFocusableElementRecursivelyForward(innerScope, nullptr);
- return foundInInnerFocusScope ? foundInInnerFocusScope : findFocusableElementRecursivelyForward(scope, found);
+ if (Element* foundInInnerFocusScope = findFocusableElementRecursivelyForward(innerScope, nullptr))
+ return foundInInnerFocusScope;
+ return findFocusableElementRecursivelyForward(scope, found);
kochi 2015/06/17 07:11:50 This chunk does not change the logic, but aligned
}
Element* FocusController::findFocusableElementRecursivelyBackward(const FocusNavigationScope& scope, Node* start)
@@ -594,6 +595,11 @@ Element* FocusController::findFocusableElementRecursivelyBackward(const FocusNav
return found;
}
+ // If delegatesFocus is true and tabindex is negative, skip the whole shadow tree under the
+ // shadow host.
+ if (isShadowHostDelegatesFocus(*found) && found->tabIndex() < 0)
+ return findFocusableElementRecursivelyBackward(scope, found);
+
// Now |found| is on a non focusable scope owner (either shadow host or <shadow>).
// Find focusable node in decendant scope. If not found, find next focusable node within the
// current scope.
« no previous file with comments | « LayoutTests/fast/dom/shadow/focus-navigation-with-delegatesFocus-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698