aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/element.rs
diff options
context:
space:
mode:
authorBobby Holley <bobbyholley@gmail.com>2015-10-22 12:56:18 -0700
committerBobby Holley <bobbyholley@gmail.com>2015-10-30 21:01:50 -0700
commitf7f27a81463b062f0aef8055315ba6ad167ea592 (patch)
tree29f81241258d88577de079d36aff819a96ee14e0 /components/script/dom/element.rs
parent7512aa69c034767cfb41206180bec50b020b2b0f (diff)
downloadservo-f7f27a81463b062f0aef8055315ba6ad167ea592.tar.gz
servo-f7f27a81463b062f0aef8055315ba6ad167ea592.zip
Hoist checked and indeterminate state into EventState.
This is necessary for those selectors to take advantage of restyle hints.
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r--components/script/dom/element.rs25
1 files changed, 19 insertions, 6 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index d2636820362..50f571452b6 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -85,19 +85,28 @@ use util::str::{DOMString, LengthOrPercentageOrAuto};
bitflags! {
#[doc = "Element Event States."]
#[derive(JSTraceable, HeapSizeOf)]
- flags EventState: u8 {
+ flags EventState: u16 {
#[doc = "The mouse is down on this element. \
(https://html.spec.whatwg.org/multipage/#selector-active). \
FIXME(#7333): set/unset this when appropriate"]
const IN_ACTIVE_STATE = 0x01,
- #[doc = "This element has focus."]
+ #[doc = "This element has focus.
+ https://html.spec.whatwg.org/multipage/scripting.html#selector-focus"]
const IN_FOCUS_STATE = 0x02,
- #[doc = "The mouse is hovering over this element."]
+ #[doc = "The mouse is hovering over this element. \
+ https://html.spec.whatwg.org/multipage/scripting.html#selector-hover"]
const IN_HOVER_STATE = 0x04,
- #[doc = "Content is enabled (and can be disabled)."]
+ #[doc = "Content is enabled (and can be disabled). \
+ http://www.whatwg.org/html/#selector-enabled"]
const IN_ENABLED_STATE = 0x08,
- #[doc = "Content is disabled."]
+ #[doc = "Content is disabled. \
+ http://www.whatwg.org/html/#selector-disabled"]
const IN_DISABLED_STATE = 0x10,
+ #[doc = "Content is checked. \
+ https://html.spec.whatwg.org/multipage/scripting.html#selector-checked"]
+ const IN_CHECKED_STATE = 0x20,
+ #[doc = "https://html.spec.whatwg.org/multipage/scripting.html#selector-indeterminate"]
+ const IN_INDETERMINATE_STATE = 0x40,
}
}
@@ -1834,7 +1843,11 @@ impl Element {
self.set_click_in_progress(false);
}
- fn set_state(&self, which: EventState, value: bool) {
+ pub fn get_state(&self) -> EventState {
+ self.event_state.get()
+ }
+
+ pub fn set_state(&self, which: EventState, value: bool) {
let mut state = self.event_state.get();
if state.contains(which) == value {
return