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

Issue 2562753003: Fix focus navigation getting stuck (Closed)

Created:
4 years ago by kochi
Modified:
4 years ago
Reviewers:
hayato
CC:
blink-reviews, chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix focus navigation getting stuck The ScopedFocusNavigation class, which is used internally for keeping state of traversing next/previous focusable element in a scope, could become inconsistent state that the current element of the scope does not point to the element that is being traversed. Specifically, such situation happens when nextElementWithGreaterTabIndex() and previousElementWithLowerTabIndex() are called. These functions moves the current pointer within the whole scope and when the function finishes, all elements are exhausted and the current pointer will be null, while it can return some element inside the scope. Therefore, in findFocusableElementRecursivelyForward() and findFocusableElementRecursivelyBackward(), both of which has a loop while (found) { ... } and inside the loop, the following pattern found= findFocusableElementInternal(); continue; can be affected by this inconsistency, because findFocusableElementInternal() can end up calling those problematic functions. This CL also refactors the ScopedFocusNavigation class a bit, to hide these traversal state within the class, and it now exposes only "findFocusableElement(forward or backward)" API for traversing. BUG=671428 Committed: https://crrev.com/960b8cda43c4d804f79ecf75b82559751f21819c Cr-Commit-Position: refs/heads/master@{#438108}

Patch Set 1 #

Patch Set 2 : Clean up #

Total comments: 2

Patch Set 3 : Refactor ScopedFocusNavigation class. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+107 lines, -97 lines) Patch
A third_party/WebKit/LayoutTests/shadow-dom/crashes/focus-navigation-infinite-loop.html View 1 chunk +30 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/page/FocusController.cpp View 1 2 11 chunks +77 lines, -97 lines 0 comments Download

Messages

Total messages: 28 (20 generated)
kochi
PTAL
4 years ago (2016-12-09 12:34:27 UTC) #9
hayato
https://codereview.chromium.org/2562753003/diff/20001/third_party/WebKit/Source/core/page/FocusController.cpp File third_party/WebKit/Source/core/page/FocusController.cpp (right): https://codereview.chromium.org/2562753003/diff/20001/third_party/WebKit/Source/core/page/FocusController.cpp#newcode561 third_party/WebKit/Source/core/page/FocusController.cpp:561: scope.setCurrentElement(found); It does not look a good idea to ...
4 years ago (2016-12-13 05:41:57 UTC) #13
kochi
https://codereview.chromium.org/2562753003/diff/20001/third_party/WebKit/Source/core/page/FocusController.cpp File third_party/WebKit/Source/core/page/FocusController.cpp (right): https://codereview.chromium.org/2562753003/diff/20001/third_party/WebKit/Source/core/page/FocusController.cpp#newcode561 third_party/WebKit/Source/core/page/FocusController.cpp:561: scope.setCurrentElement(found); On 2016/12/13 05:41:57, hayato wrote: > It does ...
4 years ago (2016-12-13 07:20:37 UTC) #14
kochi
Refactored the class a bit, and updated the description (added at the bottom). PTAL.
4 years ago (2016-12-13 08:15:17 UTC) #19
hayato
LGTM. Thank you for the refactoring. That is exactly what I would like to see. ...
4 years ago (2016-12-13 08:30:23 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2562753003/60001
4 years ago (2016-12-13 08:40:28 UTC) #23
commit-bot: I haz the power
Committed patchset #3 (id:60001)
4 years ago (2016-12-13 09:23:56 UTC) #26
commit-bot: I haz the power
4 years ago (2016-12-13 09:26:41 UTC) #28
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/960b8cda43c4d804f79ecf75b82559751f21819c
Cr-Commit-Position: refs/heads/master@{#438108}

Powered by Google App Engine
This is Rietveld 408576698