mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Use LayoutNode::new to avoid transmute calls in LayoutTask.
This commit is contained in:
parent
1eb8900f48
commit
cce510900e
2 changed files with 18 additions and 25 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue