Small improvements for table border collapse (#33452)

We were only collapsing the borders from adjacent cells. This patch also
handles the borders from rows, row groups, columns, and column groups.
Additionally, it takes the border style into account in order to decide
which border wins.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2024-09-16 10:20:22 +02:00 committed by GitHub
parent 679afe5195
commit b12cebd1ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 130 additions and 33 deletions

View file

@ -16,7 +16,9 @@ use style::properties::ComputedValues;
use style::servo::selector_parser::PseudoElement;
use style::values::computed::basic_shape::ClipPath;
use style::values::computed::image::Image as ComputedImageLayer;
use style::values::computed::{AlignItems, LengthPercentage, NonNegativeLengthPercentage, Size};
use style::values::computed::{
AlignItems, BorderStyle, LengthPercentage, NonNegativeLengthPercentage, Size,
};
use style::values::generics::box_::Perspective;
use style::values::generics::length::MaxSize;
use style::values::generics::position::{GenericAspectRatio, PreferredRatio};
@ -250,6 +252,8 @@ pub(crate) trait ComputedValuesExt {
&self,
containing_block_writing_mode: WritingMode,
) -> LogicalSides<&LengthPercentage>;
fn border_style(&self, containing_block_writing_mode: WritingMode)
-> LogicalSides<BorderStyle>;
fn border_width(&self, containing_block_writing_mode: WritingMode) -> LogicalSides<Au>;
fn margin(
&self,
@ -553,6 +557,22 @@ impl ComputedValuesExt for ComputedValues {
)
}
fn border_style(
&self,
containing_block_writing_mode: WritingMode,
) -> LogicalSides<BorderStyle> {
let border = self.get_border();
LogicalSides::from_physical(
&PhysicalSides::new(
border.border_top_style,
border.border_right_style,
border.border_bottom_style,
border.border_left_style,
),
containing_block_writing_mode,
)
}
fn border_width(&self, containing_block_writing_mode: WritingMode) -> LogicalSides<Au> {
let border = self.get_border();
LogicalSides::from_physical(