aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/data.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2023-05-02 08:35:33 +0200
committerMartin Robinson <mrobinson@igalia.com>2023-05-05 17:16:38 +0200
commit2d31d4301d66bce4678af848e80905a35b9c02aa (patch)
treed6386d2c0984ea74b733e3393a187aff6065ad1f /components/layout/data.rs
parentab0d462c83b6a13d64f664e09276d6c8decb5a02 (diff)
downloadservo-2d31d4301d66bce4678af848e80905a35b9c02aa.tar.gz
servo-2d31d4301d66bce4678af848e80905a35b9c02aa.zip
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.
Diffstat (limited to 'components/layout/data.rs')
-rw-r--r--components/layout/data.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/components/layout/data.rs b/components/layout/data.rs
index 65d96bae244..7744b08a573 100644
--- a/components/layout/data.rs
+++ b/components/layout/data.rs
@@ -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,