mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Rename Root<T> to DomRoot<T>
In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>, where Root<T> will be able to handle all the things that need to be rooted that have a stable traceable address that doesn't move for the whole lifetime of the root. Stay tuned.
This commit is contained in:
parent
577370746e
commit
f87c2a8d76
291 changed files with 1774 additions and 1770 deletions
|
@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
|||
use dom::bindings::error::Fallible;
|
||||
use dom::bindings::inheritance::Castable;
|
||||
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||
use dom::bindings::root::{Dom, Root};
|
||||
use dom::bindings::root::{Dom, DomRoot};
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::bindings::xmlname::{namespace_from_domstring, validate_qualified_name};
|
||||
use dom::document::{Document, HasBrowsingContext, IsHTMLDocument};
|
||||
|
@ -41,7 +41,7 @@ impl DOMImplementation {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(document: &Document) -> Root<DOMImplementation> {
|
||||
pub fn new(document: &Document) -> DomRoot<DOMImplementation> {
|
||||
let window = document.window();
|
||||
reflect_dom_object(box DOMImplementation::new_inherited(document),
|
||||
window,
|
||||
|
@ -56,7 +56,7 @@ impl DOMImplementationMethods for DOMImplementation {
|
|||
qualified_name: DOMString,
|
||||
pubid: DOMString,
|
||||
sysid: DOMString)
|
||||
-> Fallible<Root<DocumentType>> {
|
||||
-> Fallible<DomRoot<DocumentType>> {
|
||||
validate_qualified_name(&qualified_name)?;
|
||||
Ok(DocumentType::new(qualified_name, Some(pubid), Some(sysid), &self.document))
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ impl DOMImplementationMethods for DOMImplementation {
|
|||
maybe_namespace: Option<DOMString>,
|
||||
qname: DOMString,
|
||||
maybe_doctype: Option<&DocumentType>)
|
||||
-> Fallible<Root<XMLDocument>> {
|
||||
-> Fallible<DomRoot<XMLDocument>> {
|
||||
let win = self.document.window();
|
||||
let loader = DocumentLoader::new(&self.document.loader());
|
||||
let namespace = namespace_from_domstring(maybe_namespace.to_owned());
|
||||
|
@ -121,7 +121,7 @@ impl DOMImplementationMethods for DOMImplementation {
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
|
||||
fn CreateHTMLDocument(&self, title: Option<DOMString>) -> Root<Document> {
|
||||
fn CreateHTMLDocument(&self, title: Option<DOMString>) -> DomRoot<Document> {
|
||||
let win = self.document.window();
|
||||
let loader = DocumentLoader::new(&self.document.loader());
|
||||
|
||||
|
@ -149,14 +149,14 @@ impl DOMImplementationMethods for DOMImplementation {
|
|||
{
|
||||
// Step 4.
|
||||
let doc_node = doc.upcast::<Node>();
|
||||
let doc_html = Root::upcast::<Node>(HTMLHtmlElement::new(local_name!("html"),
|
||||
let doc_html = DomRoot::upcast::<Node>(HTMLHtmlElement::new(local_name!("html"),
|
||||
None,
|
||||
&doc));
|
||||
doc_node.AppendChild(&doc_html).expect("Appending failed");
|
||||
|
||||
{
|
||||
// Step 5.
|
||||
let doc_head = Root::upcast::<Node>(HTMLHeadElement::new(local_name!("head"),
|
||||
let doc_head = DomRoot::upcast::<Node>(HTMLHeadElement::new(local_name!("head"),
|
||||
None,
|
||||
&doc));
|
||||
doc_html.AppendChild(&doc_head).unwrap();
|
||||
|
@ -165,7 +165,7 @@ impl DOMImplementationMethods for DOMImplementation {
|
|||
if let Some(title_str) = title {
|
||||
// Step 6.1.
|
||||
let doc_title =
|
||||
Root::upcast::<Node>(HTMLTitleElement::new(local_name!("title"),
|
||||
DomRoot::upcast::<Node>(HTMLTitleElement::new(local_name!("title"),
|
||||
None,
|
||||
&doc));
|
||||
doc_head.AppendChild(&doc_title).unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue