From 2692426103f2b61b8205f067481c2f9352e8369c Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Sat, 22 Apr 2023 19:09:17 +0200 Subject: [PATCH] Fix text-decoration for block containers in layout-2020 It was only applied to the 1st inline formatting context of a block container. Other IFCs were created with the Default trait, implying TextDecorationLine::NONE. --- components/layout_2020/flow/construct.rs | 9 ++++-- components/layout_2020/flow/inline.rs | 2 +- tests/wpt/metadata/MANIFEST.json | 17 +++++++++++ .../text-decoration-propagation-04-ref.html | 28 +++++++++++++++++++ .../text-decoration-propagation-04.html | 24 ++++++++++++++++ 5 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 tests/wpt/web-platform-tests/css/css-text-decor/reference/text-decoration-propagation-04-ref.html create mode 100644 tests/wpt/web-platform-tests/css/css-text-decor/text-decoration-propagation-04.html diff --git a/components/layout_2020/flow/construct.rs b/components/layout_2020/flow/construct.rs index 0afb9dfe410..8241f2a0357 100644 --- a/components/layout_2020/flow/construct.rs +++ b/components/layout_2020/flow/construct.rs @@ -712,10 +712,13 @@ where ) }); + let mut ifc = InlineFormattingContext::new( + self.ongoing_inline_formatting_context.text_decoration_line, + /* has_first_formatted_line = */ false, + ); + std::mem::swap(&mut self.ongoing_inline_formatting_context, &mut ifc); let kind = BlockLevelCreator::SameFormattingContextBlock( - IntermediateBlockContainer::InlineFormattingContext(std::mem::take( - &mut self.ongoing_inline_formatting_context, - )), + IntermediateBlockContainer::InlineFormattingContext(ifc), ); let info = self.info.new_replacing_style(anonymous_style.clone()); self.block_level_boxes.push(BlockLevelJob { diff --git a/components/layout_2020/flow/inline.rs b/components/layout_2020/flow/inline.rs index d58ddb82498..84fb22ae042 100644 --- a/components/layout_2020/flow/inline.rs +++ b/components/layout_2020/flow/inline.rs @@ -31,7 +31,7 @@ use style::values::specified::text::TextDecorationLine; use style::Zero; use webrender_api::FontInstanceKey; -#[derive(Debug, Default, Serialize)] +#[derive(Debug, Serialize)] pub(crate) struct InlineFormattingContext { pub(super) inline_level_boxes: Vec>, pub(super) text_decoration_line: TextDecorationLine, diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 216c1324769..919fb878d55 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -248862,6 +248862,19 @@ {} ] ], + "text-decoration-propagation-04.html": [ + "8c9bb9b7e72bcb261eac5840f024a5cdacdc7fe3", + [ + null, + [ + [ + "/css/css-text-decor/reference/text-decoration-propagation-04-ref.html", + "==" + ] + ], + {} + ] + ], "text-decoration-propagation-display-contents.html": [ "33d3593b668f0d81aee48441639324a0abe34756", [ @@ -398486,6 +398499,10 @@ "84ad43f88c30c503a38e7bedb913a4a0a34045f3", [] ], + "text-decoration-propagation-04-ref.html": [ + "7d359610c5518252856fa1051b51e84207994025", + [] + ], "text-decoration-propagation-display-contents-ref.html": [ "c8381c64fdaa22cfc4c52fd63d3da6b7cc6dd4bd", [] diff --git a/tests/wpt/web-platform-tests/css/css-text-decor/reference/text-decoration-propagation-04-ref.html b/tests/wpt/web-platform-tests/css/css-text-decor/reference/text-decoration-propagation-04-ref.html new file mode 100644 index 00000000000..7d359610c55 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-text-decor/reference/text-decoration-propagation-04-ref.html @@ -0,0 +1,28 @@ + +CSS Test reference: text-decoration propagation + + + +
+ lorem +
+
+ ipsum +
+
+ dolor +
+
+ sit +
+
+ amet +
+
+ consectetur +
+
+ adipiscing +
diff --git a/tests/wpt/web-platform-tests/css/css-text-decor/text-decoration-propagation-04.html b/tests/wpt/web-platform-tests/css/css-text-decor/text-decoration-propagation-04.html new file mode 100644 index 00000000000..8c9bb9b7e72 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-text-decor/text-decoration-propagation-04.html @@ -0,0 +1,24 @@ + +CSS Test: text-decoration propagation + + + + + +
+ lorem +
+ ipsum +
+ dolor +
+ sit +
+ amet +
+ consectetur +
+ adipiscing +