auto merge of #2354 : glennw/servo/issue-2332, r=metajack

This commit is contained in:
bors-servo 2014-05-06 21:31:27 -04:00
commit 27bdc580ed
5 changed files with 16 additions and 16 deletions

View file

@ -5281,7 +5281,7 @@ class GlobalGenRoots():
}
#[inline(always)]
fn from_unrooted<T: ${fromBound}+Reflectable>(derived: Temporary<T>) -> Temporary<Self> {
fn from_temporary<T: ${fromBound}+Reflectable>(derived: Temporary<T>) -> Temporary<Self> {
unsafe { derived.transmute() }
}
}

View file

@ -535,8 +535,8 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
match interface.to_ascii_lower().as_slice() {
// FIXME: Implement CustomEvent (http://dom.spec.whatwg.org/#customevent)
"uievents" | "uievent" => Ok(EventCast::from_unrooted(UIEvent::new(&*window))),
"mouseevents" | "mouseevent" => Ok(EventCast::from_unrooted(MouseEvent::new(&*window))),
"uievents" | "uievent" => Ok(EventCast::from_temporary(UIEvent::new(&*window))),
"mouseevents" | "mouseevent" => Ok(EventCast::from_temporary(MouseEvent::new(&*window))),
"htmlevents" | "events" | "event" => Ok(Event::new(&*window)),
_ => Err(NotSupported)
}

View file

@ -135,12 +135,12 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
{
// Step 4.
let mut doc_html = NodeCast::from_unrooted(HTMLHtmlElement::new("html".to_owned(), &*doc)).root();
let mut doc_html = NodeCast::from_temporary(HTMLHtmlElement::new("html".to_owned(), &*doc)).root();
assert!(doc_node.AppendChild(&mut *doc_html).is_ok());
{
// Step 5.
let mut doc_head = NodeCast::from_unrooted(HTMLHeadElement::new("head".to_owned(), &*doc)).root();
let mut doc_head = NodeCast::from_temporary(HTMLHeadElement::new("head".to_owned(), &*doc)).root();
assert!(doc_html.AppendChild(&mut *doc_head).is_ok());
// Step 6.
@ -148,7 +148,7 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
None => (),
Some(title_str) => {
// Step 6.1.
let mut doc_title = NodeCast::from_unrooted(HTMLTitleElement::new("title".to_owned(), &*doc)).root();
let mut doc_title = NodeCast::from_temporary(HTMLTitleElement::new("title".to_owned(), &*doc)).root();
assert!(doc_head.AppendChild(&mut *doc_title).is_ok());
// Step 6.2.

View file

@ -1229,17 +1229,17 @@ impl Node {
let doctype = DocumentType::new(doctype.name.clone(),
Some(doctype.public_id.clone()),
Some(doctype.system_id.clone()), &*document);
NodeCast::from_unrooted(doctype)
NodeCast::from_temporary(doctype)
},
DocumentFragmentNodeTypeId => {
let doc_fragment = DocumentFragment::new(&*document);
NodeCast::from_unrooted(doc_fragment)
NodeCast::from_temporary(doc_fragment)
},
CommentNodeTypeId => {
let comment: &JSRef<Comment> = CommentCast::to_ref(node).unwrap();
let comment = comment.deref();
let comment = Comment::new(comment.characterdata.data.clone(), &*document);
NodeCast::from_unrooted(comment)
NodeCast::from_temporary(comment)
},
DocumentNodeTypeId => {
let document: &JSRef<Document> = DocumentCast::to_ref(node).unwrap();
@ -1250,26 +1250,26 @@ impl Node {
let window = document.window.root();
let document = Document::new(&*window, Some(document.url().clone()),
is_html_doc, None);
NodeCast::from_unrooted(document)
NodeCast::from_temporary(document)
},
ElementNodeTypeId(..) => {
let element: &JSRef<Element> = ElementCast::to_ref(node).unwrap();
let element = element.deref();
let element = build_element_from_tag(element.local_name.clone(), &*document);
NodeCast::from_unrooted(element)
NodeCast::from_temporary(element)
},
TextNodeTypeId => {
let text: &JSRef<Text> = TextCast::to_ref(node).unwrap();
let text = text.deref();
let text = Text::new(text.characterdata.data.clone(), &*document);
NodeCast::from_unrooted(text)
NodeCast::from_temporary(text)
},
ProcessingInstructionNodeTypeId => {
let pi: &JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(node).unwrap();
let pi = pi.deref();
let pi = ProcessingInstruction::new(pi.target.clone(),
pi.characterdata.data.clone(), &*document);
NodeCast::from_unrooted(pi)
NodeCast::from_temporary(pi)
},
}.root();
@ -1552,7 +1552,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
None
} else {
let document = self.owner_doc().root();
Some(NodeCast::from_unrooted(document.deref().CreateTextNode(value)))
Some(NodeCast::from_temporary(document.deref().CreateTextNode(value)))
}.root();
// Step 3.

View file

@ -40,7 +40,7 @@ macro_rules! handle_element(
$ctor: ident
$(, $arg:expr )*) => (
if $string == $localName {
return ElementCast::from_unrooted($ctor::new($localName, $document $(, $arg)*));
return ElementCast::from_temporary($ctor::new($localName, $document $(, $arg)*));
}
)
)
@ -243,7 +243,7 @@ pub fn build_element_from_tag(tag: DOMString, document: &JSRef<Document>) -> Tem
handle_element!(document, tag, "ul", HTMLUListElement);
handle_element!(document, tag, "video", HTMLVideoElement);
return ElementCast::from_unrooted(HTMLUnknownElement::new(tag, document));
return ElementCast::from_temporary(HTMLUnknownElement::new(tag, document));
}
pub fn parse_html(page: &Page,