Browse Source

LibWeb: Don't include abspos children in containing block's auto width

Andreas Kling 2 years ago
parent
commit
fb5879fdcc

+ 3 - 2
Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp

@@ -807,8 +807,9 @@ float BlockFormattingContext::greatest_child_width(Box const& box)
             max_width = max(max_width, width_here);
         }
     } else {
-        box.for_each_child_of_type<Box>([&](auto& child) {
-            max_width = max(max_width, m_state.get(child).border_box_width());
+        box.for_each_child_of_type<Box>([&](Box const& child) {
+            if (!child.is_absolutely_positioned())
+                max_width = max(max_width, m_state.get(child).border_box_width());
         });
     }
     return max_width;

+ 3 - 2
Userland/Libraries/LibWeb/Layout/FormattingContext.cpp

@@ -189,8 +189,9 @@ float FormattingContext::greatest_child_width(Box const& box)
             max_width = max(max_width, line_box.width());
         }
     } else {
-        box.for_each_child_of_type<Box>([&](auto& child) {
-            max_width = max(max_width, m_state.get(child).border_box_width());
+        box.for_each_child_of_type<Box>([&](Box const& child) {
+            if (!child.is_absolutely_positioned())
+                max_width = max(max_width, m_state.get(child).border_box_width());
         });
     }
     return max_width;