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

@ -17,6 +17,7 @@ use style::properties::ComputedValues;
use style::values::specified::box_::DisplayOutside;
use super::{BaseFragment, BaseFragmentInfo, CollapsedBlockMargins, Fragment};
use crate::ArcRefCell;
use crate::display_list::ToWebRender;
use crate::formatting_contexts::Baselines;
use crate::geom::{
@ -40,10 +41,14 @@ pub(crate) enum BackgroundMode {
Normal,
}
#[derive(Debug, MallocSizeOf)]
pub(crate) struct BackgroundStyle(#[conditional_malloc_size_of] pub ServoArc<ComputedValues>);
pub(crate) type SharedBackgroundStyle = ArcRefCell<BackgroundStyle>;
#[derive(MallocSizeOf)]
pub(crate) struct ExtraBackground {
#[conditional_malloc_size_of]
pub style: ServoArc<ComputedValues>,
pub style: SharedBackgroundStyle,
pub rect: PhysicalRect<Au>,
}