diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/element.rs | 15 | ||||
-rw-r--r-- | components/script/dom/node.rs | 10 |
2 files changed, 14 insertions, 11 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 83dd5593d04..cc5245d7537 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -32,7 +32,7 @@ use dom::htmlcollection::HTMLCollection; use dom::htmlinputelement::{HTMLInputElement, RawLayoutHTMLInputElementHelpers}; use dom::htmlserializer::serialize; use dom::htmltablecellelement::{HTMLTableCellElement, HTMLTableCellElementHelpers}; -use dom::node::{ElementNodeTypeId, Node, NodeHelpers, NodeIterator, document_from_node}; +use dom::node::{ElementNodeTypeId, Node, NodeHelpers, NodeIterator, document_from_node, CLICK_IN_PROGRESS}; use dom::node::{window_from_node, LayoutNodeHelpers}; use dom::nodelist::NodeList; use dom::virtualmethods::{VirtualMethods, vtable_for}; @@ -44,7 +44,7 @@ use servo_util::namespace; use servo_util::str::{DOMString, LengthOrPercentageOrAuto}; use std::ascii::AsciiExt; -use std::cell::{Cell, Ref, RefMut}; +use std::cell::{Ref, RefMut}; use std::default::Default; use std::mem; use string_cache::{Atom, Namespace, QualName}; @@ -60,10 +60,6 @@ pub struct Element { style_attribute: DOMRefCell<Option<style::PropertyDeclarationBlock>>, attr_list: MutNullableJS<NamedNodeMap>, class_list: MutNullableJS<DOMTokenList>, - // TODO: find a better place to keep this (#4105) - // https://critic.hoppipolla.co.uk/showcomment?chain=8873 - // Perhaps using a Set in Document? - click_in_progress: Cell<bool>, } impl ElementDerived for EventTarget { @@ -182,7 +178,6 @@ impl Element { attr_list: Default::default(), class_list: Default::default(), style_attribute: DOMRefCell::new(None), - click_in_progress: Cell::new(false), } } @@ -1215,11 +1210,13 @@ impl<'a> ActivationElementHelpers<'a> for JSRef<'a, Element> { } fn click_in_progress(self) -> bool { - self.click_in_progress.get() + let node: JSRef<Node> = NodeCast::from_ref(self); + node.get_flag(CLICK_IN_PROGRESS) } fn set_click_in_progress(self, click: bool) { - self.click_in_progress.set(click) + let node: JSRef<Node> = NodeCast::from_ref(self); + node.set_flag(CLICK_IN_PROGRESS, click) } // https://html.spec.whatwg.org/multipage/interaction.html#nearest-activatable-element diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 55b785a04db..ef655cc1bc3 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -124,7 +124,7 @@ impl NodeDerived for EventTarget { bitflags! { #[doc = "Flags for node items."] #[jstraceable] - flags NodeFlags: u8 { + flags NodeFlags: u16 { #[doc = "Specifies whether this node is in a document."] const IS_IN_DOC = 0x01, #[doc = "Specifies whether this node is in hover state."] @@ -143,6 +143,12 @@ bitflags! { #[doc = "Specifies whether this node has descendants (inclusive of itself) which \ have changed since the last reflow."] const HAS_DIRTY_DESCENDANTS = 0x80, + // TODO: find a better place to keep this (#4105) + // https://critic.hoppipolla.co.uk/showcomment?chain=8873 + // Perhaps using a Set in Document? + #[doc = "Specifies whether or not there is an authentic click in progress on \ + this element."] + const CLICK_IN_PROGRESS = 0x100, } } @@ -744,7 +750,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> { } /// Get an iterator over all nodes which match a set of selectors - /// Be careful not to do anything which may manipulate the DOM tree whilst iterating, otherwise + /// Be careful not to do anything which may manipulate the DOM tree whilst iterating, otherwise /// the iterator may be invalidated unsafe fn query_selector_iter(self, selectors: DOMString) -> Fallible<QuerySelectorIterator<'a>> { // Step 1. |