mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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
|
@ -12,7 +12,7 @@ use dom::bindings::codegen::InheritTypes::{CharacterDataTypeId, NodeTypeId};
|
|||
use dom::bindings::codegen::UnionTypes::NodeOrString;
|
||||
use dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||
use dom::bindings::inheritance::Castable;
|
||||
use dom::bindings::root::{LayoutDom, Root};
|
||||
use dom::bindings::root::{DomRoot, LayoutDom};
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::comment::Comment;
|
||||
use dom::document::Document;
|
||||
|
@ -40,17 +40,17 @@ impl CharacterData {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn clone_with_data(&self, data: DOMString, document: &Document) -> Root<Node> {
|
||||
pub fn clone_with_data(&self, data: DOMString, document: &Document) -> DomRoot<Node> {
|
||||
match self.upcast::<Node>().type_id() {
|
||||
NodeTypeId::CharacterData(CharacterDataTypeId::Comment) => {
|
||||
Root::upcast(Comment::new(data, &document))
|
||||
DomRoot::upcast(Comment::new(data, &document))
|
||||
}
|
||||
NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction) => {
|
||||
let pi = self.downcast::<ProcessingInstruction>().unwrap();
|
||||
Root::upcast(ProcessingInstruction::new(pi.Target(), data, &document))
|
||||
DomRoot::upcast(ProcessingInstruction::new(pi.Target(), data, &document))
|
||||
},
|
||||
NodeTypeId::CharacterData(CharacterDataTypeId::Text) => {
|
||||
Root::upcast(Text::new(data, &document))
|
||||
DomRoot::upcast(Text::new(data, &document))
|
||||
},
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
@ -237,13 +237,13 @@ impl CharacterDataMethods for CharacterData {
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-previouselementsibling
|
||||
fn GetPreviousElementSibling(&self) -> Option<Root<Element>> {
|
||||
self.upcast::<Node>().preceding_siblings().filter_map(Root::downcast).next()
|
||||
fn GetPreviousElementSibling(&self) -> Option<DomRoot<Element>> {
|
||||
self.upcast::<Node>().preceding_siblings().filter_map(DomRoot::downcast).next()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-nextelementsibling
|
||||
fn GetNextElementSibling(&self) -> Option<Root<Element>> {
|
||||
self.upcast::<Node>().following_siblings().filter_map(Root::downcast).next()
|
||||
fn GetNextElementSibling(&self) -> Option<DomRoot<Element>> {
|
||||
self.upcast::<Node>().following_siblings().filter_map(DomRoot::downcast).next()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue