mirror of
https://github.com/servo/servo.git
synced 2025-07-15 19:33:46 +01:00
Introduce a LayoutNodeLayoutData trait for methods to stay in layout.
This commit is contained in:
parent
310cb5a326
commit
c910ef2072
2 changed files with 5 additions and 1 deletions
|
@ -85,7 +85,7 @@ use util::thread_state;
|
|||
use util::workqueue::WorkQueue;
|
||||
use webrender_helpers::{WebRenderDisplayListConverter, WebRenderFrameBuilder};
|
||||
use webrender_traits;
|
||||
use wrapper::{LayoutNode, NonOpaqueStyleAndLayoutData, ServoLayoutNode};
|
||||
use wrapper::{LayoutNode, LayoutNodeLayoutData, NonOpaqueStyleAndLayoutData, ServoLayoutNode};
|
||||
|
||||
/// The number of screens of data we're allowed to generate display lists for in each direction.
|
||||
pub const DISPLAY_PORT_SIZE_FACTOR: i32 = 8;
|
||||
|
|
|
@ -83,7 +83,9 @@ pub trait LayoutNode: TNode {
|
|||
|
||||
fn init_style_and_layout_data(&self, data: OpaqueStyleAndLayoutData);
|
||||
fn get_style_and_layout_data(&self) -> Option<OpaqueStyleAndLayoutData>;
|
||||
}
|
||||
|
||||
pub trait LayoutNodeLayoutData {
|
||||
/// Similar to borrow_data*, but returns the full PrivateLayoutData rather
|
||||
/// than only the PrivateStyleData.
|
||||
unsafe fn borrow_layout_data_unchecked(&self) -> Option<*const PrivateLayoutData>;
|
||||
|
@ -320,7 +322,9 @@ impl<'ln> LayoutNode for ServoLayoutNode<'ln> {
|
|||
self.get_jsmanaged().get_style_and_layout_data()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: LayoutNode> LayoutNodeLayoutData for T {
|
||||
unsafe fn borrow_layout_data_unchecked(&self) -> Option<*const PrivateLayoutData> {
|
||||
self.get_style_and_layout_data().map(|opaque| {
|
||||
let container = *opaque.ptr as NonOpaqueStyleAndLayoutData;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue