mirror of
https://github.com/servo/servo.git
synced 2025-06-23 16:44:33 +01:00
Switch to NodeFlags (the footprint has not changed)
This commit is contained in:
parent
b20d7d89c1
commit
e7ac792ed6
3 changed files with 15 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -926,7 +926,7 @@ impl ScriptTask {
|
|||
}
|
||||
_ => ()
|
||||
}
|
||||
|
||||
|
||||
window.flush_layout();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue