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 @@ -2018,7 +2018,8 @@ static void justifyMainAxis(
flexLine.layout.mainDim +=
child->dimensionWithMargin(mainAxis, availableInnerWidth);

if (isNodeBaselineLayout) {
if (isNodeBaselineLayout &&
resolveChildAlignment(node, child) == Align::Baseline) {
// If the child is baseline aligned then the cross dimension is
// calculated by adding maxAscent and maxDescent from the baseline.
const float ascent = calculateBaseline(child) +
Expand All @@ -2037,7 +2038,7 @@ static void justifyMainAxis(
} else {
// The cross dimension is the max of the elements dimension since
// there can only be one element in that cross dimension in the case
// when the items are not baseline aligned
// when the item is not baseline aligned
flexLine.layout.crossDim = yoga::maxOrDefined(
flexLine.layout.crossDim,
child->dimensionWithMargin(crossAxis, availableInnerWidth));
Expand All @@ -2047,8 +2048,11 @@ static void justifyMainAxis(
flexLine.layout.mainDim += trailingPaddingAndBorderMain;

if (isNodeBaselineLayout) {
flexLine.layout.crossDim =
maxAscentForCurrentLine + maxDescentForCurrentLine;
// The line fits both its baseline-aligned items, placed on their shared
// baseline, and its largest other item (css-flexbox-1 §9.4, step 8).
flexLine.layout.crossDim = yoga::maxOrDefined(
flexLine.layout.crossDim,
maxAscentForCurrentLine + maxDescentForCurrentLine);
}
}

Expand Down
Loading