mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Split initialize_data into two.
The first one handles the layout-specific part, and calls the second one to handle the script-specific part.
This commit is contained in:
parent
d50c166786
commit
8b05833e52
1 changed files with 9 additions and 3 deletions
|
@ -81,6 +81,8 @@ pub trait LayoutNode: TNode {
|
||||||
|
|
||||||
fn get_style_data(&self) -> Option<&RefCell<PartialStyleAndLayoutData>>;
|
fn get_style_data(&self) -> Option<&RefCell<PartialStyleAndLayoutData>>;
|
||||||
|
|
||||||
|
fn init_style_and_layout_data(&self, data: OpaqueStyleAndLayoutData);
|
||||||
|
|
||||||
/// Similar to borrow_data*, but returns the full PrivateLayoutData rather
|
/// Similar to borrow_data*, but returns the full PrivateLayoutData rather
|
||||||
/// than only the PrivateStyleData.
|
/// than only the PrivateStyleData.
|
||||||
unsafe fn borrow_layout_data_unchecked(&self) -> Option<*const PrivateLayoutData>;
|
unsafe fn borrow_layout_data_unchecked(&self) -> Option<*const PrivateLayoutData>;
|
||||||
|
@ -131,9 +133,7 @@ impl<'ln> ServoLayoutNode<'ln> {
|
||||||
let opaque = OpaqueStyleAndLayoutData {
|
let opaque = OpaqueStyleAndLayoutData {
|
||||||
ptr: unsafe { NonZero::new(ptr as *mut RefCell<PartialStyleAndLayoutData>) }
|
ptr: unsafe { NonZero::new(ptr as *mut RefCell<PartialStyleAndLayoutData>) }
|
||||||
};
|
};
|
||||||
unsafe {
|
self.init_style_and_layout_data(opaque);
|
||||||
self.node.init_style_and_layout_data(opaque);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,6 +308,12 @@ impl<'ln> LayoutNode for ServoLayoutNode<'ln> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn init_style_and_layout_data(&self, data: OpaqueStyleAndLayoutData) {
|
||||||
|
unsafe {
|
||||||
|
self.get_jsmanaged().init_style_and_layout_data(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsafe fn borrow_layout_data_unchecked(&self) -> Option<*const PrivateLayoutData> {
|
unsafe fn borrow_layout_data_unchecked(&self) -> Option<*const PrivateLayoutData> {
|
||||||
self.get_jsmanaged().get_style_and_layout_data().map(|opaque| {
|
self.get_jsmanaged().get_style_and_layout_data().map(|opaque| {
|
||||||
let container = *opaque.ptr as NonOpaqueStyleAndLayoutData;
|
let container = *opaque.ptr as NonOpaqueStyleAndLayoutData;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue