servo/components/layout_2020/flow.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

38 lines
1,007 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/. */
use std::fmt;
use style::selector_parser::RestyleDamage;
#[allow(unsafe_code)]
pub unsafe trait HasBaseFlow {}
pub trait GetBaseFlow {
fn base(&self) -> &BaseFlow;
fn mut_base(&mut self) -> &mut BaseFlow;
}
impl<T: HasBaseFlow + ?Sized> GetBaseFlow for T {
#[inline(always)]
#[allow(unsafe_code)]
fn base(&self) -> &BaseFlow {
let ptr: *const Self = self;
let ptr = ptr as *const BaseFlow;
unsafe { &*ptr }
}
#[inline(always)]
#[allow(unsafe_code)]
fn mut_base(&mut self) -> &mut BaseFlow {
let ptr: *mut Self = self;
let ptr = ptr as *mut BaseFlow;
unsafe { &mut *ptr }
}
}
pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {}
pub struct BaseFlow {
pub restyle_damage: RestyleDamage,
}