Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[selectors] Script focus and :focus-visible
https://bugs.webkit.org/show_bug.cgi?id=224598 Reviewed by Darin Adler. LayoutTests/imported/w3c: Update expectations as the tests pass now. * web-platform-tests/css/selectors/focus-visible-008-expected.txt: * web-platform-tests/css/selectors/focus-visible-009-expected.txt: * web-platform-tests/css/selectors/focus-visible-010-expected.txt: * web-platform-tests/css/selectors/focus-visible-014-expected.txt: * web-platform-tests/css/selectors/focus-visible-script-focus-001-expected.txt: * web-platform-tests/css/selectors/focus-visible-script-focus-002.tentative-expected.txt: * web-platform-tests/css/selectors/focus-visible-script-focus-003.tentative-expected.txt: * web-platform-tests/css/selectors/focus-visible-script-focus-004-expected.txt: * web-platform-tests/css/selectors/focus-visible-script-focus-005-expected.txt: * web-platform-tests/css/selectors/focus-visible-script-focus-006.tentative-expected.txt: * web-platform-tests/css/selectors/focus-visible-script-focus-007.tentative-expected.txt: * web-platform-tests/css/selectors/focus-visible-script-focus-012-expected.txt: * web-platform-tests/css/selectors/focus-visible-script-focus-013-expected.txt: * web-platform-tests/css/selectors/focus-visible-script-focus-014-expected.txt: * web-platform-tests/css/selectors/focus-visible-script-focus-015-expected.txt: * web-platform-tests/css/selectors/focus-visible-script-focus-016.tentative-expected.txt: * web-platform-tests/css/selectors/focus-visible-script-focus-017.tentative-expected.txt: Source/WebCore: Implement :focus-visible behavior when a script moves focus. An element will match :focus-visible when a script move focus if the last focused element was not focused via mouse click. This patch makes WebKit behaves like Chromium and Firefox and pass all the related tests. There's an ongoing discussion about 6 tests that are marked as ".tentative" in the following issue: web-platform-tests/wpt#28505 Test: web-platform-tests/css/selectors/focus-visible-script-focus-* * dom/Document.cpp: (WebCore::Document::adjustFocusedNodeOnNodeRemoval): Just update FocusOptions initializer. (WebCore::Document::setFocusedElement): Store if the last element has been focused by mouse click or not. * dom/Document.h: New member m_latestFocusTrigger. (WebCore::Document::wasLastFocusByClick const): Method to check status of m_latestFocusTrigger. * dom/Element.cpp: (WebCore::Element::focus): When there's a script focus, this checks if the last element was focused by mouse click in order to make it match :focus-visible. * dom/FocusOptions.h: Add FocusTrigger enum to know if an element has been focused via mouse click or not. This refers to the "focus trigger" concept on the HTML spec (see https://html.spec.whatwg.org/multipage/interaction.html). * page/EventHandler.cpp: (WebCore::EventHandler::dispatchMouseEvent): Pass FocusTrigger:Click in setFocusedElement() call. LayoutTests: Update expectations for tests, most of them are passing on Mac. On iOS a bunch timeout so they're skipped, as other :focus-visible tests. * platform/ios/TestExpectations: * platform/mac/imported/w3c/web-platform-tests/css/selectors/focus-visible-009-expected.txt: Removed as test passes now. * platform/mac/TestExpectations: Canonical link: https://commits.webkit.org/236746@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276264 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
28 changed files
with
117 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-014-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
Target | ||
|
||
FAIL :focus-visible matches after script focus move assert_equals: backgroundColor for DIV#target should be lime expected "rgb(0, 255, 0)" but got "rgb(255, 0, 0)" | ||
PASS :focus-visible matches after script focus move | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
...platform/mac/imported/w3c/web-platform-tests/css/selectors/focus-visible-009-expected.txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.