Selaa lähdekoodia

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. :^)
Andreas Kling 10 kuukautta sitten
vanhempi
commit
8a6c8a1c27

+ 10 - 0
Tests/LibWeb/Ref/reference/text-decoration-in-anonymous-wrapper-ref.html

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

+ 14 - 0
Tests/LibWeb/Ref/text-decoration-in-anonymous-wrapper.html

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

BIN
Tests/LibWeb/Screenshot/images/css-background-clip-text.png


+ 6 - 0
Userland/Libraries/LibWeb/Layout/Node.cpp

@@ -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;
 }