mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Implement get_style_data() methods.
This commit is contained in:
parent
bea96f60e3
commit
72632ac16d
1 changed files with 16 additions and 0 deletions
|
@ -79,6 +79,8 @@ pub trait LayoutNode: TNode {
|
|||
/// Returns the type ID of this node.
|
||||
fn type_id(&self) -> NodeTypeId;
|
||||
|
||||
fn get_style_data(&self) -> Option<&RefCell<PartialStyleAndLayoutData>>;
|
||||
|
||||
/// Similar to borrow_data*, but returns the full PrivateLayoutData rather
|
||||
/// than only the PrivateStyleData.
|
||||
unsafe fn borrow_layout_data_unchecked(&self) -> Option<*const PrivateLayoutData>;
|
||||
|
@ -292,6 +294,14 @@ impl<'ln> LayoutNode for ServoLayoutNode<'ln> {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_style_data(&self) -> Option<&RefCell<PartialStyleAndLayoutData>> {
|
||||
unsafe {
|
||||
self.get_jsmanaged().get_style_and_layout_data().map(|d| {
|
||||
&**d.ptr
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn borrow_layout_data_unchecked(&self) -> Option<*const PrivateLayoutData> {
|
||||
self.get_jsmanaged().get_style_and_layout_data().map(|opaque| {
|
||||
let container = *opaque.ptr as NonOpaqueStyleAndLayoutData;
|
||||
|
@ -932,6 +942,8 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Sized + PartialEq {
|
|||
fn layer_id_for_overflow_scroll(&self) -> LayerId {
|
||||
LayerId::new_of_type(LayerType::OverflowScroll, self.opaque().id() as usize)
|
||||
}
|
||||
|
||||
fn get_style_data(&self) -> Option<&RefCell<PartialStyleAndLayoutData>>;
|
||||
}
|
||||
|
||||
// This trait is only public so that it can be implemented by the gecko wrapper.
|
||||
|
@ -1159,6 +1171,10 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
|
|||
self.get_jsmanaged().downcast::<Element>().unwrap().get_colspan()
|
||||
}
|
||||
}
|
||||
|
||||
fn get_style_data(&self) -> Option<&RefCell<PartialStyleAndLayoutData>> {
|
||||
self.node.get_style_data()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ThreadSafeLayoutNodeChildrenIterator<ConcreteNode: ThreadSafeLayoutNode> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue