diff options
Diffstat (limited to 'components/layout/data.rs')
-rw-r--r-- | components/layout/data.rs | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/components/layout/data.rs b/components/layout/data.rs index d0b798dac2a..ef2195a9f31 100644 --- a/components/layout/data.rs +++ b/components/layout/data.rs @@ -2,16 +2,32 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use atomic_refcell::AtomicRefCell; use construct::ConstructionResult; -use script_layout_interface::PartialPersistentLayoutData; +use script_layout_interface::StyleData; -/// Data that layout associates with a node. #[repr(C)] -pub struct PersistentLayoutData { +pub struct StyleAndLayoutData { /// Data accessed by script_layout_interface. This must be first to allow - /// casting between PersistentLayoutData and PartialPersistentLayoutData. - pub base: PartialPersistentLayoutData, + /// casting between StyleAndLayoutData and StyleData. + pub style_data: StyleData, + /// The layout data associated with a node. + pub layout_data: AtomicRefCell<LayoutData>, +} +impl StyleAndLayoutData { + pub fn new() -> Self { + Self { + style_data: StyleData::new(), + layout_data: AtomicRefCell::new(LayoutData::new()), + } + } +} + + +/// Data that layout associates with a node. +#[repr(C)] +pub struct LayoutData { /// The current results of flow construction for this node. This is either a /// flow or a `ConstructionItem`. See comments in `construct.rs` for more /// details. @@ -29,11 +45,10 @@ pub struct PersistentLayoutData { pub flags: LayoutDataFlags, } -impl PersistentLayoutData { +impl LayoutData { /// Creates new layout data. - pub fn new() -> PersistentLayoutData { - PersistentLayoutData { - base: PartialPersistentLayoutData::new(), + pub fn new() -> LayoutData { + Self { flow_construction_result: ConstructionResult::None, before_flow_construction_result: ConstructionResult::None, after_flow_construction_result: ConstructionResult::None, |