mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Make DOM own the style and layout data, in an UnsafeCell
The previous Cell was a lie.
This commit is contained in:
parent
516e8e0aa6
commit
185a402d9c
17 changed files with 74 additions and 180 deletions
|
@ -7,15 +7,15 @@
|
|||
use crate::data::StyleAndLayoutData;
|
||||
use script_layout_interface::wrapper_traits::GetLayoutData;
|
||||
|
||||
pub trait GetRawData {
|
||||
unsafe fn get_raw_data(&self) -> Option<&StyleAndLayoutData>;
|
||||
pub trait GetRawData<'dom> {
|
||||
fn get_raw_data(self) -> Option<&'dom StyleAndLayoutData>;
|
||||
}
|
||||
|
||||
impl<'dom, T> GetRawData for T
|
||||
impl<'dom, T> GetRawData<'dom> for T
|
||||
where
|
||||
T: GetLayoutData<'dom>,
|
||||
{
|
||||
unsafe fn get_raw_data(&self) -> Option<&StyleAndLayoutData> {
|
||||
fn get_raw_data(self) -> Option<&'dom StyleAndLayoutData> {
|
||||
self.get_style_and_layout_data()
|
||||
.map(|opaque| opaque.downcast_ref().unwrap())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue