mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Move the initialize_data method out of the TNode trait.
This reduces the dependency of TNode implementations on layout types.
This commit is contained in:
parent
ae5cb0ceb0
commit
e723d72570
3 changed files with 22 additions and 29 deletions
|
@ -81,6 +81,15 @@ impl<'ln> GeckoNode<'ln> {
|
|||
Gecko_GetNodeData(self.node) as NonOpaqueStyleData
|
||||
}
|
||||
}
|
||||
|
||||
pub fn initialize_data(self) {
|
||||
unsafe {
|
||||
if self.get_node_data().is_null() {
|
||||
let ptr: NonOpaqueStyleData = Box::into_raw(box RefCell::new(PrivateStyleData::new()));
|
||||
Gecko_SetNodeData(self.node, ptr as *mut ServoNodeData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
|
@ -132,15 +141,6 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
|||
OpaqueNode(ptr)
|
||||
}
|
||||
|
||||
fn initialize_data(self) {
|
||||
unsafe {
|
||||
if self.get_node_data().is_null() {
|
||||
let ptr: NonOpaqueStyleData = Box::into_raw(box RefCell::new(PrivateStyleData::new()));
|
||||
Gecko_SetNodeData(self.node, ptr as *mut ServoNodeData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn layout_parent_node(self, reflow_root: OpaqueNode) -> Option<GeckoNode<'ln>> {
|
||||
if self.opaque() == reflow_root {
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue