From b46de88a2b27fa70c3ab0ab555158835ca73b792 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Mon, 10 Feb 2014 11:09:15 -0400 Subject: [PATCH] Added missing refs to DOM spec This is a sub-task for #1655. --- src/components/script/dom/node.rs | 42 +++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs index 4f6639123b5..c295b5e28cd 100644 --- a/src/components/script/dom/node.rs +++ b/src/components/script/dom/node.rs @@ -548,7 +548,7 @@ impl<'a> AbstractNode { pub fn is_in_doc(&self) -> bool { self.node().flags.is_in_doc() } - + pub fn get_hover_state(&self) -> bool { self.node().flags.get_in_hover_state() } @@ -559,14 +559,17 @@ impl<'a> AbstractNode { } impl AbstractNode { + // http://dom.spec.whatwg.org/#dom-node-appendchild pub fn AppendChild(self, node: AbstractNode) -> Fallible { self.node().AppendChild(self, node) } + // http://dom.spec.whatwg.org/#dom-node-replacechild pub fn ReplaceChild(self, node: AbstractNode, child: AbstractNode) -> Fallible { self.node().ReplaceChild(self, node, child) } + // http://dom.spec.whatwg.org/#dom-node-removechild pub fn RemoveChild(self, node: AbstractNode) -> Fallible { self.node().RemoveChild(self, node) } @@ -951,6 +954,7 @@ impl Node { } } + // http://dom.spec.whatwg.org/#dom-node-nodename pub fn NodeName(&self, abstract_self: AbstractNode) -> DOMString { match self.type_id { ElementNodeTypeId(..) => { @@ -975,10 +979,12 @@ impl Node { } } + // http://dom.spec.whatwg.org/#dom-node-baseuri pub fn GetBaseURI(&self) -> Option { None } + // http://dom.spec.whatwg.org/#dom-node-ownerdocument pub fn GetOwnerDocument(&self) -> Option { match self.type_id { ElementNodeTypeId(..) | @@ -991,34 +997,42 @@ impl Node { } } + // http://dom.spec.whatwg.org/#dom-node-parentnode pub fn GetParentNode(&self) -> Option { self.parent_node } + // http://dom.spec.whatwg.org/#dom-node-parentelement pub fn GetParentElement(&self) -> Option { self.parent_node.filtered(|parent| parent.is_element()) } + // http://dom.spec.whatwg.org/#dom-node-haschildnodes pub fn HasChildNodes(&self) -> bool { self.first_child.is_some() } + // http://dom.spec.whatwg.org/#dom-node-firstchild pub fn GetFirstChild(&self) -> Option { self.first_child } + // http://dom.spec.whatwg.org/#dom-node-lastchild pub fn GetLastChild(&self) -> Option { self.last_child } + // http://dom.spec.whatwg.org/#dom-node-previoussibling pub fn GetPreviousSibling(&self) -> Option { self.prev_sibling } + // http://dom.spec.whatwg.org/#dom-node-nextsibling pub fn GetNextSibling(&self) -> Option { self.next_sibling } + // http://dom.spec.whatwg.org/#dom-node-nodevalue pub fn GetNodeValue(&self, abstract_self: AbstractNode) -> Option { match self.type_id { CommentNodeTypeId | @@ -1034,11 +1048,14 @@ impl Node { } } + // http://dom.spec.whatwg.org/#dom-node-nodevalue pub fn SetNodeValue(&mut self, _abstract_self: AbstractNode, _val: Option) -> ErrorResult { + // FIXME: Stub - https://github.com/mozilla/servo/issues/1655 Ok(()) } + // http://dom.spec.whatwg.org/#dom-node-textcontent pub fn GetTextContent(&self, abstract_self: AbstractNode) -> Option { match self.type_id { DocumentFragmentNodeTypeId | @@ -1067,6 +1084,7 @@ impl Node { } } + // http://dom.spec.whatwg.org/#dom-node-childnodes pub fn ChildNodes(&mut self, abstract_self: AbstractNode) -> @mut NodeList { match self.child_list { None => { @@ -1350,6 +1368,7 @@ impl Node { } } + // http://dom.spec.whatwg.org/#dom-node-textcontent pub fn SetTextContent(&mut self, abstract_self: AbstractNode, value: Option) -> ErrorResult { let value = null_str_as_empty(&value); @@ -1385,6 +1404,7 @@ impl Node { Ok(()) } + // http://dom.spec.whatwg.org/#dom-node-insertbefore pub fn InsertBefore(&self, abstract_self: AbstractNode, node: AbstractNode, child: Option) -> Fallible { Node::pre_insert(node, abstract_self, child) @@ -1395,6 +1415,7 @@ impl Node { document.document().wait_until_safe_to_modify_dom(); } + // http://dom.spec.whatwg.org/#dom-node-appendchild pub fn AppendChild(&self, abstract_self: AbstractNode, node: AbstractNode) -> Fallible { Node::pre_insert(node, abstract_self, None) @@ -1528,15 +1549,20 @@ impl Node { Ok(child) } + // http://dom.spec.whatwg.org/#dom-node-removechild pub fn RemoveChild(&self, abstract_self: AbstractNode, node: AbstractNode) -> Fallible { Node::pre_remove(node, abstract_self) } + // http://dom.spec.whatwg.org/#dom-node-normalize pub fn Normalize(&mut self) { + // FIXME: stub - https://github.com/mozilla/servo/issues/1655 } + // http://dom.spec.whatwg.org/#dom-node-clonenode pub fn CloneNode(&self, _deep: bool) -> Fallible { + // FIXME: stub - https://github.com/mozilla/servo/issues/1240 fail!("stub") } @@ -1624,10 +1650,13 @@ impl Node { } } + // http://dom.spec.whatwg.org/#dom-node-comparedocumentposition pub fn CompareDocumentPosition(&self, _other: AbstractNode) -> u16 { + // FIXME: stub - https://github.com/mozilla/servo/issues/1655 0 } + // http://dom.spec.whatwg.org/#dom-node-contains pub fn Contains(&self, abstract_self: AbstractNode, maybe_other: Option) -> bool { match maybe_other { None => false, @@ -1635,35 +1664,44 @@ impl Node { } } + // http://dom.spec.whatwg.org/#dom-node-lookupprefix pub fn LookupPrefix(&self, _prefix: Option) -> Option { + // FIXME: stub - https://github.com/mozilla/servo/issues/1655 None } + // http://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri pub fn LookupNamespaceURI(&self, _namespace: Option) -> Option { + // FIXME: stub - https://github.com/mozilla/servo/issues/1655 None } + // http://dom.spec.whatwg.org/#dom-node-isdefaultnamespace pub fn IsDefaultNamespace(&self, _namespace: Option) -> bool { + // FIXME: stub - https://github.com/mozilla/servo/issues/1655 false } + // http://dom.spec.whatwg.org/#dom-node-namespaceuri pub fn GetNamespaceURI(&self) -> Option { None } + // http://dom.spec.whatwg.org/#dom-node-prefix pub fn GetPrefix(&self) -> Option { None } + // http://dom.spec.whatwg.org/#dom-node-localname pub fn GetLocalName(&self) -> Option { None } + // http://dom.spec.whatwg.org/#dom-node-hasattributes pub fn HasAttributes(&self) -> bool { false } - // // Low-level pointer stitching //