Diff
Modified: trunk/LayoutTests/ChangeLog (276263 => 276264)
--- trunk/LayoutTests/ChangeLog 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/ChangeLog 2021-04-19 17:59:26 UTC (rev 276264)
@@ -1,3 +1,16 @@
+2021-04-19 Manuel Rego Casasnovas <[email protected]>
+
+ [selectors] Script focus and :focus-visible
+ https://bugs.webkit.org/show_bug.cgi?id=224598
+
+ Reviewed by Darin Adler.
+
+ 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:
+
2021-04-19 Darin Adler <[email protected]>
Nullptr crash in CSSCalcValue::category() via HTMLConverterCaches::floatPropertyValueForNode
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-04-19 17:59:26 UTC (rev 276264)
@@ -1,3 +1,30 @@
+2021-04-19 Manuel Rego Casasnovas <[email protected]>
+
+ [selectors] Script focus and :focus-visible
+ https://bugs.webkit.org/show_bug.cgi?id=224598
+
+ Reviewed by Darin Adler.
+
+ 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:
+
2021-04-19 Darin Adler <[email protected]>
Nullptr crash in CSSCalcValue::category() via HTMLConverterCaches::floatPropertyValueForNode
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-008-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-008-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-008-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -6,5 +6,5 @@
Tab to me and press ENTER.
I will be focused programmatically.
-FAIL Programmatic focus after keypress should match :focus-visible assert_equals: outlineColor for DIV#el should be green expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)"
+PASS Programmatic focus after keypress should match :focus-visible
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-009-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-009-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-009-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -3,5 +3,5 @@
I will be focused automatically.
-FAIL Autofocus should match :focus-visible assert_equals: outlineColor for BUTTON#button should be green expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)"
+PASS Autofocus should match :focus-visible
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-010-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-010-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-010-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -3,5 +3,5 @@
I will be focused automatically.
-FAIL Programmatic focus on page load should match :focus-visible assert_equals: outlineColor for DIV#el should be green expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)"
+PASS Programmatic focus on page load should match :focus-visible
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-014-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-014-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-014-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -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
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-001-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-001-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-001-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -4,5 +4,5 @@
Focused
PASS ":focus-visible" should be a valid selector
-FAIL Script focus without any previous user interaction matches :focus-visible assert_equals: outlineColor for DIV#target should be green expected "rgb(0, 128, 0)" but got "rgba(46, 52, 54, 0.59)"
+PASS Script focus without any previous user interaction matches :focus-visible
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-002.tentative-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-002.tentative-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-002.tentative-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -5,5 +5,5 @@
Focused
PASS ":focus-visible" should be a valid selector
-FAIL Script focus after mouse click does match :focus-visible assert_equals: outlineColor for DIV#target should be green expected "rgb(0, 128, 0)" but got "rgba(46, 52, 54, 0.59)"
+PASS Script focus after mouse click does match :focus-visible
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-003.tentative-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-003.tentative-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-003.tentative-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -5,5 +5,5 @@
Focused
PASS ":focus-visible" should be a valid selector
-FAIL Script focus after blur after mouse click does match :focus-visible assert_equals: outlineColor for DIV#target should be green expected "rgb(0, 128, 0)" but got "rgba(46, 52, 54, 0.59)"
+PASS Script focus after blur after mouse click does match :focus-visible
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-004-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-004-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-004-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -5,5 +5,5 @@
Focused
PASS ":focus-visible" should be a valid selector
-FAIL Script focus after keyboard event does match :focus-visible assert_equals: outlineColor for DIV#target should be green expected "rgb(0, 128, 0)" but got "rgba(46, 52, 54, 0.59)"
+PASS Script focus after keyboard event does match :focus-visible
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-005-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-005-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-005-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -5,5 +5,5 @@
Focused
PASS ":focus-visible" should be a valid selector
-FAIL Script focus after blur after keyboard event does match :focus-visible assert_equals: outlineColor for DIV#target should be green expected "rgb(0, 128, 0)" but got "rgba(46, 52, 54, 0.59)"
+PASS Script focus after blur after keyboard event does match :focus-visible
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-006.tentative-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-006.tentative-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-006.tentative-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -6,5 +6,5 @@
Focused
PASS ":focus-visible" should be a valid selector
-FAIL Script focus after mouse click on a NOT focusable element does match :focus-visible assert_equals: outlineColor for DIV#target should be green expected "rgb(0, 128, 0)" but got "rgba(46, 52, 54, 0.59)"
+PASS Script focus after mouse click on a NOT focusable element does match :focus-visible
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-007.tentative-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-007.tentative-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-007.tentative-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -6,5 +6,5 @@
Focused
PASS ":focus-visible" should be a valid selector
-FAIL Script focus after blur after mouse click on a NOT focusable element does match :focus-visible assert_equals: outlineColor for DIV#target should be green expected "rgb(0, 128, 0)" but got "rgba(46, 52, 54, 0.59)"
+PASS Script focus after blur after mouse click on a NOT focusable element does match :focus-visible
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-012-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-012-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-012-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -6,5 +6,5 @@
Focused
PASS ":focus-visible" should be a valid selector
-FAIL Script focus after keyboard focus does match :focus-visible assert_equals: outlineColor for DIV#target should be green expected "rgb(0, 128, 0)" but got "rgba(46, 52, 54, 0.59)"
+PASS Script focus after keyboard focus does match :focus-visible
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-013-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-013-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-013-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -6,5 +6,5 @@
Focused
PASS ":focus-visible" should be a valid selector
-FAIL Script focus after blur after keyboard focus does match :focus-visible assert_equals: outlineColor for DIV#target should be green expected "rgb(0, 128, 0)" but got "rgba(46, 52, 54, 0.59)"
+PASS Script focus after blur after keyboard focus does match :focus-visible
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-014-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-014-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-014-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -6,5 +6,5 @@
Focused
PASS ":focus-visible" should be a valid selector
-FAIL Script focus after keyboard input does match :focus-visible assert_equals: outlineColor for DIV#target should be green expected "rgb(0, 128, 0)" but got "rgba(46, 52, 54, 0.59)"
+PASS Script focus after keyboard input does match :focus-visible
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-015-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-015-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-015-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -6,5 +6,5 @@
Focused
PASS ":focus-visible" should be a valid selector
-FAIL Script focus after blur after keyboard input does match :focus-visible assert_equals: outlineColor for DIV#target should be green expected "rgb(0, 128, 0)" but got "rgba(46, 52, 54, 0.59)"
+PASS Script focus after blur after keyboard input does match :focus-visible
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-016.tentative-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-016.tentative-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-016.tentative-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -8,5 +8,5 @@
Focused
PASS ":focus-visible" should be a valid selector
-FAIL Script focus after mouse click on a NOT focusable element after editing an input does match :focus-visible assert_equals: outlineColor for DIV#target should be green expected "rgb(0, 128, 0)" but got "rgba(46, 52, 54, 0.59)"
+PASS Script focus after mouse click on a NOT focusable element after editing an input does match :focus-visible
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-017.tentative-expected.txt (276263 => 276264)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-017.tentative-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-017.tentative-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -8,5 +8,5 @@
Focused
PASS ":focus-visible" should be a valid selector
-FAIL Script focus after blur after mouse click on a NOT focusable element after editing an input does match :focus-visible assert_equals: outlineColor for DIV#target should be green expected "rgb(0, 128, 0)" but got "rgba(46, 52, 54, 0.59)"
+PASS Script focus after blur after mouse click on a NOT focusable element after editing an input does match :focus-visible
Modified: trunk/LayoutTests/platform/ios/TestExpectations (276263 => 276264)
--- trunk/LayoutTests/platform/ios/TestExpectations 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2021-04-19 17:59:26 UTC (rev 276264)
@@ -3276,6 +3276,7 @@
webkit.org/b/207858 fast/canvas/webgl/simulated-vertexAttrib0-invalid-indicies.html [ Skip ]
webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-001.html [ Skip ]
+webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-005.html [ Skip ]
webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-006.html [ Skip ]
webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-007.html [ Skip ]
webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-008.html [ Skip ]
@@ -3284,22 +3285,17 @@
webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-012.html [ Skip ]
webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-013.html [ Skip ]
webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-019.html [ Skip ]
+webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-004.html [ Skip ]
+webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-005.html [ Skip ]
+webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-012.html [ Skip ]
+webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-013.html [ Skip ]
+webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-014.html [ Skip ]
+webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-015.html [ Skip ]
+webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-016.tentative.html [ Skip ]
+webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-017.tentative.html [ Skip ]
+webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-018.html [ Skip ]
+webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-019.html [ Skip ]
webkit.org/b/209734 imported/w3c/web-platform-tests/css/selectors/hover-002.html [ Skip ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-001.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-002.tentative.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-003.tentative.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-004.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-005.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-006.tentative.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-007.tentative.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-012.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-013.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-014.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-015.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-016.tentative.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-017.tentative.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-018.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-019.html [ Failure ]
# Certain versions of iOS use different text security characters.
webkit.org/b/209692 platform/ios/fast/text/text-security-disc-bullet-pua-ios-new.html [ Pass ]
Modified: trunk/LayoutTests/platform/mac/TestExpectations (276263 => 276264)
--- trunk/LayoutTests/platform/mac/TestExpectations 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2021-04-19 17:59:26 UTC (rev 276264)
@@ -2291,16 +2291,5 @@
webkit.org/b/224631 [ BigSur ] imported/w3c/web-platform-tests/css/css-fonts/font-feature-settings-tibetan.html [ Pass ImageOnlyFailure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-001.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-002.tentative.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-003.tentative.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-004.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-005.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-006.tentative.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-007.tentative.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-012.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-013.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-014.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-015.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-016.tentative.html [ Failure ]
-webkit.org/b/224598 imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-017.tentative.html [ Failure ]
+# Buttons are not focusable on Mac so this test doesn't work as expected.
+webkit.org/b/22261 imported/w3c/web-platform-tests/css/selectors/focus-visible-005.html [ Skip ]
Deleted: trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/css/selectors/focus-visible-009-expected.txt (276263 => 276264)
--- trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/css/selectors/focus-visible-009-expected.txt 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/css/selectors/focus-visible-009-expected.txt 2021-04-19 17:59:26 UTC (rev 276264)
@@ -1,7 +0,0 @@
-This test checks that any element focused via an autofocus attribute will have :focus-visible matching enabled.
-If the button that says "I will be focused automatically" has a red background, then the test result is FAILURE. If it has a green outline, then the test result is SUCCESS.
-
-I will be focused automatically.
-
-FAIL Autofocus should match :focus-visible assert_equals: outlineColor for BUTTON#button should be green expected "rgb(0, 128, 0)" but got "rgba(0, 0, 0, 0.847)"
-
Modified: trunk/Source/WebCore/ChangeLog (276263 => 276264)
--- trunk/Source/WebCore/ChangeLog 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/Source/WebCore/ChangeLog 2021-04-19 17:59:26 UTC (rev 276264)
@@ -1,3 +1,33 @@
+2021-04-19 Manuel Rego Casasnovas <[email protected]>
+
+ [selectors] Script focus and :focus-visible
+ https://bugs.webkit.org/show_bug.cgi?id=224598
+
+ Reviewed by Darin Adler.
+
+ 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:
+ https://github.com/web-platform-tests/wpt/issues/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.
+
2021-04-19 Darin Adler <[email protected]>
Nullptr crash in CSSCalcValue::category() via HTMLConverterCaches::floatPropertyValueForNode
Modified: trunk/Source/WebCore/dom/Document.cpp (276263 => 276264)
--- trunk/Source/WebCore/dom/Document.cpp 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/Source/WebCore/dom/Document.cpp 2021-04-19 17:59:26 UTC (rev 276264)
@@ -4357,7 +4357,7 @@
// FIXME: We should avoid synchronously updating the style inside setFocusedElement.
// FIXME: Object elements should avoid loading a frame synchronously in a post style recalc callback.
SubframeLoadingDisabler disabler(is<ContainerNode>(node) ? &downcast<ContainerNode>(node) : nullptr);
- setFocusedElement(nullptr, { { }, { }, FocusRemovalEventsMode::DoNotDispatch, { } });
+ setFocusedElement(nullptr, { { }, { }, FocusRemovalEventsMode::DoNotDispatch, { }, { } });
// Set the focus navigation starting node to the previous focused element so that
// we can fallback to the siblings or parent node for the next search.
// Also we need to call removeFocusNavigationNodeOfSubtree after this function because
@@ -4530,6 +4530,7 @@
m_focusedElement = newFocusedElement;
setFocusNavigationStartingNode(m_focusedElement.get());
m_focusedElement->setFocus(true);
+ m_latestFocusTrigger = options.trigger;
// The setFocus call triggers a blur and a focus event. Event handlers could cause the focused element to be cleared.
if (m_focusedElement != newFocusedElement) {
Modified: trunk/Source/WebCore/dom/Document.h (276263 => 276264)
--- trunk/Source/WebCore/dom/Document.h 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/Source/WebCore/dom/Document.h 2021-04-19 17:59:26 UTC (rev 276264)
@@ -761,6 +761,7 @@
// The element could have already been focused or may not be focusable (e.g. <input disabled>).
WEBCORE_EXPORT bool setFocusedElement(Element*, const FocusOptions& = { });
Element* focusedElement() const { return m_focusedElement.get(); }
+ bool wasLastFocusByClick() const { return m_latestFocusTrigger == FocusTrigger::Click; }
UserActionElementSet& userActionElements() { return m_userActionElements; }
const UserActionElementSet& userActionElements() const { return m_userActionElements; }
@@ -2126,6 +2127,8 @@
bool m_updateTitleTaskScheduled { false };
+ FocusTrigger m_latestFocusTrigger { FocusTrigger::Other };
+
OrientationNotifier m_orientationNotifier;
mutable RefPtr<Logger> m_logger;
RefPtr<StringCallback> m_consoleMessageListener;
Modified: trunk/Source/WebCore/dom/Element.cpp (276263 => 276264)
--- trunk/Source/WebCore/dom/Element.cpp 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/Source/WebCore/dom/Element.cpp 2021-04-19 17:59:26 UTC (rev 276264)
@@ -3078,11 +3078,16 @@
if (!frame.hasHadUserInteraction() && !frame.isMainFrame() && !document->topDocument().securityOrigin().isSameOriginDomain(document->securityOrigin()))
return;
+ if (!document->wasLastFocusByClick())
+ newTarget->setHasFocusVisible(true);
+
// Focus and change event handlers can cause us to lose our last ref.
// If a focus event handler changes the focus to a different node it
// does not make sense to continue and update appearence.
- if (!page->focusController().setFocusedElement(newTarget.get(), *document->frame(), options))
+ if (!page->focusController().setFocusedElement(newTarget.get(), *document->frame(), options)) {
+ newTarget->setHasFocusVisible(false);
return;
+ }
}
newTarget->findTargetAndUpdateFocusAppearance(options.selectionRestorationMode, options.preventScroll ? SelectionRevealMode::DoNotReveal : SelectionRevealMode::Reveal);
Modified: trunk/Source/WebCore/dom/FocusOptions.h (276263 => 276264)
--- trunk/Source/WebCore/dom/FocusOptions.h 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/Source/WebCore/dom/FocusOptions.h 2021-04-19 17:59:26 UTC (rev 276264)
@@ -30,12 +30,15 @@
namespace WebCore {
-enum class FocusRemovalEventsMode { Dispatch, DoNotDispatch };
+enum class FocusRemovalEventsMode : bool { Dispatch, DoNotDispatch };
+enum class FocusTrigger : bool { Other, Click };
+
struct FocusOptions {
SelectionRestorationMode selectionRestorationMode { SelectionRestorationMode::RestoreOrSelectAll };
FocusDirection direction { FocusDirection::None };
FocusRemovalEventsMode removalEventsMode { FocusRemovalEventsMode::Dispatch };
+ FocusTrigger trigger { FocusTrigger::Other };
bool preventScroll { false };
};
Modified: trunk/Source/WebCore/page/EventHandler.cpp (276263 => 276264)
--- trunk/Source/WebCore/page/EventHandler.cpp 2021-04-19 17:53:04 UTC (rev 276263)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2021-04-19 17:59:26 UTC (rev 276264)
@@ -48,6 +48,7 @@
#include "FloatPoint.h"
#include "FloatRect.h"
#include "FocusController.h"
+#include "FocusOptions.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameSelection.h"
@@ -2722,7 +2723,7 @@
// If focus shift is blocked, we eat the event.
auto* page = m_frame.page();
- if (page && !page->focusController().setFocusedElement(element.get(), m_frame))
+ if (page && !page->focusController().setFocusedElement(element.get(), m_frame, { { }, { }, { }, FocusTrigger::Click, { } }))
return false;
if (element && m_mouseDownDelegatedFocus)