mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
style: Prototype :focus-visible behind a flag.
The heuristic is that we show focus outlines for unknown or key focus, and not for mouse / touch. This is probably not the final heuristic we take, but this allows people to play with it and file bugs. Once this is mature enough we should remove :-moz-focusring in favor of :focus-visible. Differential Revision: https://phabricator.services.mozilla.com/D63861
This commit is contained in:
parent
7af9a087aa
commit
d8cb4c4647
4 changed files with 9 additions and 0 deletions
|
@ -137,6 +137,10 @@ bitflags! {
|
||||||
const IN_AUTOFILL_STATE = 1 << 50;
|
const IN_AUTOFILL_STATE = 1 << 50;
|
||||||
/// Non-standard & undocumented.
|
/// Non-standard & undocumented.
|
||||||
const IN_AUTOFILL_PREVIEW_STATE = 1 << 51;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ macro_rules! apply_non_ts_list {
|
||||||
("enabled", Enabled, enabled, IN_ENABLED_STATE, _),
|
("enabled", Enabled, enabled, IN_ENABLED_STATE, _),
|
||||||
("focus", Focus, focus, IN_FOCUS_STATE, _),
|
("focus", Focus, focus, IN_FOCUS_STATE, _),
|
||||||
("focus-within", FocusWithin, focusWithin, IN_FOCUS_WITHIN_STATE, _),
|
("focus-within", FocusWithin, focusWithin, IN_FOCUS_WITHIN_STATE, _),
|
||||||
|
("focus-visible", FocusVisible, focusVisible, IN_FOCUS_VISIBLE_STATE, _),
|
||||||
("hover", Hover, hover, IN_HOVER_STATE, _),
|
("hover", Hover, hover, IN_HOVER_STATE, _),
|
||||||
("-moz-drag-over", MozDragOver, mozDragOver, IN_DRAGOVER_STATE, _),
|
("-moz-drag-over", MozDragOver, mozDragOver, IN_DRAGOVER_STATE, _),
|
||||||
("target", Target, target, IN_TARGET_STATE, _),
|
("target", Target, target, IN_TARGET_STATE, _),
|
||||||
|
|
|
@ -172,6 +172,9 @@ impl NonTSPseudoClass {
|
||||||
/// Returns whether the pseudo-class is enabled in content sheets.
|
/// Returns whether the pseudo-class is enabled in content sheets.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn is_enabled_in_content(&self) -> bool {
|
fn is_enabled_in_content(&self) -> bool {
|
||||||
|
if matches!(*self, NonTSPseudoClass::FocusVisible) {
|
||||||
|
return static_prefs::pref!("layout.css.focus-visible.enabled")
|
||||||
|
}
|
||||||
!self.has_any_flag(NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME)
|
!self.has_any_flag(NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2064,6 +2064,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
NonTSPseudoClass::MozReadOnly |
|
NonTSPseudoClass::MozReadOnly |
|
||||||
NonTSPseudoClass::MozReadWrite |
|
NonTSPseudoClass::MozReadWrite |
|
||||||
NonTSPseudoClass::FocusWithin |
|
NonTSPseudoClass::FocusWithin |
|
||||||
|
NonTSPseudoClass::FocusVisible |
|
||||||
NonTSPseudoClass::MozDragOver |
|
NonTSPseudoClass::MozDragOver |
|
||||||
NonTSPseudoClass::MozDevtoolsHighlighted |
|
NonTSPseudoClass::MozDevtoolsHighlighted |
|
||||||
NonTSPseudoClass::MozStyleeditorTransitioning |
|
NonTSPseudoClass::MozStyleeditorTransitioning |
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue