mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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:
parent
68a76baea3
commit
348eede37b
5 changed files with 38 additions and 10 deletions
|
@ -85,7 +85,7 @@ use super::flow::BlockFormattingContext;
|
|||
use crate::cell::ArcRefCell;
|
||||
use crate::flow::BlockContainer;
|
||||
use crate::formatting_contexts::IndependentFormattingContext;
|
||||
use crate::fragment_tree::{BaseFragmentInfo, Fragment};
|
||||
use crate::fragment_tree::{BaseFragmentInfo, Fragment, SharedBackgroundStyle};
|
||||
use crate::geom::PhysicalVec;
|
||||
use crate::layout_box_base::LayoutBoxBase;
|
||||
use crate::style_ext::BorderStyleColor;
|
||||
|
@ -288,6 +288,11 @@ pub struct TableTrack {
|
|||
/// Whether or not this [`TableTrack`] was anonymous, for instance created due to
|
||||
/// a `span` attribute set on a parent `<colgroup>`.
|
||||
is_anonymous: bool,
|
||||
|
||||
/// A shared container for this track's style, used to share the style for the purposes
|
||||
/// of drawing backgrounds in individual cells. This allows updating the style in a
|
||||
/// single place and having it affect all cell `Fragment`s.
|
||||
shared_background_style: SharedBackgroundStyle,
|
||||
}
|
||||
|
||||
#[derive(Debug, MallocSizeOf, PartialEq)]
|
||||
|
@ -308,6 +313,11 @@ pub struct TableTrackGroup {
|
|||
|
||||
/// The range of tracks in this [`TableTrackGroup`].
|
||||
track_range: Range<usize>,
|
||||
|
||||
/// A shared container for this track's style, used to share the style for the purposes
|
||||
/// of drawing backgrounds in individual cells. This allows updating the style in a
|
||||
/// single place and having it affect all cell `Fragment`s.
|
||||
shared_background_style: SharedBackgroundStyle,
|
||||
}
|
||||
|
||||
impl TableTrackGroup {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue