mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Move children_to_process to layout.
We don't need this for Gecko, and it's hard to implement in that case because there's nowhere obvious to put it (we don't plan to create TSDs for non-dirty nodes, and non-dirty nodes can have dirty children which require the children_to_process atomic). There are various solutions here, but punting is the easiest. We'll need to rethink this if/when we need to do a bottom-up traversal for Gecko.
This commit is contained in:
parent
b1d8eff467
commit
c72fffa8f8
8 changed files with 74 additions and 44 deletions
|
@ -52,12 +52,32 @@ use core::nonzero::NonZero;
|
|||
use ipc_channel::ipc::IpcSender;
|
||||
use libc::c_void;
|
||||
use restyle_damage::RestyleDamage;
|
||||
use std::sync::atomic::AtomicIsize;
|
||||
use style::atomic_refcell::AtomicRefCell;
|
||||
use style::data::PersistentStyleData;
|
||||
|
||||
pub struct PartialPersistentLayoutData {
|
||||
/// Data that the style system associates with a node. When the
|
||||
/// style system is being used standalone, this is all that hangs
|
||||
/// off the node. This must be first to permit the various
|
||||
/// transmutations between PersistentStyleData and PersistentLayoutData.
|
||||
pub style_data: PersistentStyleData,
|
||||
|
||||
/// Description of how to account for recent style changes.
|
||||
pub restyle_damage: RestyleDamage,
|
||||
|
||||
/// Information needed during parallel traversals.
|
||||
pub parallel: DomParallelInfo,
|
||||
}
|
||||
|
||||
impl PartialPersistentLayoutData {
|
||||
pub fn new() -> Self {
|
||||
PartialPersistentLayoutData {
|
||||
style_data: PersistentStyleData::new(),
|
||||
restyle_damage: RestyleDamage::empty(),
|
||||
parallel: DomParallelInfo::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, HeapSizeOf)]
|
||||
|
@ -70,6 +90,22 @@ pub struct OpaqueStyleAndLayoutData {
|
|||
#[allow(unsafe_code)]
|
||||
unsafe impl Send for OpaqueStyleAndLayoutData {}
|
||||
|
||||
/// Information that we need stored in each DOM node.
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct DomParallelInfo {
|
||||
/// The number of children remaining to process during bottom-up traversal.
|
||||
pub children_to_process: AtomicIsize,
|
||||
}
|
||||
|
||||
impl DomParallelInfo {
|
||||
pub fn new() -> DomParallelInfo {
|
||||
DomParallelInfo {
|
||||
children_to_process: AtomicIsize::new(0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
pub enum LayoutNodeType {
|
||||
Comment,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue