Make a bunch of LayoutNodeHelpers be safe

This commit is contained in:
Anthony Ramine 2020-03-31 22:13:06 +02:00
parent f014da9565
commit 68d5cfffd5
3 changed files with 33 additions and 36 deletions

View file

@ -135,7 +135,7 @@ impl<'ln> ServoLayoutNode<'ln> {
}
fn script_type_id(&self) -> NodeTypeId {
unsafe { self.node.type_id_for_layout() }
self.node.type_id_for_layout()
}
}
@ -211,23 +211,23 @@ impl<'ln> TNode for ServoLayoutNode<'ln> {
}
fn first_child(&self) -> Option<Self> {
unsafe { self.node.first_child_ref().map(Self::from_layout_js) }
self.node.first_child_ref().map(Self::from_layout_js)
}
fn last_child(&self) -> Option<Self> {
unsafe { self.node.last_child_ref().map(Self::from_layout_js) }
self.node.last_child_ref().map(Self::from_layout_js)
}
fn prev_sibling(&self) -> Option<Self> {
unsafe { self.node.prev_sibling_ref().map(Self::from_layout_js) }
self.node.prev_sibling_ref().map(Self::from_layout_js)
}
fn next_sibling(&self) -> Option<Self> {
unsafe { self.node.next_sibling_ref().map(Self::from_layout_js) }
self.node.next_sibling_ref().map(Self::from_layout_js)
}
fn owner_doc(&self) -> Self::ConcreteDocument {
ServoLayoutDocument::from_layout_js(unsafe { self.node.owner_doc_for_layout() })
ServoLayoutDocument::from_layout_js(self.node.owner_doc_for_layout())
}
fn traversal_parent(&self) -> Option<ServoLayoutElement<'ln>> {