Skip to content

Commit

Permalink
Remove YGExperimentalFeatureFixAbsoluteTrailingColumnMargin (#37374)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #37374

This is edge-casey enough, and I actually broke this in D42282358 without us noticing (I changed height to width of the bottom usage, instead, copy/pasting the value of the top one).

Reviewed By: yungsters

Differential Revision: D45766764

fbshipit-source-id: a10bb59e2d74821b40f36ccd7863cf51890235f9
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Jun 28, 2023
1 parent 15d735b commit 799b94e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
public enum YogaExperimentalFeature {
WEB_FLEX_BASIS(0),
ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE(1),
FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN(2),
FIX_JNILOCAL_REF_OVERFLOWS(3);
FIX_JNILOCAL_REF_OVERFLOWS(2);

private final int mIntValue;

Expand All @@ -29,8 +28,7 @@ public static YogaExperimentalFeature fromInt(int value) {
switch (value) {
case 0: return WEB_FLEX_BASIS;
case 1: return ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE;
case 2: return FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN;
case 3: return FIX_JNILOCAL_REF_OVERFLOWS;
case 2: return FIX_JNILOCAL_REF_OVERFLOWS;
default: throw new IllegalArgumentException("Unknown enum value: " + value);
}
}
Expand Down
2 changes: 0 additions & 2 deletions packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ const char* YGExperimentalFeatureToString(const YGExperimentalFeature value) {
return "web-flex-basis";
case YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge:
return "absolute-percentage-against-padding-edge";
case YGExperimentalFeatureFixAbsoluteTrailingColumnMargin:
return "fix-absolute-trailing-column-margin";
case YGExperimentalFeatureFixJNILocalRefOverflows:
return "fix-jnilocal-ref-overflows";
}
Expand Down
1 change: 0 additions & 1 deletion packages/react-native/ReactCommon/yoga/yoga/YGEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ YG_ENUM_SEQ_DECL(
YGExperimentalFeature,
YGExperimentalFeatureWebFlexBasis,
YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge,
YGExperimentalFeatureFixAbsoluteTrailingColumnMargin,
YGExperimentalFeatureFixJNILocalRefOverflows)

YG_ENUM_SEQ_DECL(
Expand Down
10 changes: 2 additions & 8 deletions packages/react-native/ReactCommon/yoga/yoga/Yoga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1543,19 +1543,13 @@ static void YGNodeAbsoluteLayoutChild(
depth,
generationCount);

auto trailingMarginOuterSize =
node->getConfig()->isExperimentalFeatureEnabled(
YGExperimentalFeatureFixAbsoluteTrailingColumnMargin)
? isMainAxisRow ? height : width
: width;

if (child->isTrailingPosDefined(mainAxis) &&
!child->isLeadingPositionDefined(mainAxis)) {
child->setLayoutPosition(
node->getLayout().measuredDimensions[dim[mainAxis]] -
child->getLayout().measuredDimensions[dim[mainAxis]] -
node->getTrailingBorder(mainAxis) -
child->getTrailingMargin(mainAxis, trailingMarginOuterSize)
child->getTrailingMargin(mainAxis, isMainAxisRow ? width : height)
.unwrap() -
child->getTrailingPosition(mainAxis, isMainAxisRow ? width : height)
.unwrap(),
Expand Down Expand Up @@ -1598,7 +1592,7 @@ static void YGNodeAbsoluteLayoutChild(
node->getLayout().measuredDimensions[dim[crossAxis]] -
child->getLayout().measuredDimensions[dim[crossAxis]] -
node->getTrailingBorder(crossAxis) -
child->getTrailingMargin(crossAxis, trailingMarginOuterSize)
child->getTrailingMargin(crossAxis, isMainAxisRow ? height : width)
.unwrap() -
child
->getTrailingPosition(crossAxis, isMainAxisRow ? height : width)
Expand Down

0 comments on commit 799b94e

Please sign in to comment.