aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2014-11-26 19:50:35 +0530
committerManish Goregaokar <manishsmail@gmail.com>2014-12-05 18:34:53 -0800
commite7ac792ed65bff7685a6700f1a63b893cdd57a6c (patch)
tree130a5a824b7398ec23922dfd981aca381f958bc4
parentb20d7d89c10d0a5e55edc3989c2b0a855146dcb2 (diff)
downloadservo-e7ac792ed65bff7685a6700f1a63b893cdd57a6c.tar.gz
servo-e7ac792ed65bff7685a6700f1a63b893cdd57a6c.zip
Switch to NodeFlags (the footprint has not changed)
-rw-r--r--components/script/dom/element.rs15
-rw-r--r--components/script/dom/node.rs10
-rw-r--r--components/script/script_task.rs2
3 files changed, 15 insertions, 12 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.
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index 31fa79452df..b826ac98047 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -926,7 +926,7 @@ impl ScriptTask {
}
_ => ()
}
-
+
window.flush_layout();
}