diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/element.rs | 4 | ||||
-rw-r--r-- | components/script/dom/node.rs | 24 |
2 files changed, 28 insertions, 0 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 2935e581a88..cb0eda2a10f 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -1754,6 +1754,10 @@ impl<'a> ::selectors::Element for Root<Element> { let node = NodeCast::from_ref(&**self); node.get_hover_state() } + fn get_active_state(&self) -> bool { + let node = NodeCast::from_ref(&**self); + node.get_active_state() + } fn get_focus_state(&self) -> bool { // TODO: Also check whether the top-level browsing context has the system focus, // and whether this element is a browsing context container. diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 5b482c817b9..12c671b70a8 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -170,6 +170,10 @@ bitflags! { #[doc = "Specifies whether this node is focusable and whether it is supposed \ to be reachable with using sequential focus navigation."] const SEQUENTIALLY_FOCUSABLE = 0x400, + #[doc = "Specifies whether this node is [being activated]\ + (https://html.spec.whatwg.org/multipage/#selector-active). \ + FIXME(#7333): set/unset this when appropriate"] + const IN_ACTIVE_STATE = 0x800, } } @@ -458,6 +462,9 @@ pub trait NodeHelpers { fn get_focus_state(self) -> bool; fn set_focus_state(self, state: bool); + fn get_active_state(self) -> bool; + fn set_active_state(self, state: bool); + fn get_disabled_state(self) -> bool; fn set_disabled_state(self, state: bool); @@ -635,6 +642,15 @@ impl<'a> NodeHelpers for &'a Node { self.dirty(NodeDamage::NodeStyleDamaged); } + fn get_active_state(self) -> bool { + self.get_flag(IN_ACTIVE_STATE) + } + + fn set_active_state(self, state: bool) { + self.set_flag(IN_ACTIVE_STATE, state); + self.dirty(NodeDamage::NodeStyleDamaged); + } + fn get_disabled_state(self) -> bool { self.get_flag(IN_DISABLED_STATE) } @@ -1115,6 +1131,7 @@ pub trait LayoutNodeHelpers { fn get_hover_state_for_layout(&self) -> bool; fn get_focus_state_for_layout(&self) -> bool; + fn get_active_state_for_layout(&self) -> bool; fn get_disabled_state_for_layout(&self) -> bool; fn get_enabled_state_for_layout(&self) -> bool; } @@ -1229,6 +1246,13 @@ impl LayoutNodeHelpers for LayoutJS<Node> { } #[inline] #[allow(unsafe_code)] + fn get_active_state_for_layout(&self) -> bool { + unsafe { + self.get_flag(IN_ACTIVE_STATE) + } + } + #[inline] + #[allow(unsafe_code)] fn get_disabled_state_for_layout(&self) -> bool { unsafe { self.get_flag(IN_DISABLED_STATE) |