aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/style_ext.rs
diff options
context:
space:
mode:
authorOriol Brufau <obrufau@igalia.com>2024-09-16 10:20:22 +0200
committerGitHub <noreply@github.com>2024-09-16 08:20:22 +0000
commitb12cebd1ac3b2bc809e5ac69f708cf61b515590d (patch)
tree6fc8bae0f36ce8f267608cf76244689a280fe7a2 /components/layout_2020/style_ext.rs
parent679afe519591c3c36036154afb1e9b6d73ffa1ac (diff)
downloadservo-b12cebd1ac3b2bc809e5ac69f708cf61b515590d.tar.gz
servo-b12cebd1ac3b2bc809e5ac69f708cf61b515590d.zip
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>
Diffstat (limited to 'components/layout_2020/style_ext.rs')
-rw-r--r--components/layout_2020/style_ext.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/components/layout_2020/style_ext.rs b/components/layout_2020/style_ext.rs
index 53bf9e6df33..21283395789 100644
--- a/components/layout_2020/style_ext.rs
+++ b/components/layout_2020/style_ext.rs
@@ -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(