diff options
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r-- | components/script/dom/element.rs | 25 |
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 |