Use LayoutNode::new to avoid transmute calls in LayoutTask.

This commit is contained in:
Ms2ger 2015-10-29 16:55:27 +01:00
parent 1eb8900f48
commit cce510900e
2 changed files with 18 additions and 25 deletions

View file

@ -221,6 +221,15 @@ impl<'ln> LayoutNode<'ln> {
as_element(self.node)
}
pub fn as_document(&self) -> Option<LayoutDocument<'ln>> {
self.node.downcast().map(|document| {
LayoutDocument {
document: document,
chain: PhantomData,
}
})
}
fn parent_node(&self) -> Option<LayoutNode<'ln>> {
unsafe {
self.node.parent_node_ref().map(|node| self.new_with_this_lifetime(&node))