mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
auto merge of #1634 : brunoabinader/servo/document-fromnode, r=jdm
TSIA. @jdm mentioned to use ```AbstractDocument::from_box``` internally, though.
This commit is contained in:
commit
14ee9218e4
1 changed files with 9 additions and 0 deletions
|
@ -76,6 +76,15 @@ impl AbstractDocument {
|
||||||
document: ptr as *mut Box<Document>
|
document: ptr as *mut Box<Document>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn from_node(node: AbstractNode) -> AbstractDocument {
|
||||||
|
if !node.is_document() {
|
||||||
|
fail!("node is not a document");
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
cast::transmute(node)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq)]
|
#[deriving(Eq)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue