Pass layout marker data along
Summary: pubic Passes layout marker data through the recursive calls of the layout algorithm, in order to allow for collecting metrics. Reviewed By: SidharthGuglani Differential Revision: D13819444 fbshipit-source-id: cdca04964fba6a03ca3eeaca4d169107019ba457
This commit is contained in:
committed by
Facebook Github Bot
parent
74dd627495
commit
b4b009c2d8
@@ -1021,7 +1021,8 @@ bool YGLayoutNodeInternal(
|
||||
const float ownerHeight,
|
||||
const bool performLayout,
|
||||
const char* reason,
|
||||
const YGConfigRef config);
|
||||
const YGConfigRef config,
|
||||
YGMarkerLayoutData& layoutMarkerData);
|
||||
|
||||
static void YGNodePrintInternal(
|
||||
const YGNodeRef node,
|
||||
@@ -1260,7 +1261,8 @@ static void YGNodeComputeFlexBasisForChild(
|
||||
const float ownerHeight,
|
||||
const YGMeasureMode heightMode,
|
||||
const YGDirection direction,
|
||||
const YGConfigRef config) {
|
||||
const YGConfigRef config,
|
||||
YGMarkerLayoutData& layoutMarkerData) {
|
||||
const YGFlexDirection mainAxis =
|
||||
YGResolveFlexDirection(node->getStyle().flexDirection, direction);
|
||||
const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis);
|
||||
@@ -1433,7 +1435,8 @@ static void YGNodeComputeFlexBasisForChild(
|
||||
ownerHeight,
|
||||
false,
|
||||
"measure",
|
||||
config);
|
||||
config,
|
||||
layoutMarkerData);
|
||||
|
||||
child->setLayoutComputedFlexBasis(YGFloatOptional(YGFloatMax(
|
||||
child->getLayout().measuredDimensions[dim[mainAxis]],
|
||||
@@ -1449,7 +1452,8 @@ static void YGNodeAbsoluteLayoutChild(
|
||||
const YGMeasureMode widthMode,
|
||||
const float height,
|
||||
const YGDirection direction,
|
||||
const YGConfigRef config) {
|
||||
const YGConfigRef config,
|
||||
YGMarkerLayoutData& layoutMarkerData) {
|
||||
const YGFlexDirection mainAxis =
|
||||
YGResolveFlexDirection(node->getStyle().flexDirection, direction);
|
||||
const YGFlexDirection crossAxis = YGFlexDirectionCross(mainAxis, direction);
|
||||
@@ -1553,7 +1557,8 @@ static void YGNodeAbsoluteLayoutChild(
|
||||
childHeight,
|
||||
false,
|
||||
"abs-measure",
|
||||
config);
|
||||
config,
|
||||
layoutMarkerData);
|
||||
childWidth = child->getLayout().measuredDimensions[YGDimensionWidth] +
|
||||
child->getMarginForAxis(YGFlexDirectionRow, width).unwrap();
|
||||
childHeight = child->getLayout().measuredDimensions[YGDimensionHeight] +
|
||||
@@ -1571,7 +1576,8 @@ static void YGNodeAbsoluteLayoutChild(
|
||||
childHeight,
|
||||
true,
|
||||
"abs-layout",
|
||||
config);
|
||||
config,
|
||||
layoutMarkerData);
|
||||
|
||||
if (child->isTrailingPosDefined(mainAxis) &&
|
||||
!child->isLeadingPositionDefined(mainAxis)) {
|
||||
@@ -1867,7 +1873,8 @@ static float YGNodeComputeFlexBasisForChildren(
|
||||
YGDirection direction,
|
||||
YGFlexDirection mainAxis,
|
||||
const YGConfigRef config,
|
||||
bool performLayout) {
|
||||
bool performLayout,
|
||||
YGMarkerLayoutData& layoutMarkerData) {
|
||||
float totalOuterFlexBasis = 0.0f;
|
||||
YGNodeRef singleFlexChild = nullptr;
|
||||
YGVector children = node->getChildren();
|
||||
@@ -1931,7 +1938,8 @@ static float YGNodeComputeFlexBasisForChildren(
|
||||
availableInnerHeight,
|
||||
heightMeasureMode,
|
||||
direction,
|
||||
config);
|
||||
config,
|
||||
layoutMarkerData);
|
||||
}
|
||||
|
||||
totalOuterFlexBasis +=
|
||||
@@ -2043,7 +2051,8 @@ static float YGDistributeFreeSpaceSecondPass(
|
||||
const bool flexBasisOverflows,
|
||||
const YGMeasureMode measureModeCrossDim,
|
||||
const bool performLayout,
|
||||
const YGConfigRef config) {
|
||||
const YGConfigRef config,
|
||||
YGMarkerLayoutData& layoutMarkerData) {
|
||||
float childFlexBasis = 0;
|
||||
float flexShrinkScaledFactor = 0;
|
||||
float flexGrowFactor = 0;
|
||||
@@ -2207,7 +2216,8 @@ static float YGDistributeFreeSpaceSecondPass(
|
||||
availableInnerHeight,
|
||||
performLayout && !requiresStretchLayout,
|
||||
"flex",
|
||||
config);
|
||||
config,
|
||||
layoutMarkerData);
|
||||
node->setLayoutHadOverflow(
|
||||
node->getLayout().hadOverflow |
|
||||
currentRelativeChild->getLayout().hadOverflow);
|
||||
@@ -2336,7 +2346,8 @@ static void YGResolveFlexibleLength(
|
||||
const bool flexBasisOverflows,
|
||||
const YGMeasureMode measureModeCrossDim,
|
||||
const bool performLayout,
|
||||
const YGConfigRef config) {
|
||||
const YGConfigRef config,
|
||||
YGMarkerLayoutData& layoutMarkerData) {
|
||||
const float originalFreeSpace = collectedFlexItemsValues.remainingFreeSpace;
|
||||
// First pass: detect the flex items whose min/max constraints trigger
|
||||
YGDistributeFreeSpaceFirstPass(
|
||||
@@ -2360,7 +2371,8 @@ static void YGResolveFlexibleLength(
|
||||
flexBasisOverflows,
|
||||
measureModeCrossDim,
|
||||
performLayout,
|
||||
config);
|
||||
config,
|
||||
layoutMarkerData);
|
||||
|
||||
collectedFlexItemsValues.remainingFreeSpace =
|
||||
originalFreeSpace - distributedFreeSpace;
|
||||
@@ -2656,7 +2668,8 @@ static void YGNodelayoutImpl(
|
||||
const float ownerWidth,
|
||||
const float ownerHeight,
|
||||
const bool performLayout,
|
||||
const YGConfigRef config) {
|
||||
const YGConfigRef config,
|
||||
YGMarkerLayoutData& layoutMarkerData) {
|
||||
YGAssertWithNode(
|
||||
node,
|
||||
YGFloatIsUndefined(availableWidth)
|
||||
@@ -2837,7 +2850,8 @@ static void YGNodelayoutImpl(
|
||||
direction,
|
||||
mainAxis,
|
||||
config,
|
||||
performLayout);
|
||||
performLayout,
|
||||
layoutMarkerData);
|
||||
|
||||
const bool flexBasisOverflows = measureModeMainDim == YGMeasureModeUndefined
|
||||
? false
|
||||
@@ -2943,7 +2957,8 @@ static void YGNodelayoutImpl(
|
||||
flexBasisOverflows,
|
||||
measureModeCrossDim,
|
||||
performLayout,
|
||||
config);
|
||||
config,
|
||||
layoutMarkerData);
|
||||
}
|
||||
|
||||
node->setLayoutHadOverflow(
|
||||
@@ -3108,7 +3123,8 @@ static void YGNodelayoutImpl(
|
||||
availableInnerHeight,
|
||||
true,
|
||||
"stretch",
|
||||
config);
|
||||
config,
|
||||
layoutMarkerData);
|
||||
}
|
||||
} else {
|
||||
const float remainingCrossDim = containerCrossAxis -
|
||||
@@ -3314,7 +3330,8 @@ static void YGNodelayoutImpl(
|
||||
availableInnerHeight,
|
||||
true,
|
||||
"multiline-stretch",
|
||||
config);
|
||||
config,
|
||||
layoutMarkerData);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -3451,7 +3468,8 @@ static void YGNodelayoutImpl(
|
||||
isMainAxisRow ? measureModeMainDim : measureModeCrossDim,
|
||||
availableInnerHeight,
|
||||
direction,
|
||||
config);
|
||||
config,
|
||||
layoutMarkerData);
|
||||
}
|
||||
|
||||
// STEP 11: SETTING TRAILING POSITIONS FOR CHILDREN
|
||||
@@ -3683,7 +3701,8 @@ bool YGLayoutNodeInternal(
|
||||
const float ownerHeight,
|
||||
const bool performLayout,
|
||||
const char* reason,
|
||||
const YGConfigRef config) {
|
||||
const YGConfigRef config,
|
||||
YGMarkerLayoutData& layoutMarkerData) {
|
||||
YGLayout* layout = &node->getLayout();
|
||||
|
||||
gDepth++;
|
||||
@@ -3837,7 +3856,8 @@ bool YGLayoutNodeInternal(
|
||||
ownerWidth,
|
||||
ownerHeight,
|
||||
performLayout,
|
||||
config);
|
||||
config,
|
||||
layoutMarkerData);
|
||||
|
||||
if (gPrintChanges) {
|
||||
YGLog(
|
||||
@@ -4067,7 +4087,8 @@ void YGNodeCalculateLayout(
|
||||
ownerHeight,
|
||||
true,
|
||||
"initial",
|
||||
node->getConfig())) {
|
||||
node->getConfig(),
|
||||
marker.data)) {
|
||||
node->setPosition(
|
||||
node->getLayout().direction, ownerWidth, ownerHeight, ownerWidth);
|
||||
YGRoundToPixelGrid(node, node->getConfig()->pointScaleFactor, 0.0f, 0.0f);
|
||||
@@ -4097,6 +4118,7 @@ void YGNodeCalculateLayout(
|
||||
gCurrentGenerationCount++;
|
||||
// Rerun the layout, and calculate the diff
|
||||
originalNode->setAndPropogateUseLegacyFlag(false);
|
||||
YGMarkerLayoutData layoutMarkerData;
|
||||
if (YGLayoutNodeInternal(
|
||||
originalNode,
|
||||
width,
|
||||
@@ -4108,7 +4130,8 @@ void YGNodeCalculateLayout(
|
||||
ownerHeight,
|
||||
true,
|
||||
"initial",
|
||||
originalNode->getConfig())) {
|
||||
originalNode->getConfig(),
|
||||
layoutMarkerData)) {
|
||||
originalNode->setPosition(
|
||||
originalNode->getLayout().direction,
|
||||
ownerWidth,
|
||||
|
Reference in New Issue
Block a user