Index: Source/core/page/FocusController.cpp |
diff --git a/Source/core/page/FocusController.cpp b/Source/core/page/FocusController.cpp |
index 5263e8f4b73cab27619921a4bcb980d2d6cdee98..8ccd5e2e749b888e115749d8b3bd3343a4ab0edd 100644 |
--- a/Source/core/page/FocusController.cpp |
+++ b/Source/core/page/FocusController.cpp |
@@ -526,7 +526,7 @@ Node* FocusController::findFocusableNodeAcrossFocusScopesBackward(const FocusNav |
if (!owner) |
break; |
currentScope = FocusNavigationScope::focusNavigationScopeOf(*owner); |
- if (isKeyboardFocusableShadowHost(*owner) && toElement(owner)->tabStop()) { |
+ if (isKeyboardFocusableShadowHost(*owner) && !toElement(owner)->shadowRoot()->delegatesFocus()) { |
found = owner; |
break; |
} |
@@ -548,7 +548,8 @@ Node* FocusController::findFocusableNodeRecursivelyForward(const FocusNavigation |
Node* found = findFocusableNode(WebFocusTypeForward, scope, start); |
if (!found) |
return nullptr; |
- if (found->isElementNode() && !toElement(found)->tabStop()) { |
+ // TODO(kochi): simplify this logic further. |
+ if (found->isElementNode() && toElement(found)->shadowRoot() && toElement(found)->shadowRoot()->delegatesFocus()) { |
if (isShadowHostWithoutCustomFocusLogic(*found)) { |
FocusNavigationScope innerScope = FocusNavigationScope::ownedByShadowHost(*found); |
Node* foundInInnerFocusScope = findFocusableNodeRecursivelyForward(innerScope, nullptr); |
@@ -584,7 +585,8 @@ Node* FocusController::findFocusableNodeRecursivelyBackward(const FocusNavigatio |
Node* foundInInnerFocusScope = findFocusableNodeRecursivelyBackward(innerScope, nullptr); |
if (foundInInnerFocusScope) |
return foundInInnerFocusScope; |
- if (found->isElementNode() && !toElement(found)->tabStop()) |
+ // TODO(kochi): Simplify this logic further. |
+ if (found->isElementNode() && toElement(found)->shadowRoot() && toElement(found)->shadowRoot()->delegatesFocus()) |
found = findFocusableNodeRecursivelyBackward(scope, found); |
return found; |
} |
@@ -598,7 +600,7 @@ Node* FocusController::findFocusableNodeRecursivelyBackward(const FocusNavigatio |
return foundInInnerFocusScope ? foundInInnerFocusScope : findFocusableNodeRecursivelyBackward(scope, found); |
} |
- return found->isElementNode() && toElement(found)->tabStop() ? found : findFocusableNodeRecursivelyBackward(scope, found); |
+ return found->isElementNode() && !(toElement(found)->shadowRoot() && toElement(found)->shadowRoot()->delegatesFocus()) ? found : findFocusableNodeRecursivelyBackward(scope, found); |
} |
static Node* findNodeWithExactTabIndex(Node* start, int tabIndex, WebFocusType type) |