Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions Libraries/LibWeb/Layout/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,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.
Expand All @@ -931,6 +940,8 @@ void NodeWithStyle::propagate_style_to_anonymous_wrappers()
if (child.is_anonymous() && !is<TableWrapper>(child)) {
auto& child_computed_values = static_cast<CSS::MutableComputedValues&>(static_cast<CSS::ComputedValues&>(const_cast<CSS::ImmutableComputedValues&>(child.computed_values())));
child_computed_values.inherit_from(computed_values());
propagate_non_inherit_values(child);
child.propagate_style_to_anonymous_wrappers();
}
return IterationDecision::Continue;
});
Expand Down Expand Up @@ -1010,13 +1021,7 @@ GC::Ref<NodeWithStyle> NodeWithStyle::create_anonymous_wrapper() const
{
auto wrapper = heap().allocate<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());

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()) {
Expand Down
1 change: 1 addition & 0 deletions Libraries/LibWeb/Layout/Node.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ class WEB_API NodeWithStyle : public Node {
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<CSS::ComputedValues> m_computed_values;
Expand Down
Loading