Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,7 @@ static MinContentSize measureOrWalkMinContentMainSize(
const bool alongMainAxis = isRow(node->style().flexDirection()) == wantRow;

float minContent = 0.0f;
size_t itemCount = 0;
bool resolvesAgainstOwnerWidth = node->style().hasPercentPadding();

for (size_t i = 0; i < node->getChildCount(); i++) {
Expand All @@ -1039,6 +1040,7 @@ static MinContentSize measureOrWalkMinContentMainSize(
childStyle.positionType() == PositionType::Absolute) {
continue;
}
itemCount++;

const MinContentSize child = computeChildMinContentContribution(
node,
Expand All @@ -1056,6 +1058,13 @@ static MinContentSize measureOrWalkMinContentMainSize(
child.resolvesAgainstOwnerWidth || childStyle.hasPercentMargin();
}

// A percentage gap resolves against the size being found, so it counts as
// zero (css-sizing-3 §5.2.1).
if (alongMainAxis && itemCount > 1) {
minContent += node->style().computeGapForAxis(requestedAxis, 0.0f) *
static_cast<float>(itemCount - 1);
}

minContent += node->style().computeFlexStartPaddingAndBorder(
requestedAxis, direction, ownerWidth) +
node->style().computeFlexEndPaddingAndBorder(
Expand Down Expand Up @@ -1181,8 +1190,9 @@ static MinContentSize computeChildMinContentContribution(
// * Container: iterate in-flow children. For each, take its
// min-content contribution along `requestedAxis` plus its margins:
// the sum of them where that is the container's main axis, the
// largest where it is its cross axis. Add the container's own
// padding and border on both ends of the axis.
// largest where it is its cross axis. Add the gaps between them
// along the main axis, and the container's own padding and border
// on both ends of the axis.
//
// Container-level recursion does no layout writes (no positions, no
// alignment, no flex distribution); only the descendant leaf measure
Expand Down
Loading