summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorAliaksandr Kalenik <kalenik.aliaksandr@gmail.com>2022-11-15 22:17:27 +0300
committerAndreas Kling <kling@serenityos.org>2022-11-15 22:52:08 +0100
commitc1401b37c4bab2a9742594f96cbc6eaee48d7288 (patch)
treeb19657647f2c7616f1ae143b265ae1d8c647098b /Userland/Libraries
parent43c5b94ea6f51acb97db75526f83d982570ebdcb (diff)
downloadserenity-c1401b37c4bab2a9742594f96cbc6eaee48d7288.zip
LibWeb: Join out-of-flow block nodes in last parent child if possible
Join out-of-flow block nodes into last child of parent node if last child has inline children.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
index e4c7ceb04b..c0deb7af22 100644
--- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
@@ -83,13 +83,15 @@ static Layout::Node& insertion_parent_for_block_node(Layout::NodeWithStyle& layo
return layout_parent;
}
- if (!layout_parent.children_are_inline()) {
- // Parent block has block-level children, insert this block into parent.
- return layout_parent;
- }
-
if (layout_node.is_floating() || layout_node.is_absolutely_positioned()) {
// Block is out-of-flow, it can have inline siblings if necessary.
+ if (layout_parent.last_child()->children_are_inline()) {
+ return *layout_parent.last_child();
+ }
+ }
+
+ if (!layout_parent.children_are_inline()) {
+ // Parent block has block-level children, insert this block into parent.
return layout_parent;
}