mirror of
https://github.com/servo/servo.git
synced 2025-07-28 09:40:33 +01:00
Implement the LayoutData getters on LayoutJS<Node> rather than Node itself.
This commit is contained in:
parent
a217ffb00a
commit
eb2c508df0
3 changed files with 33 additions and 28 deletions
|
@ -1091,6 +1091,13 @@ pub trait LayoutNodeHelpers {
|
|||
unsafe fn get_flag(&self, flag: NodeFlags) -> bool;
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn set_flag(&self, flag: NodeFlags, value: bool);
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn layout_data(&self) -> Ref<Option<LayoutData>>;
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn layout_data_mut(&self) -> RefMut<Option<LayoutData>>;
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn layout_data_unchecked(&self) -> *const Option<LayoutData>;
|
||||
}
|
||||
|
||||
impl LayoutNodeHelpers for LayoutJS<Node> {
|
||||
|
@ -1162,6 +1169,24 @@ impl LayoutNodeHelpers for LayoutJS<Node> {
|
|||
|
||||
(*this).flags.set(flags);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn layout_data(&self) -> Ref<Option<LayoutData>> {
|
||||
(*self.unsafe_get()).layout_data.borrow()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn layout_data_mut(&self) -> RefMut<Option<LayoutData>> {
|
||||
(*self.unsafe_get()).layout_data.borrow_mut()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn layout_data_unchecked(&self) -> *const Option<LayoutData> {
|
||||
(*self.unsafe_get()).layout_data.borrow_unchecked()
|
||||
}
|
||||
}
|
||||
|
||||
pub trait RawLayoutNodeHelpers {
|
||||
|
@ -1461,22 +1486,6 @@ impl Node {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn layout_data(&self) -> Ref<Option<LayoutData>> {
|
||||
self.layout_data.borrow()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn layout_data_mut(&self) -> RefMut<Option<LayoutData>> {
|
||||
self.layout_data.borrow_mut()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
pub unsafe fn layout_data_unchecked(&self) -> *const Option<LayoutData> {
|
||||
self.layout_data.borrow_unchecked()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-node-adopt
|
||||
pub fn adopt(node: &Node, document: &Document) {
|
||||
// Step 1.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue