Auto merge of #29655 - Loirooriol:text-decoration, r=mrobinson

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.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #29654

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2023-04-26 20:52:44 +02:00 committed by GitHub
commit 8d7b81b599
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 76 additions and 4 deletions

View file

@ -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 {

View file

@ -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<ArcRefCell<InlineLevelBox>>,
pub(super) text_decoration_line: TextDecorationLine,

View file

@ -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",
[]

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<title>CSS Test reference: text-decoration propagation</title>
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com" />
<link rel="help" href="https://www.w3.org/TR/css-text-decor-3/#line-decoration">
<style>
div { margin: 1em 0 }
</style>
<div style="text-decoration: underline">
lorem
</div>
<div style="text-decoration: underline overline">
ipsum
</div>
<div style="text-decoration: underline">
dolor
</div>
<div style="text-decoration: underline overline">
sit
</div>
<div style="text-decoration: underline overline line-through">
amet
</div>
<div style="text-decoration: underline overline">
consectetur
</div>
<div style="text-decoration: underline">
adipiscing
</div>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<title>CSS Test: text-decoration propagation</title>
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com" />
<link rel="help" href="https://www.w3.org/TR/css-text-decor-3/#line-decoration">
<link rel="help" href="https://github.com/servo/servo/issues/29654">
<link rel="match" href="reference/text-decoration-propagation-04-ref.html">
<style>
div { margin: 1em 0 }
</style>
<div style="text-decoration: underline">
lorem
<div style="text-decoration: overline">
ipsum
</div>
dolor
<div style="text-decoration: overline">
sit
<div style="text-decoration: line-through">
amet
</div>
consectetur
</div>
adipiscing
</span>