layout: Store shared styles for table backgrounds in SharedBackgroundStyle (#36893)

Table cells share background styles with their track and track group
boxes. When a track and track group style is repaired, this new data
structure will allow reparing the style of the cell `Fragment`s without
having to lay the table out again or walk through `Fragment`s and
individually repair their background styles.

Testing: This doesn't change behavior and is thus tested by existing
WPT tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Martin Robinson 2025-05-07 13:44:59 +02:00 committed by GitHub
parent 68a76baea3
commit 348eede37b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 38 additions and 10 deletions

View file

@ -2063,7 +2063,7 @@ impl<'a> TableLayout<'a> {
let column_group = column_group.borrow();
let rect = make_relative_to_row_start(dimensions.get_column_group_rect(&column_group));
fragment.add_extra_background(ExtraBackground {
style: column_group.base.style.clone(),
style: column_group.shared_background_style.clone(),
rect,
})
}
@ -2072,7 +2072,7 @@ impl<'a> TableLayout<'a> {
if !column.is_anonymous {
let rect = make_relative_to_row_start(dimensions.get_column_rect(column_index));
fragment.add_extra_background(ExtraBackground {
style: column.base.style.clone(),
style: column.shared_background_style.clone(),
rect,
})
}
@ -2085,7 +2085,7 @@ impl<'a> TableLayout<'a> {
let rect =
make_relative_to_row_start(dimensions.get_row_group_rect(&row_group.borrow()));
fragment.add_extra_background(ExtraBackground {
style: row_group.borrow().base.style.clone(),
style: row_group.borrow().shared_background_style.clone(),
rect,
})
}
@ -2093,7 +2093,7 @@ impl<'a> TableLayout<'a> {
let row = row.borrow();
let rect = make_relative_to_row_start(row_fragment_layout.rect);
fragment.add_extra_background(ExtraBackground {
style: row.base.style.clone(),
style: row.shared_background_style.clone(),
rect,
})
}