mirror of
https://github.com/servo/servo.git
synced 2025-06-09 00:53:26 +00:00
We keep mostly the query system. There is probably more to delete but that's a good start I think.
38 lines
1,007 B
Rust
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,
|
|
}
|