aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/tests/tables.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2025-04-12 16:13:23 +0200
committerGitHub <noreply@github.com>2025-04-12 14:13:23 +0000
commit56e7c21fe796f5e2e4b6715b1dc97aa557f44824 (patch)
tree1a3ff2cabeaede2f251c66929f65d1198d766040 /components/layout_2020/tests/tables.rs
parenta4a308e4342b3717a20c599b98d10ab27fe75065 (diff)
downloadservo-56e7c21fe796f5e2e4b6715b1dc97aa557f44824.tar.gz
servo-56e7c21fe796f5e2e4b6715b1dc97aa557f44824.zip
layout: Store table parts in DOM layout data (#36447)
When laying out tables, store the boxes of non-anonymous table parts in their respective DOM objects. This is going to be important for incremental layout, but also for mapping from the DOM to the box tree (and eventually the fragment tree). For now, anonymous table parts are still lost to time and space, but in a followup change we hope to store them somewhere. Testing: This has no visible change to web rendering, so is covered by existing WPT. Co-authored-by: Oriol Brufau <obrufau@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Diffstat (limited to 'components/layout_2020/tests/tables.rs')
-rw-r--r--components/layout_2020/tests/tables.rs57
1 files changed, 29 insertions, 28 deletions
diff --git a/components/layout_2020/tests/tables.rs b/components/layout_2020/tests/tables.rs
index 5b1129bf999..559a409d19b 100644
--- a/components/layout_2020/tests/tables.rs
+++ b/components/layout_2020/tests/tables.rs
@@ -6,6 +6,7 @@
mod tables {
use euclid::Vector2D;
+ use layout_2020::ArcRefCell;
use layout_2020::table::{Table, TableBuilder, TableSlot, TableSlotCell, TableSlotOffset};
fn row_lengths(table: &Table) -> Vec<usize> {
@@ -14,7 +15,7 @@ mod tables {
fn slot_is_cell_with_id(slot: &TableSlot, id: usize) -> bool {
match slot {
- TableSlot::Cell(cell) if cell.node_id() == id => true,
+ TableSlot::Cell(cell) if cell.borrow().node_id() == id => true,
_ => false,
}
}
@@ -51,13 +52,13 @@ mod tables {
let mut table_builder = TableBuilder::new_for_tests();
table_builder.start_row();
- table_builder.add_cell(TableSlotCell::mock_for_testing(1, 1, 1));
- table_builder.add_cell(TableSlotCell::mock_for_testing(2, 1, 1));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(1, 1, 1)));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(2, 1, 1)));
table_builder.end_row();
table_builder.start_row();
- table_builder.add_cell(TableSlotCell::mock_for_testing(3, 1, 1));
- table_builder.add_cell(TableSlotCell::mock_for_testing(4, 1, 1));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(3, 1, 1)));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(4, 1, 1)));
table_builder.end_row();
let table = table_builder.finish();
@@ -74,13 +75,13 @@ mod tables {
let mut table_builder = TableBuilder::new_for_tests();
table_builder.start_row();
- table_builder.add_cell(TableSlotCell::mock_for_testing(1, 1, 1));
- table_builder.add_cell(TableSlotCell::mock_for_testing(2, 1, 1));
- table_builder.add_cell(TableSlotCell::mock_for_testing(3, 1, 2));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(1, 1, 1)));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(2, 1, 1)));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(3, 1, 2)));
table_builder.end_row();
table_builder.start_row();
- table_builder.add_cell(TableSlotCell::mock_for_testing(4, 1, 1));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(4, 1, 1)));
table_builder.end_row();
let table = table_builder.finish();
@@ -103,21 +104,21 @@ mod tables {
let mut table_builder = TableBuilder::new_for_tests();
table_builder.start_row();
- table_builder.add_cell(TableSlotCell::mock_for_testing(1, 3, 1));
- table_builder.add_cell(TableSlotCell::mock_for_testing(2, 1, 1));
- table_builder.add_cell(TableSlotCell::mock_for_testing(3, 1, 1));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(1, 3, 1)));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(2, 1, 1)));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(3, 1, 1)));
table_builder.end_row();
table_builder.start_row();
- table_builder.add_cell(TableSlotCell::mock_for_testing(4, 1, 1));
- table_builder.add_cell(TableSlotCell::mock_for_testing(5, 3, 1));
- table_builder.add_cell(TableSlotCell::mock_for_testing(6, 1, 1));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(4, 1, 1)));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(5, 3, 1)));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(6, 1, 1)));
table_builder.end_row();
table_builder.start_row();
- table_builder.add_cell(TableSlotCell::mock_for_testing(7, 1, 1));
- table_builder.add_cell(TableSlotCell::mock_for_testing(8, 1, 1));
- table_builder.add_cell(TableSlotCell::mock_for_testing(9, 3, 1));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(7, 1, 1)));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(8, 1, 1)));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(9, 3, 1)));
table_builder.end_row();
let table = table_builder.finish();
@@ -165,13 +166,13 @@ mod tables {
let mut table_builder = TableBuilder::new_for_tests();
table_builder.start_row();
- table_builder.add_cell(TableSlotCell::mock_for_testing(1, 1, 1));
- table_builder.add_cell(TableSlotCell::mock_for_testing(2, 1, 1));
- table_builder.add_cell(TableSlotCell::mock_for_testing(3, 1, 2));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(1, 1, 1)));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(2, 1, 1)));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(3, 1, 2)));
table_builder.end_row();
table_builder.start_row();
- table_builder.add_cell(TableSlotCell::mock_for_testing(4, 3, 1));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(4, 3, 1)));
table_builder.end_row();
let table = table_builder.finish();
@@ -197,9 +198,9 @@ mod tables {
let mut table_builder = TableBuilder::new_for_tests();
table_builder.start_row();
- table_builder.add_cell(TableSlotCell::mock_for_testing(1, 1, 1));
- table_builder.add_cell(TableSlotCell::mock_for_testing(2, 1, 1));
- table_builder.add_cell(TableSlotCell::mock_for_testing(3, 1, 0));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(1, 1, 1)));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(2, 1, 1)));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(3, 1, 0)));
table_builder.end_row();
table_builder.start_row();
@@ -235,12 +236,12 @@ mod tables {
let mut table_builder = TableBuilder::new_for_tests();
table_builder.start_row();
- table_builder.add_cell(TableSlotCell::mock_for_testing(1, 1, 1));
- table_builder.add_cell(TableSlotCell::mock_for_testing(2, 1, 30));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(1, 1, 1)));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(2, 1, 30)));
table_builder.end_row();
table_builder.start_row();
- table_builder.add_cell(TableSlotCell::mock_for_testing(3, 2, 1));
+ table_builder.add_cell(ArcRefCell::new(TableSlotCell::mock_for_testing(3, 2, 1)));
table_builder.end_row();
assert_eq!(table_builder.incoming_rowspans, vec![0, 28]);