mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Implement :defined pseudo-class for custom elements.
Bug: 1331334 Reviewed-by: emilio
This commit is contained in:
parent
06fa3406de
commit
b68e4c2352
4 changed files with 7 additions and 1 deletions
|
@ -71,7 +71,8 @@ bitflags! {
|
|||
const IN_OPTIONAL_STATE = 1 << 22;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-read-write>
|
||||
const IN_READ_WRITE_STATE = 1 << 22;
|
||||
/// There is a free bit at 23.
|
||||
/// <https://html.spec.whatwg.org/multipage/semantics-other.html#selector-defined>
|
||||
const IN_DEFINED_STATE = 1 << 23;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-visited>
|
||||
const IN_VISITED_STATE = 1 << 24;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-link>
|
||||
|
|
|
@ -47,6 +47,7 @@ macro_rules! apply_non_ts_list {
|
|||
("visited", Visited, visited, IN_VISITED_STATE, _),
|
||||
("active", Active, active, IN_ACTIVE_STATE, _),
|
||||
("checked", Checked, checked, IN_CHECKED_STATE, _),
|
||||
("defined", Defined, defined, IN_DEFINED_STATE, _),
|
||||
("disabled", Disabled, disabled, IN_DISABLED_STATE, _),
|
||||
("enabled", Enabled, enabled, IN_ENABLED_STATE, _),
|
||||
("focus", Focus, focus, IN_FOCUS_STATE, _),
|
||||
|
|
|
@ -187,6 +187,9 @@ impl NonTSPseudoClass {
|
|||
NonTSPseudoClass::Fullscreen => unsafe {
|
||||
mozilla::StaticPrefs_sVarCache_full_screen_api_unprefix_enabled
|
||||
},
|
||||
NonTSPseudoClass::Defined => unsafe {
|
||||
structs::nsContentUtils_sIsCustomElementsEnabled
|
||||
},
|
||||
// Otherwise, a pseudo-class is enabled in content when it
|
||||
// doesn't have any enabled flag.
|
||||
_ => !self.has_any_flag(
|
||||
|
|
|
@ -2124,6 +2124,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
{
|
||||
use selectors::matching::*;
|
||||
match *pseudo_class {
|
||||
NonTSPseudoClass::Defined |
|
||||
NonTSPseudoClass::Focus |
|
||||
NonTSPseudoClass::Enabled |
|
||||
NonTSPseudoClass::Disabled |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue