diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2015-08-17 17:52:21 -0700 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2015-08-17 17:52:21 -0700 |
commit | 6567c269cfcf0be14c3aa7e6694f4080cdfffc99 (patch) | |
tree | d191a8a65391e43f29966345b94bcd5e90cdfc94 /components/script/dom/node.rs | |
parent | f4b526cfb4ea1ef263ff029650c74ff50a74d5db (diff) | |
download | servo-6567c269cfcf0be14c3aa7e6694f4080cdfffc99.tar.gz servo-6567c269cfcf0be14c3aa7e6694f4080cdfffc99.zip |
script: Update `rust-selectors` to get `:active` support.
I couldn't find the place in the spec where the precise behavior of
`:active` is described, so I don't set it. However, all the machinery to
keep track of its status is in place.
Improves YouTube.
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r-- | components/script/dom/node.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 8b4046cc80b..fc332186913 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -170,6 +170,8 @@ 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 active."] + const IN_ACTIVE_STATE = 0x800, } } @@ -458,6 +460,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 +640,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 +1129,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 +1244,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) |