Skip to content
Permalink
Browse files

create two layout pass reason flexLayout and flexMeasure instead of flex

Summary:
We had flex as a reason for both layout and measure. Now creating separating reason flexLayout and flexMeasure in this diff.

Also changed ordering of items in Enum to group layout and measure reasons

Reviewed By: davidaurelio

Differential Revision: D16562350

fbshipit-source-id: 75501f9d4dde0974009193b3991a8acc97b02ad0
  • Loading branch information...
SidharthGuglani authored and facebook-github-bot committed Jul 31, 2019
1 parent 678d5f7 commit 6ce985463b2724451baed8b0486b298f969e36e7
@@ -8,12 +8,13 @@

public enum LayoutPassReason {
INITIAL(0),
MEASURE(1),
ABS_MEASURE(2),
FLEX(3),
ABS_LAYOUT(4),
STRETCH(5),
MULTILINE_STRETCH(6);
ABS_LAYOUT(1),
STRETCH(2),
MULTILINE_STRETCH(3),
FLEX_LAYOUT(4),
MEASURE(5),
ABS_MEASURE(6),
FLEX_MEASURE(7);

private final int mIntValue;

@@ -28,12 +29,13 @@ public int intValue() {
public static LayoutPassReason fromInt(int value) {
switch (value) {
case 0: return INITIAL;
case 1: return MEASURE;
case 2: return ABS_MEASURE;
case 3: return FLEX;
case 4: return ABS_LAYOUT;
case 5: return STRETCH;
case 6: return MULTILINE_STRETCH;
case 1: return ABS_LAYOUT;
case 2: return STRETCH;
case 3: return MULTILINE_STRETCH;
case 4: return FLEX_LAYOUT;
case 5: return MEASURE;
case 6: return ABS_MEASURE;
case 7: return FLEX_MEASURE;
default: throw new IllegalArgumentException("Unknown enum value: " + value);
}
}
@@ -2185,6 +2185,7 @@ static float YGDistributeFreeSpaceSecondPass(
const YGMeasureMode childHeightMeasureMode =
!isMainAxisRow ? childMainMeasureMode : childCrossMeasureMode;

const bool isLayoutPass = performLayout && !requiresStretchLayout;
// Recursively call the layout algorithm for this child with the updated
// main size.
YGLayoutNodeInternal(
@@ -2196,8 +2197,9 @@ static float YGDistributeFreeSpaceSecondPass(
childHeightMeasureMode,
availableInnerWidth,
availableInnerHeight,
performLayout && !requiresStretchLayout,
LayoutPassReason::kFlex,
isLayoutPass,
isLayoutPass ? LayoutPassReason::kFlexLayout
: LayoutPassReason::kFlexMeasure,
config,
layoutMarkerData,
layoutContext,
@@ -16,18 +16,20 @@ const char* LayoutPassReasonToString(const LayoutPassReason value) {
switch (value) {
case LayoutPassReason::kInitial:
return "initial";
case LayoutPassReason::kMeasureChild:
return "measure";
case LayoutPassReason::kAbsMeasureChild:
return "abs_measure";
case LayoutPassReason::kFlex:
return "flex";
case LayoutPassReason::kAbsLayout:
return "abs_layout";
case LayoutPassReason::kStretch:
return "stretch";
case LayoutPassReason::kMultilineStretch:
return "multiline_stretch";
case LayoutPassReason::kFlexLayout:
return "flex_layout";
case LayoutPassReason::kMeasureChild:
return "measure";
case LayoutPassReason::kAbsMeasureChild:
return "abs_measure";
case LayoutPassReason::kFlexMeasure:
return "flex_measure";
default:
return "unknown";
}
@@ -34,12 +34,13 @@ struct LayoutData {

enum struct LayoutPassReason : int {
kInitial = 0,
kMeasureChild = 1,
kAbsMeasureChild = 2,
kFlex = 3,
kAbsLayout = 4,
kStretch = 5,
kMultilineStretch = 6
kAbsLayout = 1,
kStretch = 2,
kMultilineStretch = 3,
kFlexLayout = 4,
kMeasureChild = 5,
kAbsMeasureChild = 6,
kFlexMeasure = 7
};

const char* LayoutPassReasonToString(const LayoutPassReason value);

0 comments on commit 6ce9854

Please sign in to comment.
You can’t perform that action at this time.