LibWeb: Propagate text-decoration-* properties to anonymous wrappers

Fixes an issue where old prices were not displayed with strike-through
text on the PlayStation store. :^)
This commit is contained in:
Andreas Kling 2024-09-03 11:08:46 +02:00 committed by Andreas Kling
parent 415ea4ec0c
commit 8a6c8a1c27
Notes: github-actions[bot] 2024-09-03 15:41:51 +00:00
4 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,10 @@
<!doctype html>
<link rel="match" href="reference/text-decoration-in-anonymous-wrapper-ref.html" />
<style type="text/css">
.strike {
text-decoration-line: line-through;
text-decoration-color: red;
text-decoration-thickness: 4px;
text-decoration-style: dotted;
}
</style><div class="strike">strike

View file

@ -0,0 +1,14 @@
<!doctype html>
<link rel="match" href="reference/text-decoration-in-anonymous-wrapper-ref.html" />
<style type="text/css">
.strike {
text-decoration-line: line-through;
text-decoration-color: red;
text-decoration-thickness: 4px;
text-decoration-style: dotted;
}
.messer-upper {
width: 0;
height: 0;
}
</style><div class="strike">strike<div class="messer-upper"></div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 KiB

After

Width:  |  Height:  |  Size: 234 KiB

View file

@ -975,6 +975,12 @@ JS::NonnullGCPtr<NodeWithStyle> NodeWithStyle::create_anonymous_wrapper() const
{
auto wrapper = heap().allocate_without_realm<BlockContainer>(const_cast<DOM::Document&>(document()), nullptr, computed_values().clone_inherited_values());
wrapper->mutable_computed_values().set_display(CSS::Display(CSS::DisplayOutside::Block, CSS::DisplayInside::Flow));
// NOTE: These properties are not inherited, but we still have to propagate them to anonymous wrappers.
wrapper->mutable_computed_values().set_text_decoration_line(computed_values().text_decoration_line());
wrapper->mutable_computed_values().set_text_decoration_thickness(computed_values().text_decoration_thickness());
wrapper->mutable_computed_values().set_text_decoration_color(computed_values().text_decoration_color());
wrapper->mutable_computed_values().set_text_decoration_style(computed_values().text_decoration_style());
return *wrapper;
}