Not re-calculate value in Step1.
Summary: Not re-calculate `paddingAndBorderAxisMain`/`paddingAndBorderAxisCross`/`paddingAndBorderAxisRow`/`paddingAndBorderAxisColumn` in Step1 of `YGNodelayoutImpl`. They can be figure out by values calculated before. Closes https://github.com/facebook/yoga/pull/298 Reviewed By: dshahidehpour Differential Revision: D4365533 Pulled By: emilsjolander fbshipit-source-id: 6caf60bc6ef3addd49915b39b48f01a8b4926e9c
This commit is contained in:
parent
8680681a3d
commit
bc285de799
|
@ -1500,9 +1500,9 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||||
const YGMeasureMode measureModeMainDim = isMainAxisRow ? widthMeasureMode : heightMeasureMode;
|
const YGMeasureMode measureModeMainDim = isMainAxisRow ? widthMeasureMode : heightMeasureMode;
|
||||||
const YGMeasureMode measureModeCrossDim = isMainAxisRow ? heightMeasureMode : widthMeasureMode;
|
const YGMeasureMode measureModeCrossDim = isMainAxisRow ? heightMeasureMode : widthMeasureMode;
|
||||||
|
|
||||||
const float paddingAndBorderAxisRow = YGNodePaddingAndBorderForAxis(node, YGFlexDirectionRow);
|
const float paddingAndBorderAxisRow = isMainAxisRow ? paddingAndBorderAxisMain : paddingAndBorderAxisCross;
|
||||||
const float paddingAndBorderAxisColumn =
|
const float paddingAndBorderAxisColumn = isMainAxisRow ? paddingAndBorderAxisCross : paddingAndBorderAxisMain;
|
||||||
YGNodePaddingAndBorderForAxis(node, YGFlexDirectionColumn);
|
|
||||||
const float marginAxisRow = YGNodeMarginForAxis(node, YGFlexDirectionRow);
|
const float marginAxisRow = YGNodeMarginForAxis(node, YGFlexDirectionRow);
|
||||||
const float marginAxisColumn = YGNodeMarginForAxis(node, YGFlexDirectionColumn);
|
const float marginAxisColumn = YGNodeMarginForAxis(node, YGFlexDirectionColumn);
|
||||||
|
|
||||||
|
@ -1516,7 +1516,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||||
const float maxInnerHeight = node->style.maxDimensions[YGDimensionHeight] - marginAxisColumn - paddingAndBorderAxisColumn;
|
const float maxInnerHeight = node->style.maxDimensions[YGDimensionHeight] - marginAxisColumn - paddingAndBorderAxisColumn;
|
||||||
const float minInnerMainDim = isMainAxisRow ? minInnerWidth : minInnerHeight;
|
const float minInnerMainDim = isMainAxisRow ? minInnerWidth : minInnerHeight;
|
||||||
const float maxInnerMainDim = isMainAxisRow ? maxInnerWidth : maxInnerHeight;
|
const float maxInnerMainDim = isMainAxisRow ? maxInnerWidth : maxInnerHeight;
|
||||||
|
|
||||||
// Max dimension overrides predefined dimension value; Min dimension in turn overrides both of the above
|
// Max dimension overrides predefined dimension value; Min dimension in turn overrides both of the above
|
||||||
if (!YGValueIsUndefined(availableInnerWidth)) {
|
if (!YGValueIsUndefined(availableInnerWidth)) {
|
||||||
availableInnerWidth = fmaxf(fminf(availableInnerWidth, maxInnerWidth), minInnerWidth);
|
availableInnerWidth = fmaxf(fminf(availableInnerWidth, maxInnerWidth), minInnerWidth);
|
||||||
|
@ -1524,7 +1524,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||||
if (!YGValueIsUndefined(availableInnerHeight)) {
|
if (!YGValueIsUndefined(availableInnerHeight)) {
|
||||||
availableInnerHeight = fmaxf(fminf(availableInnerHeight, maxInnerHeight), minInnerHeight);
|
availableInnerHeight = fmaxf(fminf(availableInnerHeight, maxInnerHeight), minInnerHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
float availableInnerMainDim = isMainAxisRow ? availableInnerWidth : availableInnerHeight;
|
float availableInnerMainDim = isMainAxisRow ? availableInnerWidth : availableInnerHeight;
|
||||||
const float availableInnerCrossDim = isMainAxisRow ? availableInnerHeight : availableInnerWidth;
|
const float availableInnerCrossDim = isMainAxisRow ? availableInnerHeight : availableInnerWidth;
|
||||||
|
|
||||||
|
@ -1679,7 +1679,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||||
// Calculate the remaining available space that needs to be allocated.
|
// Calculate the remaining available space that needs to be allocated.
|
||||||
// If the main dimension size isn't known, it is computed based on
|
// If the main dimension size isn't known, it is computed based on
|
||||||
// the line length, so there's no more space left to distribute.
|
// the line length, so there's no more space left to distribute.
|
||||||
|
|
||||||
// We resolve main dimension to fit minimum and maximum values
|
// We resolve main dimension to fit minimum and maximum values
|
||||||
if (YGValueIsUndefined(availableInnerMainDim)) {
|
if (YGValueIsUndefined(availableInnerMainDim)) {
|
||||||
if (!YGValueIsUndefined(minInnerMainDim) &&
|
if (!YGValueIsUndefined(minInnerMainDim) &&
|
||||||
|
@ -1690,7 +1690,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||||
availableInnerMainDim = maxInnerMainDim;
|
availableInnerMainDim = maxInnerMainDim;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float remainingFreeSpace = 0;
|
float remainingFreeSpace = 0;
|
||||||
if (!YGValueIsUndefined(availableInnerMainDim)) {
|
if (!YGValueIsUndefined(availableInnerMainDim)) {
|
||||||
remainingFreeSpace = availableInnerMainDim - sizeConsumedOnCurrentLine;
|
remainingFreeSpace = availableInnerMainDim - sizeConsumedOnCurrentLine;
|
||||||
|
|
Loading…
Reference in New Issue