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 @@ -456,6 +456,27 @@ static void computeFlexBasisForChild(
child->getLayout().measuredDimension(dimension(mainAxis)),
paddingAndBorderForAxis(child, mainAxis, direction, ownerWidth))));
}

// A container sized by its content counts each item's max-content
// contribution: its content size, capped by a flex basis that is a length if
// the item cannot grow and floored by it if the item cannot shrink
// (css-flexbox-1 §9.9.3). Yoga does not flex the items of such a container,
// so the contribution is also the item's flex base size.
if (yoga::isUndefined(mainAxisSize) && child->processFlexBasis().isPoints() &&
child->getConfig()->isExperimentalFeatureEnabled(
ExperimentalFeature::WebFlexBasis)) {
const float flexBasis = yoga::maxOrDefined(
resolvedFlexBasis.unwrap(),
paddingAndBorderForAxis(child, mainAxis, direction, ownerWidth));
float flexBaseSize = child->getLayout().computedFlexBasis.unwrap();
if (child->resolveFlexGrow() == 0) {
flexBaseSize = yoga::minOrDefined(flexBaseSize, flexBasis);
}
if (child->resolveFlexShrink() == 0) {
flexBaseSize = yoga::maxOrDefined(flexBaseSize, flexBasis);
}
child->setLayoutComputedFlexBasis(FloatOptional(flexBaseSize));
}
child->setLayoutComputedFlexBasisGeneration(generationCount);
}

Expand Down
Loading