From 3f6412b934250ef2c0fe2d573ea10f77b0e5eaa3 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Thu, 29 Jun 2023 11:04:01 -0700 Subject: [PATCH] Remove YGExperimentalFeatureFixAbsoluteTrailingColumnMargin (#37374) Summary: X-link: https://github.com/facebook/yoga/pull/1317 Pull Request resolved: https://github.com/facebook/react-native/pull/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: b600b79b8436534fe48ef2acbfde8ba64068e593 --- .../com/facebook/yoga/YogaExperimentalFeature.java | 6 ++---- .../react-native/ReactCommon/yoga/yoga/YGEnums.cpp | 2 -- packages/react-native/ReactCommon/yoga/yoga/YGEnums.h | 1 - packages/react-native/ReactCommon/yoga/yoga/Yoga.cpp | 10 ++-------- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java index ba881370252210..daa87bf0f8389f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java @@ -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; @@ -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); } } diff --git a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp index 5753403ef6d19d..e8ace4b38efbc4 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp +++ b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp @@ -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"; } diff --git a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h index 990e314977381d..a502d39b161254 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h +++ b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h @@ -66,7 +66,6 @@ YG_ENUM_SEQ_DECL( YGExperimentalFeature, YGExperimentalFeatureWebFlexBasis, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, - YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, YGExperimentalFeatureFixJNILocalRefOverflows) YG_ENUM_SEQ_DECL( diff --git a/packages/react-native/ReactCommon/yoga/yoga/Yoga.cpp b/packages/react-native/ReactCommon/yoga/yoga/Yoga.cpp index 798972c0a420ce..ab0aa82526dbae 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/Yoga.cpp +++ b/packages/react-native/ReactCommon/yoga/yoga/Yoga.cpp @@ -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(), @@ -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)