Fix issue where position insets were not working with row reverse (#1431)

Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1431

X-link: https://github.com/facebook/react-native/pull/41041

The last of the row-reverse issues hurray!

The position insets were broken with row-reverse since we were using the main-start/main-end edges to inset from and NOT the inline-start/inline-end edges as we should. This made it so that inset in left and right were swapped and same with top and bottom (with column-reverse). The solution here is the same as the previous ones were we are migrating to using inline-start/end as the leading/trailing edge now.

Reviewed By: NickGerleman

Differential Revision: D50390543

fbshipit-source-id: b714deab8489fbe11f7f6db21e4aad3b3aa314b3
This commit is contained in:
Joe Vilches
2023-10-18 17:30:18 -07:00
committed by Facebook GitHub Bot
parent 2668e8e70c
commit b6f85a1c76
3 changed files with 89 additions and 54 deletions

View File

@@ -48,7 +48,10 @@ class YG_EXPORT Node : public ::YGNode {
std::array<YGValue, 2> resolvedDimensions_ = {
{YGValueUndefined, YGValueUndefined}};
float relativePosition(FlexDirection axis, const float axisSize) const;
float relativePosition(
FlexDirection axis,
Direction direction,
const float axisSize) const;
YGEdge getInlineStartEdgeUsingErrata(
FlexDirection flexDirection,
@@ -196,10 +199,18 @@ class YG_EXPORT Node : public ::YGNode {
YGEdge edge);
// Methods related to positions, margin, padding and border
bool isFlexStartPositionDefined(FlexDirection axis) const;
bool isFlexEndPositionDefined(FlexDirection axis) const;
float getFlexStartPosition(FlexDirection axis, float axisSize) const;
float getFlexEndPosition(FlexDirection axis, float axisSize) const;
bool isInlineStartPositionDefined(FlexDirection axis, Direction direction)
const;
bool isInlineEndPositionDefined(FlexDirection axis, Direction direction)
const;
float getInlineStartPosition(
FlexDirection axis,
Direction direction,
float axisSize) const;
float getInlineEndPosition(
FlexDirection axis,
Direction direction,
float axisSize) const;
float getInlineStartMargin(
FlexDirection axis,
Direction direction,