Revert D4157971: [csslayout] BREAKING - Fix sizing of container with child overflowing parent

Differential Revision: D4157971

fbshipit-source-id: be055cf018fd39b3cee9af0bc777831fcf757190
This commit is contained in:
Fred Liu 2016-11-14 12:19:26 -08:00 committed by Facebook Github Bot
parent 07c5882a38
commit 1f125e3d41
2 changed files with 8 additions and 16 deletions

View File

@ -2092,27 +2092,23 @@ static void layoutNodeImpl(const CSSNodeRef node,
// If the user didn't specify a width or height for the node, set the // If the user didn't specify a width or height for the node, set the
// dimensions based on the children. // dimensions based on the children.
if (measureModeMainDim == CSSMeasureModeUndefined || if (measureModeMainDim == CSSMeasureModeUndefined) {
(node->style.overflow != CSSOverflowScroll && measureModeMainDim == CSSMeasureModeAtMost)) {
// Clamp the size to the min/max size, if specified, and make sure it // Clamp the size to the min/max size, if specified, and make sure it
// doesn't go below the padding and border amount. // doesn't go below the padding and border amount.
node->layout.measuredDimensions[dim[mainAxis]] = boundAxis(node, mainAxis, maxLineMainDim); node->layout.measuredDimensions[dim[mainAxis]] = boundAxis(node, mainAxis, maxLineMainDim);
} else if (node->style.overflow == CSSOverflowScroll && } else if (measureModeMainDim == CSSMeasureModeAtMost) {
measureModeMainDim == CSSMeasureModeAtMost) {
node->layout.measuredDimensions[dim[mainAxis]] = node->layout.measuredDimensions[dim[mainAxis]] =
fmaxf(fminf(availableInnerMainDim + paddingAndBorderAxisMain, fmaxf(fminf(availableInnerMainDim + paddingAndBorderAxisMain,
boundAxisWithinMinAndMax(node, mainAxis, maxLineMainDim)), boundAxisWithinMinAndMax(node, mainAxis, maxLineMainDim)),
paddingAndBorderAxisMain); paddingAndBorderAxisMain);
} }
if (measureModeCrossDim == CSSMeasureModeUndefined || if (measureModeCrossDim == CSSMeasureModeUndefined) {
(node->style.overflow != CSSOverflowScroll && measureModeCrossDim == CSSMeasureModeAtMost)) {
// Clamp the size to the min/max size, if specified, and make sure it // Clamp the size to the min/max size, if specified, and make sure it
// doesn't go below the padding and border amount. // doesn't go below the padding and border amount.
node->layout.measuredDimensions[dim[crossAxis]] = node->layout.measuredDimensions[dim[crossAxis]] =
boundAxis(node, crossAxis, totalLineCrossDim + paddingAndBorderAxisCross); boundAxis(node, crossAxis, totalLineCrossDim + paddingAndBorderAxisCross);
} else if (node->style.overflow == CSSOverflowScroll && } else if (measureModeCrossDim == CSSMeasureModeAtMost) {
measureModeCrossDim == CSSMeasureModeAtMost) {
node->layout.measuredDimensions[dim[crossAxis]] = node->layout.measuredDimensions[dim[crossAxis]] =
fmaxf(fminf(availableInnerCrossDim + paddingAndBorderAxisCross, fmaxf(fminf(availableInnerCrossDim + paddingAndBorderAxisCross,
boundAxisWithinMinAndMax(node, boundAxisWithinMinAndMax(node,

View File

@ -2092,27 +2092,23 @@ static void layoutNodeImpl(const CSSNodeRef node,
// If the user didn't specify a width or height for the node, set the // If the user didn't specify a width or height for the node, set the
// dimensions based on the children. // dimensions based on the children.
if (measureModeMainDim == CSSMeasureModeUndefined || if (measureModeMainDim == CSSMeasureModeUndefined) {
(node->style.overflow != CSSOverflowScroll && measureModeMainDim == CSSMeasureModeAtMost)) {
// Clamp the size to the min/max size, if specified, and make sure it // Clamp the size to the min/max size, if specified, and make sure it
// doesn't go below the padding and border amount. // doesn't go below the padding and border amount.
node->layout.measuredDimensions[dim[mainAxis]] = boundAxis(node, mainAxis, maxLineMainDim); node->layout.measuredDimensions[dim[mainAxis]] = boundAxis(node, mainAxis, maxLineMainDim);
} else if (node->style.overflow == CSSOverflowScroll && } else if (measureModeMainDim == CSSMeasureModeAtMost) {
measureModeMainDim == CSSMeasureModeAtMost) {
node->layout.measuredDimensions[dim[mainAxis]] = node->layout.measuredDimensions[dim[mainAxis]] =
fmaxf(fminf(availableInnerMainDim + paddingAndBorderAxisMain, fmaxf(fminf(availableInnerMainDim + paddingAndBorderAxisMain,
boundAxisWithinMinAndMax(node, mainAxis, maxLineMainDim)), boundAxisWithinMinAndMax(node, mainAxis, maxLineMainDim)),
paddingAndBorderAxisMain); paddingAndBorderAxisMain);
} }
if (measureModeCrossDim == CSSMeasureModeUndefined || if (measureModeCrossDim == CSSMeasureModeUndefined) {
(node->style.overflow != CSSOverflowScroll && measureModeCrossDim == CSSMeasureModeAtMost)) {
// Clamp the size to the min/max size, if specified, and make sure it // Clamp the size to the min/max size, if specified, and make sure it
// doesn't go below the padding and border amount. // doesn't go below the padding and border amount.
node->layout.measuredDimensions[dim[crossAxis]] = node->layout.measuredDimensions[dim[crossAxis]] =
boundAxis(node, crossAxis, totalLineCrossDim + paddingAndBorderAxisCross); boundAxis(node, crossAxis, totalLineCrossDim + paddingAndBorderAxisCross);
} else if (node->style.overflow == CSSOverflowScroll && } else if (measureModeCrossDim == CSSMeasureModeAtMost) {
measureModeCrossDim == CSSMeasureModeAtMost) {
node->layout.measuredDimensions[dim[crossAxis]] = node->layout.measuredDimensions[dim[crossAxis]] =
fmaxf(fminf(availableInnerCrossDim + paddingAndBorderAxisCross, fmaxf(fminf(availableInnerCrossDim + paddingAndBorderAxisCross,
boundAxisWithinMinAndMax(node, boundAxisWithinMinAndMax(node,