Eliminate duplicate Layout DOM wrappers

There are duplicate sets of Layout DOM wrappers: one for Layout 2013 and
one for Layout 2020. As part of cleaning up and simplifying the
wrappers, this change parameterizes them on the specific layout data
they contain. This allows them to be shared again. In addition, various
small cleanups are included.

Fixes #29691.
This commit is contained in:
Martin Robinson 2023-05-02 08:35:33 +02:00
parent ab0d462c83
commit 2d31d4301d
14 changed files with 1035 additions and 2362 deletions

View file

@ -4,6 +4,7 @@
use crate::construct::ConstructionResult;
use atomic_refcell::AtomicRefCell;
use script_layout_interface::wrapper_traits::LayoutDataTrait;
use script_layout_interface::StyleData;
pub struct StyleAndLayoutData<'dom> {
@ -14,6 +15,7 @@ pub struct StyleAndLayoutData<'dom> {
}
/// Data that layout associates with a node.
#[derive(Clone)]
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
@ -32,9 +34,11 @@ pub struct LayoutData {
pub flags: LayoutDataFlags,
}
impl LayoutData {
impl LayoutDataTrait for LayoutData {}
impl Default for LayoutData {
/// Creates new layout data.
pub fn new() -> LayoutData {
fn default() -> LayoutData {
Self {
flow_construction_result: ConstructionResult::None,
before_flow_construction_result: ConstructionResult::None,