LibWeb: Make style containment influence quotes

This commit is contained in:
Psychpsyo 2025-02-06 17:07:12 +01:00 committed by Sam Atkins
commit 402d8220dd
Notes: github-actions[bot] 2025-02-06 17:45:51 +00:00
19 changed files with 380 additions and 0 deletions

View file

@ -573,6 +573,8 @@ void TreeBuilder::update_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
return false;
}();
auto prior_quote_nesting_level = m_quote_nesting_level;
if (should_create_layout_node)
update_layout_tree_before_children(dom_node, *layout_node, context, element_has_content_visibility_hidden);
@ -617,6 +619,14 @@ void TreeBuilder::update_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
restructure_block_node_in_inline_parent(static_cast<NodeWithStyleAndBoxModelMetrics&>(*layout_node));
}
// https://www.w3.org/TR/css-contain-2/#containment-style
// Giving an element style containment has the following effects:
// 2. The effects of the 'content' propertys 'open-quote', 'close-quote', 'no-open-quote' and 'no-close-quote' must
// be scoped to the elements sub-tree.
if (dom_node.is_element() && (static_cast<DOM::Element&>(dom_node)).has_style_containment()) {
m_quote_nesting_level = prior_quote_nesting_level;
}
dom_node.set_needs_layout_tree_update(false);
dom_node.set_child_needs_layout_tree_update(false);
}