BREAKING - Change measure() api to remove need for MeasureOutput allocation

Reviewed By: splhack

Differential Revision: D4081037

fbshipit-source-id: 28adbcdd160cbd3f59a0fdd4b9f1200ae18678f1
This commit is contained in:
Emil Sjolander
2016-10-27 10:52:09 -07:00
committed by Facebook Github Bot
parent bafc6ddbd1
commit 553f4371e0
11 changed files with 55 additions and 50 deletions
@@ -560,22 +560,23 @@ public class LayoutEngine {
} else {
// Measure the text under the current constraints.
MeasureOutput measureDim = node.measure(
layoutContext.measureOutput,
long measureOutput = node.measure(
innerWidth,
widthMeasureMode,
innerHeight,
heightMeasureMode
);
int outputWidth = MeasureOutput.getWidth(measureOutput);
int outputHeight = MeasureOutput.getHeight(measureOutput);
node.layout.measuredDimensions[DIMENSION_WIDTH] = boundAxis(node, CSS_FLEX_DIRECTION_ROW,
(widthMeasureMode == CSSMeasureMode.UNDEFINED || widthMeasureMode == CSSMeasureMode.AT_MOST) ?
measureDim.width + paddingAndBorderAxisRow :
outputWidth + paddingAndBorderAxisRow :
availableWidth - marginAxisRow);
node.layout.measuredDimensions[DIMENSION_HEIGHT] = boundAxis(node, CSS_FLEX_DIRECTION_COLUMN,
(heightMeasureMode == CSSMeasureMode.UNDEFINED || heightMeasureMode == CSSMeasureMode.AT_MOST) ?
measureDim.height + paddingAndBorderAxisColumn :
outputHeight + paddingAndBorderAxisColumn :
availableHeight - marginAxisColumn);
}