| Index: third_party/WebKit/Source/core/page/FocusController.cpp
|
| diff --git a/third_party/WebKit/Source/core/page/FocusController.cpp b/third_party/WebKit/Source/core/page/FocusController.cpp
|
| index f13385c9fd2253b38c169aa69011f1ae4c49ec79..9438e9be717ab0f510b5b59c501380f46734d2d1 100644
|
| --- a/third_party/WebKit/Source/core/page/FocusController.cpp
|
| +++ b/third_party/WebKit/Source/core/page/FocusController.cpp
|
| @@ -440,15 +440,16 @@ Element* findElementWithExactTabIndex(ScopedFocusNavigation& scope,
|
| Element* nextElementWithGreaterTabIndex(ScopedFocusNavigation& scope,
|
| int tabIndex) {
|
| // Search is inclusive of start
|
| - int winningTabIndex = std::numeric_limits<short>::max() + 1;
|
| + int winningTabIndex = std::numeric_limits<int>::max();
|
| Element* winner = nullptr;
|
| for (; scope.currentElement(); scope.moveToNext()) {
|
| Element* current = scope.currentElement();
|
| int currentTabIndex = adjustedTabIndex(*current);
|
| - if (shouldVisit(*current) && currentTabIndex > tabIndex &&
|
| - currentTabIndex < winningTabIndex) {
|
| - winner = current;
|
| - winningTabIndex = currentTabIndex;
|
| + if (shouldVisit(*current) && currentTabIndex > tabIndex) {
|
| + if (!winner || currentTabIndex < winningTabIndex) {
|
| + winner = current;
|
| + winningTabIndex = currentTabIndex;
|
| + }
|
| }
|
| }
|
| return winner;
|
| @@ -547,8 +548,7 @@ Element* previousFocusableElement(ScopedFocusNavigation& scope) {
|
| // 1) has the highest non-zero tabindex (that is less than start's tabindex),
|
| // and
|
| // 2) comes last in the scope, if there's a tie.
|
| - tabIndex =
|
| - (current && tabIndex) ? tabIndex : std::numeric_limits<short>::max();
|
| + tabIndex = (current && tabIndex) ? tabIndex : std::numeric_limits<int>::max();
|
| scope.moveToLast();
|
| return previousElementWithLowerTabIndex(scope, tabIndex);
|
| }
|
|
|