From 4771d7ddf0a43835f6466856afcf3596e815a340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 13 Nov 2020 12:53:45 +0000 Subject: [PATCH] style: Make focus-visible match the spec more closely. The spec text has been improved a while ago, so I think we should do this. This keeps the current moz-focusring behavior when the pref is disabled, but when enabled it becomes effectively an alias of focus-visible. Differential Revision: https://phabricator.services.mozilla.com/D96697 --- components/style/element_state.rs | 6 ++---- components/style/gecko/non_ts_pseudo_class_list.rs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/components/style/element_state.rs b/components/style/element_state.rs index ebf6aa42a69..2e3ccb3b31b 100644 --- a/components/style/element_state.rs +++ b/components/style/element_state.rs @@ -103,6 +103,8 @@ bitflags! { /// Non-standard & undocumented. const IN_INCREMENT_SCRIPT_LEVEL_STATE = 1 << 38; /// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-focusring + /// + /// But also https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo const IN_FOCUSRING_STATE = 1 << 39; /// Non-standard & undocumented. const IN_HANDLER_CLICK_TO_PLAY_STATE = 1 << 40; @@ -133,10 +135,6 @@ bitflags! { const IN_AUTOFILL_STATE = 1 << 50; /// Non-standard & undocumented. const IN_AUTOFILL_PREVIEW_STATE = 1 << 51; - /// :focus-visible - /// - /// https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo - const IN_FOCUS_VISIBLE_STATE = 1 << 52; /// State that dialog element is modal, for centered alignment /// /// https://html.spec.whatwg.org/multipage/#centered-alignment diff --git a/components/style/gecko/non_ts_pseudo_class_list.rs b/components/style/gecko/non_ts_pseudo_class_list.rs index 77ff53ed3a3..0b34cd8d966 100644 --- a/components/style/gecko/non_ts_pseudo_class_list.rs +++ b/components/style/gecko/non_ts_pseudo_class_list.rs @@ -43,7 +43,7 @@ macro_rules! apply_non_ts_list { ("enabled", Enabled, IN_ENABLED_STATE, _), ("focus", Focus, IN_FOCUS_STATE, _), ("focus-within", FocusWithin, IN_FOCUS_WITHIN_STATE, _), - ("focus-visible", FocusVisible, IN_FOCUS_VISIBLE_STATE, _), + ("focus-visible", FocusVisible, IN_FOCUSRING_STATE, _), ("hover", Hover, IN_HOVER_STATE, _), ("-moz-drag-over", MozDragOver, IN_DRAGOVER_STATE, _), ("target", Target, IN_TARGET_STATE, _),