Title: [295283] trunk/Source/WebCore
Revision
295283
Author
za...@apple.com
Date
2022-06-06 06:11:21 -0700 (Mon, 06 Jun 2022)

Log Message

Implement FlexFormattingContext::usedContentHeight
https://bugs.webkit.org/show_bug.cgi?id=241325

Reviewed by Antti Koivisto.

Update the RenderFlexibleBox's content height.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::usedContentHeight const):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::contentLogicalHeight const):
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutUsingFlexFormattingContext):

Canonical link: https://commits.webkit.org/251329@main

Modified Paths

Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (295282 => 295283)


--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-06-06 13:08:35 UTC (rev 295282)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-06-06 13:11:21 UTC (rev 295283)
@@ -57,8 +57,14 @@
 
 LayoutUnit FlexFormattingContext::usedContentHeight() const
 {
-    auto& lines = formattingState().lines();
-    return LayoutUnit { lines.last().bottom() - lines.first().top() };
+    auto contentTop = LayoutUnit::max();
+    auto contentBottom = LayoutUnit::min();
+    for (auto& flexItem : childrenOfType<Box>(root())) {
+        auto marginBox = Layout::BoxGeometry::marginBoxRect(geometryForBox(flexItem));
+        contentTop = std::min(contentTop, marginBox.top());
+        contentBottom = std::max(contentBottom, marginBox.bottom());
+    }
+    return std::max(0_lu, contentBottom - contentTop);
 }
 
 IntrinsicWidthConstraints FlexFormattingContext::computedIntrinsicWidthConstraints()

Modified: trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp (295282 => 295283)


--- trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-06-06 13:08:35 UTC (rev 295282)
+++ trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-06-06 13:11:21 UTC (rev 295283)
@@ -171,7 +171,7 @@
 
 LayoutUnit FlexLayout::contentLogicalHeight() const
 {
-    return { };
+    return Layout::FlexFormattingContext { rootLayoutBox(), m_flexFormattingState }.usedContentHeight();
 }
 
 }

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (295282 => 295283)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2022-06-06 13:08:35 UTC (rev 295282)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2022-06-06 13:11:21 UTC (rev 295283)
@@ -2366,6 +2366,8 @@
         m_flexLayout->updateFlexItemDimensions(flexItem, minMaxContentSize.first, minMaxContentSize.second);
     }
     m_flexLayout->layout();
+    setLogicalHeight(std::max(logicalHeight(), borderBefore() + paddingBefore() + m_flexLayout->contentLogicalHeight() + borderAfter() + paddingAfter()));
+    updateLogicalHeight();
 }
 #endif
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to