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:
Ms2ger 2016-06-13 14:01:03 +01:00
parent ae5cb0ceb0
commit e723d72570
3 changed files with 22 additions and 29 deletions

View file

@ -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