Make DOM own the style and layout data, in an UnsafeCell

The previous Cell was a lie.
This commit is contained in:
Anthony Ramine 2020-04-03 18:54:11 +02:00
parent 516e8e0aa6
commit 185a402d9c
17 changed files with 74 additions and 180 deletions

View file

@ -369,7 +369,7 @@ pub(crate) trait NodeExt<'dom>: 'dom + Copy + LayoutNode<'dom> + Send + Sync {
fn style(self, context: &LayoutContext) -> ServoArc<ComputedValues>;
fn as_opaque(self) -> OpaqueNode;
fn layout_data_mut(&self) -> AtomicRefMut<LayoutDataForElement>;
fn layout_data_mut(self) -> AtomicRefMut<'dom, LayoutDataForElement>;
fn element_box_slot(&self) -> BoxSlot<'dom>;
fn pseudo_element_box_slot(&self, which: WhichPseudoElement) -> BoxSlot<'dom>;
fn unset_pseudo_element_box(self, which: WhichPseudoElement);
@ -447,12 +447,10 @@ where
}
#[allow(unsafe_code)]
fn layout_data_mut(&self) -> AtomicRefMut<LayoutDataForElement> {
unsafe {
self.get_raw_data()
.map(|d| d.layout_data.borrow_mut())
.unwrap()
}
fn layout_data_mut(self) -> AtomicRefMut<'dom, LayoutDataForElement> {
self.get_raw_data()
.map(|d| d.layout_data.borrow_mut())
.unwrap()
}
fn element_box_slot(&self) -> BoxSlot<'dom> {