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

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

Issue 484383002: Disable the focus moves to an element which doesn't satisfy the spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Ver.2 Created 6 years, 4 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
Index: Source/core/page/FocusController.cpp
diff --git a/Source/core/page/FocusController.cpp b/Source/core/page/FocusController.cpp
index 149ff8a87bca01cdc267d43e738c6569f5615562..0a18a01eed7edba501cb369e7a1507833649782b 100644
--- a/Source/core/page/FocusController.cpp
+++ b/Source/core/page/FocusController.cpp
@@ -582,9 +582,10 @@ Node* FocusController::nextFocusableNode(FocusNavigationScope scope, Node* start
}
// First try to find a node with the same tabindex as start that comes after start in the scope.
- if (Node* winner = findNodeWithExactTabIndex(NodeTraversal::next(*start), tabIndex, FocusTypeForward))
- return winner;
-
+ if (tabIndex >= 0) {
hayato 2014/08/26 07:34:56 You can use `else` here rather than repeating `if`
+ if (Node* winner = findNodeWithExactTabIndex(NodeTraversal::next(*start), tabIndex, FocusTypeForward))
+ return winner;
+ }
if (!tabIndex)
// We've reached the last node in the document with a tabindex of 0. This is the end of the tabbing order.
return 0;
@@ -628,8 +629,10 @@ Node* FocusController::previousFocusableNode(FocusNavigationScope scope, Node* s
}
}
- if (Node* winner = findNodeWithExactTabIndex(startingNode, startingTabIndex, FocusTypeBackward))
- return winner;
+ if (startingTabIndex >= 0) {
hayato 2014/08/26 07:34:56 Ditto.
+ if (Node* winner = findNodeWithExactTabIndex(startingNode, startingTabIndex, FocusTypeBackward))
+ return winner;
+ }
// There are no nodes before start with the same tabindex as start, so look for a node that:
// 1) has the highest non-zero tabindex (that is less than start's tabindex), and

Powered by Google App Engine
This is Rietveld 408576698