Skip to content

Commit

Permalink
RenderBlockFlows with no children should not even try to run inline l…
Browse files Browse the repository at this point in the history
…ayout

https://bugs.webkit.org/show_bug.cgi?id=254391

Reviewed by Antti Koivisto.

1. RenderBlockFlow's initial state is m_childrenInline = true
2. m_childrenInline is set to true when the block ends up with no children.
3. childrenInline() makes RenderBlockFlow run inline layout.

Initiating layout (IFC or BFC) does not make much sense when there's nothing to run layout on.

* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutInlineChildren): RenderSVGText calls layoutInlineChildren with no children :|

Canonical link: https://commits.webkit.org/262077@main
  • Loading branch information
alanbaradlay committed Mar 24, 2023
1 parent 46d8589 commit 2c9b833
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Source/WebCore/rendering/RenderBlockFlow.cpp
Expand Up @@ -741,6 +741,18 @@ void LeadingTrimmer::adjustLeadingTrimAfterLayout()

void RenderBlockFlow::layoutInFlowChildren(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom, LayoutUnit& maxFloatLogicalBottom)
{
if (!firstChild()) {
auto logicalHeight = borderAndPaddingBefore() + borderAndPaddingAfter() + scrollbarLogicalHeight();
if (hasLineIfEmpty())
logicalHeight += lineHeight(true, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
setLogicalHeight(logicalHeight);

repaintLogicalTop = { };
repaintLogicalBottom = { };
maxFloatLogicalBottom = { };
return;
}

if (childrenInline()) {
auto leadingTrimmer = LeadingTrimmer { *this, this };
layoutInlineChildren(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
Expand Down Expand Up @@ -773,6 +785,8 @@ void RenderBlockFlow::layoutInFlowChildren(bool relayoutChildren, LayoutUnit& re

void RenderBlockFlow::layoutBlockChildren(bool relayoutChildren, LayoutUnit& maxFloatLogicalBottom)
{
ASSERT(firstChild());

LayoutUnit beforeEdge = borderAndPaddingBefore();
LayoutUnit afterEdge = borderAndPaddingAfter() + scrollbarLogicalHeight();

Expand Down

0 comments on commit 2c9b833

Please sign in to comment.