Skip to content

Commit b9c49c9

Browse files
committed
[blocks-in-inline] Fix fast/block/margin-collapse/block-inside-inline/002.html, -003.html and -004.html
https://bugs.webkit.org/show_bug.cgi?id=303840 Reviewed by Antti Koivisto. Account for margin in inline direction when computing the min/max widths for block level boxes inside inline content. * Source/WebCore/rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const): Canonical link: https://commits.webkit.org/304170@main
1 parent c0c0625 commit b9c49c9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Source/WebCore/rendering/RenderBlockFlow.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4782,8 +4782,14 @@ void RenderBlockFlow::computeInlinePreferredLogicalWidths(LayoutUnit& minLogical
47824782
auto blocMaxWidth = LayoutUnit { };
47834783
computeChildPreferredLogicalWidths(downcast<RenderBox>(*child), blockMinWidth, blocMaxWidth);
47844784

4785-
minLogicalWidth = std::max(minLogicalWidth, blockMinWidth);
4786-
maxLogicalWidth = std::max(maxLogicalWidth, blocMaxWidth);
4785+
auto marginsInInlineDirection = LayoutUnit { };
4786+
if (auto fixedMarginStart = child->style().marginStart(writingMode()).tryFixed())
4787+
marginsInInlineDirection += LayoutUnit::fromFloatCeil(fixedMarginStart->resolveZoom(child->style().usedZoomForLength()));
4788+
if (auto fixedMarginEnd = child->style().marginEnd(writingMode()).tryFixed())
4789+
marginsInInlineDirection += LayoutUnit::fromFloatCeil(fixedMarginEnd->resolveZoom(child->style().usedZoomForLength()));
4790+
4791+
minLogicalWidth = std::max(minLogicalWidth, blockMinWidth + marginsInInlineDirection);
4792+
maxLogicalWidth = std::max(maxLogicalWidth, blocMaxWidth + marginsInInlineDirection);
47874793
continue;
47884794
}
47894795

0 commit comments

Comments
 (0)