servo/components/layout_2020/wrapper.rs
Anthony Ramine 317d700f5d Remove most of the things in layout 2020
We keep mostly the query system. There is probably more to delete but
that's a good start I think.
2019-07-31 17:09:17 +02:00

21 lines
702 B
Rust

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#![allow(unsafe_code)]
use crate::data::StyleAndLayoutData;
use script_layout_interface::wrapper_traits::GetLayoutData;
pub trait GetRawData {
fn get_raw_data(&self) -> Option<&StyleAndLayoutData>;
}
impl<T: GetLayoutData> GetRawData for T {
fn get_raw_data(&self) -> Option<&StyleAndLayoutData> {
self.get_style_and_layout_data().map(|opaque| {
let container = opaque.ptr.as_ptr() as *mut StyleAndLayoutData;
unsafe { &*container }
})
}
}