mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
LibWeb: Add support for "display: contents"
This change makes tree builder omit elements with "display: contents" from the layout tree during construction. Their child elements are instead directly appended to the parent element in layout tree.
This commit is contained in:
parent
b91af3c6a0
commit
0e8a0a8191
Notes:
sideshowbarker
2024-07-17 01:46:43 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 0e8a0a8191
Pull-request: https://github.com/SerenityOS/serenity/pull/20230
5 changed files with 31 additions and 3 deletions
|
@ -129,6 +129,9 @@ static Layout::Node& insertion_parent_for_block_node(Layout::NodeWithStyle& layo
|
|||
|
||||
void TreeBuilder::insert_node_into_inline_or_block_ancestor(Layout::Node& node, CSS::Display display, AppendOrPrepend mode)
|
||||
{
|
||||
if (node.display().is_contents())
|
||||
return;
|
||||
|
||||
if (display.is_inline_outside()) {
|
||||
// Inlines can be inserted into the nearest ancestor.
|
||||
auto& insertion_point = insertion_parent_for_inline_node(m_ancestor_stack.last());
|
||||
|
@ -141,6 +144,8 @@ void TreeBuilder::insert_node_into_inline_or_block_ancestor(Layout::Node& node,
|
|||
// Non-inlines can't be inserted into an inline parent, so find the nearest non-inline ancestor.
|
||||
auto& nearest_non_inline_ancestor = [&]() -> Layout::NodeWithStyle& {
|
||||
for (auto& ancestor : m_ancestor_stack.in_reverse()) {
|
||||
if (ancestor->display().is_contents())
|
||||
continue;
|
||||
if (!ancestor->display().is_inline_outside())
|
||||
return ancestor;
|
||||
if (!ancestor->display().is_flow_inside())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue