diff --git a/Libraries/LibWeb/Layout/Node.cpp b/Libraries/LibWeb/Layout/Node.cpp index 65937399899..89c87d41f5b 100644 --- a/Libraries/LibWeb/Layout/Node.cpp +++ b/Libraries/LibWeb/Layout/Node.cpp @@ -922,6 +922,15 @@ void NodeWithStyle::apply_style(CSS::ComputedProperties const& computed_style) box_node->propagate_style_along_continuation(computed_style); } +void NodeWithStyle::propagate_non_inherit_values(NodeWithStyle& target_node) const +{ + // NOTE: These properties are not inherited, but we still have to propagate them to anonymous wrappers. + target_node.mutable_computed_values().set_text_decoration_line(computed_values().text_decoration_line()); + target_node.mutable_computed_values().set_text_decoration_thickness(computed_values().text_decoration_thickness()); + target_node.mutable_computed_values().set_text_decoration_color(computed_values().text_decoration_color()); + target_node.mutable_computed_values().set_text_decoration_style(computed_values().text_decoration_style()); +} + void NodeWithStyle::propagate_style_to_anonymous_wrappers() { // Update the style of any anonymous wrappers that inherit from this node. @@ -940,6 +949,8 @@ void NodeWithStyle::propagate_style_to_anonymous_wrappers() if (child.is_anonymous() && !is(child)) { auto& child_computed_values = static_cast(static_cast(const_cast(child.computed_values()))); child_computed_values.inherit_from(computed_values()); + propagate_non_inherit_values(child); + child.propagate_style_to_anonymous_wrappers(); } return IterationDecision::Continue; }); @@ -1019,13 +1030,7 @@ GC::Ref NodeWithStyle::create_anonymous_wrapper() const { auto wrapper = heap().allocate(const_cast(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()); - + propagate_non_inherit_values(*wrapper); // CSS 2.2 9.2.1.1 creates anonymous block boxes, but 9.4.1 states inline-block creates a BFC. // Set wrapper to inline-block to participate correctly in the IFC within the parent inline-block. if (display().is_inline_block() && !has_children()) { diff --git a/Libraries/LibWeb/Layout/Node.h b/Libraries/LibWeb/Layout/Node.h index 0d105ca816c..55f4ed23b2f 100644 --- a/Libraries/LibWeb/Layout/Node.h +++ b/Libraries/LibWeb/Layout/Node.h @@ -271,6 +271,7 @@ private: virtual bool is_node_with_style() const final { return true; } void reset_table_box_computed_values_used_by_wrapper_to_init_values(); + void propagate_non_inherit_values(NodeWithStyle& target_node) const; void propagate_style_to_anonymous_wrappers(); NonnullOwnPtr m_computed_values; diff --git a/Tests/LibWeb/Ref/expected/button-hover-text-color-ref.html b/Tests/LibWeb/Ref/expected/button-hover-text-color-ref.html new file mode 100644 index 00000000000..79b486d3725 --- /dev/null +++ b/Tests/LibWeb/Ref/expected/button-hover-text-color-ref.html @@ -0,0 +1,8 @@ + + + diff --git a/Tests/LibWeb/Ref/input/button-hover-text-color.html b/Tests/LibWeb/Ref/input/button-hover-text-color.html new file mode 100644 index 00000000000..0ee8aa076e1 --- /dev/null +++ b/Tests/LibWeb/Ref/input/button-hover-text-color.html @@ -0,0 +1,16 @@ + + + + +