diff options
author | Cameron Zwarich <zwarich@mozilla.com> | 2014-09-18 13:43:15 -0700 |
---|---|---|
committer | Cameron Zwarich <zwarich@mozilla.com> | 2014-09-19 13:39:17 -0700 |
commit | 4fa872511117eafd934cad70c7d3b8c583fb960e (patch) | |
tree | 8c75e871c896648de54c2e9aa376d30b4b98220e /components/script/dom/documentfragment.rs | |
parent | b8f34bbc5170f78e4939b1d647f8d8498e3c2fb6 (diff) | |
download | servo-4fa872511117eafd934cad70c7d3b8c583fb960e.tar.gz servo-4fa872511117eafd934cad70c7d3b8c583fb960e.zip |
First steps of &JSRef -> JSRef conversion
Replace &JSRef with JSRef in the bulk of the generated code. This will
remove a level of indirection throughout all DOM code.
This patch doesn't change methods implemented on JSRef<T> to take `self`
rather than `&self`, and it leaves a few other uses of &JSRef, but those
changes can be made incrementally.
Diffstat (limited to 'components/script/dom/documentfragment.rs')
-rw-r--r-- | components/script/dom/documentfragment.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/components/script/dom/documentfragment.rs b/components/script/dom/documentfragment.rs index c8d8b961113..916a3550264 100644 --- a/components/script/dom/documentfragment.rs +++ b/components/script/dom/documentfragment.rs @@ -32,13 +32,13 @@ impl DocumentFragmentDerived for EventTarget { impl DocumentFragment { /// Creates a new DocumentFragment. - pub fn new_inherited(document: &JSRef<Document>) -> DocumentFragment { + pub fn new_inherited(document: JSRef<Document>) -> DocumentFragment { DocumentFragment { node: Node::new_inherited(DocumentFragmentNodeTypeId, document), } } - pub fn new(document: &JSRef<Document>) -> Temporary<DocumentFragment> { + pub fn new(document: JSRef<Document>) -> Temporary<DocumentFragment> { Node::reflect_node(box DocumentFragment::new_inherited(document), document, DocumentFragmentBinding::Wrap) } @@ -47,26 +47,26 @@ impl DocumentFragment { let document = global.as_window().Document(); let document = document.root(); - Ok(DocumentFragment::new(&document.root_ref())) + Ok(DocumentFragment::new(*document)) } } impl<'a> DocumentFragmentMethods for JSRef<'a, DocumentFragment> { // http://dom.spec.whatwg.org/#dom-parentnode-children fn Children(&self) -> Temporary<HTMLCollection> { - let window = window_from_node(self).root(); - HTMLCollection::children(&window.root_ref(), NodeCast::from_ref(self)) + let window = window_from_node(*self).root(); + HTMLCollection::children(*window, NodeCast::from_ref(*self)) } // http://dom.spec.whatwg.org/#dom-parentnode-queryselector fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>> { - let root: &JSRef<Node> = NodeCast::from_ref(self); + let root: JSRef<Node> = NodeCast::from_ref(*self); root.query_selector(selectors) } // http://dom.spec.whatwg.org/#dom-parentnode-queryselectorall fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible<Temporary<NodeList>> { - let root: &JSRef<Node> = NodeCast::from_ref(self); + let root: JSRef<Node> = NodeCast::from_ref(*self); root.query_selector_all(selectors) } |