Title: [286775] trunk
- Revision
- 286775
- Author
- [email protected]
- Date
- 2021-12-09 05:14:30 -0800 (Thu, 09 Dec 2021)
Log Message
[selectors] Use :focus-visible in the user agent style sheet
https://bugs.webkit.org/show_bug.cgi?id=221925
<rdar://problem/74613552>
Reviewed by Manuel Rego Casasnovas.
LayoutTests/imported/w3c:
* web-platform-tests/css/selectors/focus-visible-018-2-expected.txt:
* web-platform-tests/css/selectors/focus-visible-018-expected.txt:
Source/WebCore:
Replace :-internal-direct-focus with :focus-visible for the default focus outline styling in the user agent style sheet.
When enabled, this will change focus drawing behavior in two cases:
- <div tabindex> (or any element with 'tabindex' attribute that is not focusable otherwise) will not show focus
indicator when focused via click/tap/script.
- <details> will not show focus indicator when focused via click/tap/script.
Both still show focus indicator when focused via keyboard (tab) navigation.
With the feature disabled UA sheet :focus-visible behaves like :-internal-direct-focus.
This patch does not enable the feature yet.
* css/SelectorCheckerTestFunctions.h:
(WebCore::matchesFocusVisiblePseudoClass):
Check the feature flag. If it is not enabled :focus-visible matches like :-internal-direct-focus.
* css/html.css:
(:focus-visible):
(:-internal-direct-focus): Deleted.
Replace :-internal-direct-focus.
* css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::CSSParserContext):
Always allow :focus-visible when parsing UA sheet.
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (286774 => 286775)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-12-09 11:42:39 UTC (rev 286774)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-12-09 13:14:30 UTC (rev 286775)
@@ -1,3 +1,14 @@
+2021-12-09 Antti Koivisto <[email protected]>
+
+ [selectors] Use :focus-visible in the user agent style sheet
+ https://bugs.webkit.org/show_bug.cgi?id=221925
+ <rdar://problem/74613552>
+
+ Reviewed by Manuel Rego Casasnovas.
+
+ * web-platform-tests/css/selectors/focus-visible-018-2-expected.txt:
+ * web-platform-tests/css/selectors/focus-visible-018-expected.txt:
+
2021-12-08 Patrick Griffis <[email protected]>
CSP: Skip whitespace at beginning of policy header
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-018-2-expected.txt (286774 => 286775)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-018-2-expected.txt 2021-12-09 11:42:39 UTC (rev 286774)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-018-2-expected.txt 2021-12-09 13:14:30 UTC (rev 286775)
@@ -33,41 +33,41 @@
u
PASS ":focus-visible" should be a valid selector
-FAIL Mouse focus does not show a focus ring by default in element ABBR assert_equals: outline-style for ABBR should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element ADDRESS assert_equals: outline-style for ADDRESS should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element BDI assert_equals: outline-style for BDI should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element BLOCKQUOTE assert_equals: outline-style for BLOCKQUOTE should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element CODE assert_equals: outline-style for CODE should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element DD assert_equals: outline-style for DD should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element SUMMARY assert_equals: outline-style for SUMMARY should be none expected "none" but got "auto"
+PASS Mouse focus does not show a focus ring by default in element ABBR
+PASS Mouse focus does not show a focus ring by default in element ADDRESS
+PASS Mouse focus does not show a focus ring by default in element BDI
+PASS Mouse focus does not show a focus ring by default in element BLOCKQUOTE
+PASS Mouse focus does not show a focus ring by default in element CODE
+PASS Mouse focus does not show a focus ring by default in element DD
+PASS Mouse focus does not show a focus ring by default in element SUMMARY
PASS Mouse focus does not show a focus ring by default in element DETAILS
-FAIL Mouse focus does not show a focus ring by default in element DIV assert_equals: outline-style for DIV should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element DL assert_equals: outline-style for DL should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element DT assert_equals: outline-style for DT should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element EM assert_equals: outline-style for EM should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element LEGEND assert_equals: outline-style for LEGEND should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element FIGCAPTION assert_equals: outline-style for FIGCAPTION should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element FIGURE assert_equals: outline-style for FIGURE should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element FORM assert_equals: outline-style for FORM should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element HR assert_equals: outline-style for HR should be none expected "none" but got "auto"
+PASS Mouse focus does not show a focus ring by default in element DIV
+PASS Mouse focus does not show a focus ring by default in element DL
+PASS Mouse focus does not show a focus ring by default in element DT
+PASS Mouse focus does not show a focus ring by default in element EM
+PASS Mouse focus does not show a focus ring by default in element LEGEND
+PASS Mouse focus does not show a focus ring by default in element FIGCAPTION
+PASS Mouse focus does not show a focus ring by default in element FIGURE
+PASS Mouse focus does not show a focus ring by default in element FORM
+PASS Mouse focus does not show a focus ring by default in element HR
PASS Mouse focus does not show a focus ring by default in element IMG
-FAIL Mouse focus does not show a focus ring by default in element LABEL assert_equals: outline-style for LABEL should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element LI assert_equals: outline-style for LI should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element MARK assert_equals: outline-style for MARK should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element METER assert_equals: outline-style for METER should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element OL assert_equals: outline-style for OL should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element PRE assert_equals: outline-style for PRE should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element PROGRESS assert_equals: outline-style for PROGRESS should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element P assert_equals: outline-style for P should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element SMALL assert_equals: outline-style for SMALL should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element S assert_equals: outline-style for S should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element STRONG assert_equals: outline-style for STRONG should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element SUB assert_equals: outline-style for SUB should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element SUP assert_equals: outline-style for SUP should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element CAPTION assert_equals: outline-style for CAPTION should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element TABLE assert_equals: outline-style for TABLE should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element TD assert_equals: outline-style for TD should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element TIME assert_equals: outline-style for TIME should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element UL assert_equals: outline-style for UL should be none expected "none" but got "auto"
-FAIL Mouse focus does not show a focus ring by default in element U assert_equals: outline-style for U should be none expected "none" but got "auto"
+PASS Mouse focus does not show a focus ring by default in element LABEL
+PASS Mouse focus does not show a focus ring by default in element LI
+PASS Mouse focus does not show a focus ring by default in element MARK
+PASS Mouse focus does not show a focus ring by default in element METER
+PASS Mouse focus does not show a focus ring by default in element OL
+PASS Mouse focus does not show a focus ring by default in element PRE
+PASS Mouse focus does not show a focus ring by default in element PROGRESS
+PASS Mouse focus does not show a focus ring by default in element P
+PASS Mouse focus does not show a focus ring by default in element SMALL
+PASS Mouse focus does not show a focus ring by default in element S
+PASS Mouse focus does not show a focus ring by default in element STRONG
+PASS Mouse focus does not show a focus ring by default in element SUB
+PASS Mouse focus does not show a focus ring by default in element SUP
+PASS Mouse focus does not show a focus ring by default in element CAPTION
+PASS Mouse focus does not show a focus ring by default in element TABLE
+PASS Mouse focus does not show a focus ring by default in element TD
+PASS Mouse focus does not show a focus ring by default in element TIME
+PASS Mouse focus does not show a focus ring by default in element UL
+PASS Mouse focus does not show a focus ring by default in element U
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-018-expected.txt (286774 => 286775)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-018-expected.txt 2021-12-09 11:42:39 UTC (rev 286774)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-018-expected.txt 2021-12-09 13:14:30 UTC (rev 286775)
@@ -5,5 +5,5 @@
Click me.
PASS ":focus-visible" should be a valid selector
-FAIL Mouse focus does not show a focus ring by default assert_equals: outline-style for DIV#target should be none expected "none" but got "auto"
+PASS Mouse focus does not show a focus ring by default
Modified: trunk/Source/WebCore/ChangeLog (286774 => 286775)
--- trunk/Source/WebCore/ChangeLog 2021-12-09 11:42:39 UTC (rev 286774)
+++ trunk/Source/WebCore/ChangeLog 2021-12-09 13:14:30 UTC (rev 286775)
@@ -1,3 +1,41 @@
+2021-12-09 Antti Koivisto <[email protected]>
+
+ [selectors] Use :focus-visible in the user agent style sheet
+ https://bugs.webkit.org/show_bug.cgi?id=221925
+ <rdar://problem/74613552>
+
+ Reviewed by Manuel Rego Casasnovas.
+
+ Replace :-internal-direct-focus with :focus-visible for the default focus outline styling in the user agent style sheet.
+
+ When enabled, this will change focus drawing behavior in two cases:
+
+ - <div tabindex> (or any element with 'tabindex' attribute that is not focusable otherwise) will not show focus
+ indicator when focused via click/tap/script.
+ - <details> will not show focus indicator when focused via click/tap/script.
+
+ Both still show focus indicator when focused via keyboard (tab) navigation.
+
+ With the feature disabled UA sheet :focus-visible behaves like :-internal-direct-focus.
+
+ This patch does not enable the feature yet.
+
+ * css/SelectorCheckerTestFunctions.h:
+ (WebCore::matchesFocusVisiblePseudoClass):
+
+ Check the feature flag. If it is not enabled :focus-visible matches like :-internal-direct-focus.
+
+ * css/html.css:
+ (:focus-visible):
+ (:-internal-direct-focus): Deleted.
+
+ Replace :-internal-direct-focus.
+
+ * css/parser/CSSParserContext.cpp:
+ (WebCore::CSSParserContext::CSSParserContext):
+
+ Always allow :focus-visible when parsing UA sheet.
+
2021-12-09 Myles C. Maxfield <[email protected]> and Don Olmstead <[email protected]>
Move TextCodec files from WebCore/platform/text to WebCore/PAL/text
Modified: trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h (286774 => 286775)
--- trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h 2021-12-09 11:42:39 UTC (rev 286774)
+++ trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h 2021-12-09 13:14:30 UTC (rev 286775)
@@ -39,6 +39,7 @@
#include "InspectorInstrumentation.h"
#include "Page.h"
#include "SelectorChecker.h"
+#include "Settings.h"
#include "ShadowRoot.h"
#include <wtf/Compiler.h>
@@ -515,6 +516,9 @@
ALWAYS_INLINE bool matchesFocusVisiblePseudoClass(const Element& element)
{
+ if (!element.document().settings().focusVisibleEnabled())
+ return matchesDirectFocusPseudoClass(element);
+
if (InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoClassFocusVisible))
return true;
Modified: trunk/Source/WebCore/css/html.css (286774 => 286775)
--- trunk/Source/WebCore/css/html.css 2021-12-09 11:42:39 UTC (rev 286774)
+++ trunk/Source/WebCore/css/html.css 2021-12-09 13:14:30 UTC (rev 286775)
@@ -1261,7 +1261,7 @@
/* states */
-:-internal-direct-focus {
+:focus-visible {
#if defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY
outline: auto 3px -webkit-focus-ring-color;
#else
Modified: trunk/Source/WebCore/css/parser/CSSParserContext.cpp (286774 => 286775)
--- trunk/Source/WebCore/css/parser/CSSParserContext.cpp 2021-12-09 11:42:39 UTC (rev 286774)
+++ trunk/Source/WebCore/css/parser/CSSParserContext.cpp 2021-12-09 13:14:30 UTC (rev 286775)
@@ -49,6 +49,7 @@
// FIXME: We should turn all of the features on from their WebCore Settings defaults.
if (mode == UASheetMode) {
individualTransformPropertiesEnabled = true;
+ focusVisibleEnabled = true;
#if ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
transformStyleOptimized3DEnabled = true;
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes