Changeset 295283 in webkit


Ignore:
Timestamp:
Jun 6, 2022 6:11:21 AM (2 years ago)
Author:
Alan Bujtas
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

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp

    r295276 r295283  
    5858LayoutUnit FlexFormattingContext::usedContentHeight() const
    5959{
    60     auto& lines = formattingState().lines();
    61     return LayoutUnit { lines.last().bottom() - lines.first().top() };
     60    auto contentTop = LayoutUnit::max();
     61    auto contentBottom = LayoutUnit::min();
     62    for (auto& flexItem : childrenOfType<Box>(root())) {
     63        auto marginBox = Layout::BoxGeometry::marginBoxRect(geometryForBox(flexItem));
     64        contentTop = std::min(contentTop, marginBox.top());
     65        contentBottom = std::max(contentBottom, marginBox.bottom());
     66    }
     67    return std::max(0_lu, contentBottom - contentTop);
    6268}
    6369
  • trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp

    r295051 r295283  
    172172LayoutUnit FlexLayout::contentLogicalHeight() const
    173173{
    174     return { };
     174    return Layout::FlexFormattingContext { rootLayoutBox(), m_flexFormattingState }.usedContentHeight();
    175175}
    176176
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r295275 r295283  
    23672367    }
    23682368    m_flexLayout->layout();
     2369    setLogicalHeight(std::max(logicalHeight(), borderBefore() + paddingBefore() + m_flexLayout->contentLogicalHeight() + borderAfter() + paddingAfter()));
     2370    updateLogicalHeight();
    23692371}
    23702372#endif
Note: See TracChangeset for help on using the changeset viewer.