-
+
+
+
+
+
diff --git a/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java b/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java
index 3978f630..b432b7f5 100644
--- a/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java
+++ b/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
- * @generated SignedSource<<655bad05f0830b5ea39b80b01b0e5e9c>>
+ * @generated SignedSource<
>
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAbsolutePositionTest.html
*/
@@ -1357,6 +1357,54 @@ public class YGAbsolutePositionTest {
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
}
+ @Test
+ public void test_absolute_layout_column_reverse_margin_border() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
+ root.setPositionType(YogaPositionType.ABSOLUTE);
+ root.setWidth(200f);
+ root.setHeight(200f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0.setPosition(YogaEdge.LEFT, 5f);
+ root_child0.setPosition(YogaEdge.RIGHT, 3f);
+ root_child0.setMargin(YogaEdge.LEFT, 3f);
+ root_child0.setMargin(YogaEdge.RIGHT, 4f);
+ root_child0.setBorder(YogaEdge.LEFT, 1f);
+ root_child0.setBorder(YogaEdge.RIGHT, 7f);
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(8f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(143f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+ }
+
private YogaNode createNode(YogaConfig config) {
return mNodeFactory.create(config);
}
diff --git a/java/tests/com/facebook/yoga/YGAlignItemsTest.java b/java/tests/com/facebook/yoga/YGAlignItemsTest.java
index 5e1c1377..e8dd3517 100644
--- a/java/tests/com/facebook/yoga/YGAlignItemsTest.java
+++ b/java/tests/com/facebook/yoga/YGAlignItemsTest.java
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
- * @generated SignedSource<<0b1894c4c0d67fd96c7fac6d482c5a5e>>
+ * @generated SignedSource<<17eb6adbebe0409ff047a82dc3257d91>>
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignItemsTest.html
*/
@@ -2175,6 +2175,123 @@ public class YGAlignItemsTest {
assertEquals(0f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
}
+ @Test
+ public void test_align_flex_end_with_row_reverse() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setAlignItems(YogaAlign.FLEX_END);
+ root.setPositionType(YogaPositionType.ABSOLUTE);
+ root.setWrap(YogaWrap.WRAP);
+ root.setWidth(100f);
+ root.setHeight(75f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setMargin(YogaEdge.LEFT, 3f);
+ root_child0.setMargin(YogaEdge.RIGHT, 5f);
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = createNode(config);
+ root_child1.setWidth(50f);
+ root_child1.setHeight(50f);
+ root.addChildAt(root_child1, 1);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
+ assertEquals(75f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(3f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(58f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
+ assertEquals(75f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(45f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(-8f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_align_stretch_with_row_reverse() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setPositionType(YogaPositionType.ABSOLUTE);
+ root.setWrap(YogaWrap.WRAP);
+ root.setWidth(100f);
+ root.setHeight(75f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setMargin(YogaEdge.LEFT, 3f);
+ root_child0.setMargin(YogaEdge.RIGHT, 5f);
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = createNode(config);
+ root_child1.setWidth(50f);
+ root_child1.setHeight(50f);
+ root.addChildAt(root_child1, 1);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
+ assertEquals(75f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(3f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(58f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
+ assertEquals(75f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(45f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(-8f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
+ }
+
private YogaNode createNode(YogaConfig config) {
return mNodeFactory.create(config);
}
diff --git a/javascript/tests/generated/YGAbsolutePositionTest.test.ts b/javascript/tests/generated/YGAbsolutePositionTest.test.ts
index 837129c5..5b686632 100644
--- a/javascript/tests/generated/YGAbsolutePositionTest.test.ts
+++ b/javascript/tests/generated/YGAbsolutePositionTest.test.ts
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
- * @generated SignedSource<<5be04807f890bcc32e9b3fc094d21cd1>>
+ * @generated SignedSource<<777a238fc942436d2c803822110bcd07>>
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAbsolutePositionTest.html
*/
@@ -1497,3 +1497,56 @@ test('absolute_layout_padding_bottom', () => {
config.free();
}
});
+test('absolute_layout_column_reverse_margin_border', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setFlexDirection(FlexDirection.ColumnReverse);
+ root.setPositionType(PositionType.Absolute);
+ root.setWidth(200);
+ root.setHeight(200);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setPositionType(PositionType.Absolute);
+ root_child0.setPosition(Edge.Left, 5);
+ root_child0.setPosition(Edge.Right, 3);
+ root_child0.setMargin(Edge.Left, 3);
+ root_child0.setMargin(Edge.Right, 4);
+ root_child0.setBorder(Edge.Left, 1);
+ root_child0.setBorder(Edge.Right, 7);
+ root_child0.setWidth(50);
+ root_child0.setHeight(50);
+ root.insertChild(root_child0, 0);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(200);
+ expect(root.getComputedHeight()).toBe(200);
+
+ expect(root_child0.getComputedLeft()).toBe(8);
+ expect(root_child0.getComputedTop()).toBe(150);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(200);
+ expect(root.getComputedHeight()).toBe(200);
+
+ expect(root_child0.getComputedLeft()).toBe(143);
+ expect(root_child0.getComputedTop()).toBe(150);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
diff --git a/javascript/tests/generated/YGAlignItemsTest.test.ts b/javascript/tests/generated/YGAlignItemsTest.test.ts
index cb586ede..74f6132c 100644
--- a/javascript/tests/generated/YGAlignItemsTest.test.ts
+++ b/javascript/tests/generated/YGAlignItemsTest.test.ts
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
- * @generated SignedSource<<6898e1d5236b8b7d6421e2c321d4adef>>
+ * @generated SignedSource<<74d05d33189c5b8e301d7bb50e219a07>>
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignItemsTest.html
*/
@@ -2313,3 +2313,130 @@ test('align_flex_start_with_shrinking_children_with_stretch', () => {
config.free();
}
});
+test('align_flex_end_with_row_reverse', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setAlignItems(Align.FlexEnd);
+ root.setPositionType(PositionType.Absolute);
+ root.setFlexWrap(Wrap.Wrap);
+ root.setWidth(100);
+ root.setHeight(75);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setMargin(Edge.Left, 3);
+ root_child0.setMargin(Edge.Right, 5);
+ root_child0.setWidth(50);
+ root_child0.setHeight(50);
+ root.insertChild(root_child0, 0);
+
+ const root_child1 = Yoga.Node.create(config);
+ root_child1.setWidth(50);
+ root_child1.setHeight(50);
+ root.insertChild(root_child1, 1);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(100);
+ expect(root.getComputedHeight()).toBe(75);
+
+ expect(root_child0.getComputedLeft()).toBe(3);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(58);
+ expect(root_child1.getComputedTop()).toBe(0);
+ expect(root_child1.getComputedWidth()).toBe(50);
+ expect(root_child1.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(100);
+ expect(root.getComputedHeight()).toBe(75);
+
+ expect(root_child0.getComputedLeft()).toBe(45);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(-8);
+ expect(root_child1.getComputedTop()).toBe(0);
+ expect(root_child1.getComputedWidth()).toBe(50);
+ expect(root_child1.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test('align_stretch_with_row_reverse', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setPositionType(PositionType.Absolute);
+ root.setFlexWrap(Wrap.Wrap);
+ root.setWidth(100);
+ root.setHeight(75);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setMargin(Edge.Left, 3);
+ root_child0.setMargin(Edge.Right, 5);
+ root_child0.setWidth(50);
+ root_child0.setHeight(50);
+ root.insertChild(root_child0, 0);
+
+ const root_child1 = Yoga.Node.create(config);
+ root_child1.setWidth(50);
+ root_child1.setHeight(50);
+ root.insertChild(root_child1, 1);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(100);
+ expect(root.getComputedHeight()).toBe(75);
+
+ expect(root_child0.getComputedLeft()).toBe(3);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(58);
+ expect(root_child1.getComputedTop()).toBe(0);
+ expect(root_child1.getComputedWidth()).toBe(50);
+ expect(root_child1.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(100);
+ expect(root.getComputedHeight()).toBe(75);
+
+ expect(root_child0.getComputedLeft()).toBe(45);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(-8);
+ expect(root_child1.getComputedTop()).toBe(0);
+ expect(root_child1.getComputedWidth()).toBe(50);
+ expect(root_child1.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
diff --git a/tests/generated/YGAbsolutePositionTest.cpp b/tests/generated/YGAbsolutePositionTest.cpp
index 6f4cd550..740dc266 100644
--- a/tests/generated/YGAbsolutePositionTest.cpp
+++ b/tests/generated/YGAbsolutePositionTest.cpp
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* clang-format off
- * @generated SignedSource<<7ec551af37eeaa71fcdc36b1018a1710>>
+ * @generated SignedSource<<43fe6d73966bf8e4694c57420a0fb9d9>>
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAbsolutePositionTest.html
*/
@@ -1370,3 +1370,52 @@ TEST(YogaTest, absolute_layout_padding_bottom) {
YGConfigFree(config);
}
+
+TEST(YogaTest, absolute_layout_column_reverse_margin_border) {
+ const YGConfigRef config = YGConfigNew();
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumnReverse);
+ YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
+ YGNodeStyleSetWidth(root, 200);
+ YGNodeStyleSetHeight(root, 200);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetPosition(root_child0, YGEdgeLeft, 5);
+ YGNodeStyleSetPosition(root_child0, YGEdgeRight, 3);
+ YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 3);
+ YGNodeStyleSetMargin(root_child0, YGEdgeRight, 4);
+ YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 1);
+ YGNodeStyleSetBorder(root_child0, YGEdgeRight, 7);
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(8, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(143, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
diff --git a/tests/generated/YGAlignItemsTest.cpp b/tests/generated/YGAlignItemsTest.cpp
index 82daf882..a8e14b40 100644
--- a/tests/generated/YGAlignItemsTest.cpp
+++ b/tests/generated/YGAlignItemsTest.cpp
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* clang-format off
- * @generated SignedSource<>
+ * @generated SignedSource<<7cbfd8bdc47bc5e88f4982cb5787b878>>
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignItemsTest.html
*/
@@ -2190,3 +2190,122 @@ TEST(YogaTest, align_flex_start_with_shrinking_children_with_stretch) {
YGConfigFree(config);
}
+
+TEST(YogaTest, align_flex_end_with_row_reverse) {
+ const YGConfigRef config = YGConfigNew();
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetAlignItems(root, YGAlignFlexEnd);
+ YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
+ YGNodeStyleSetFlexWrap(root, YGWrapWrap);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetHeight(root, 75);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 3);
+ YGNodeStyleSetMargin(root_child0, YGEdgeRight, 5);
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 50);
+ YGNodeInsertChild(root, root_child1, 1);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(75, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(3, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(58, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(75, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(45, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(-8, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, align_stretch_with_row_reverse) {
+ const YGConfigRef config = YGConfigNew();
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
+ YGNodeStyleSetFlexWrap(root, YGWrapWrap);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetHeight(root, 75);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 3);
+ YGNodeStyleSetMargin(root_child0, YGEdgeRight, 5);
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 50);
+ YGNodeInsertChild(root, root_child1, 1);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(75, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(3, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(58, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(75, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(45, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(-8, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
diff --git a/yoga/algorithm/CalculateLayout.cpp b/yoga/algorithm/CalculateLayout.cpp
index 4bc2ad69..e1a28040 100644
--- a/yoga/algorithm/CalculateLayout.cpp
+++ b/yoga/algorithm/CalculateLayout.cpp
@@ -1027,18 +1027,17 @@ static void justifyMainAxis(
continue;
}
if (childStyle.positionType() == PositionType::Absolute &&
- child->style().isInlineStartPositionDefined(mainAxis, direction)) {
+ child->style().isFlexStartPositionDefined(mainAxis, direction)) {
if (performLayout) {
// In case the child is position absolute and has left/top being
// defined, we override the position to whatever the user said (and
// margin/border).
child->setLayoutPosition(
- child->style().computeInlineStartPosition(
+ child->style().computeFlexStartPosition(
mainAxis, direction, availableInnerMainDim) +
- node->style().computeInlineStartBorder(mainAxis, direction) +
- child->style().computeInlineStartMargin(
+ node->style().computeFlexStartBorder(mainAxis, direction) +
+ child->style().computeFlexStartMargin(
mainAxis, direction, availableInnerWidth),
- // FIXME T175195745: Mismatched edge
flexStartEdge(mainAxis));
}
} else {
@@ -1086,7 +1085,7 @@ static void justifyMainAxis(
// If the child is baseline aligned then the cross dimension is
// calculated by adding maxAscent and maxDescent from the baseline.
const float ascent = calculateBaseline(child) +
- child->style().computeInlineStartMargin(
+ child->style().computeFlexStartMargin(
FlexDirection::Column, direction, availableInnerWidth);
const float descent =
child->getLayout().measuredDimension(Dimension::Height) +
@@ -1333,7 +1332,7 @@ static void calculateLayoutImpl(
const float paddingAndBorderAxisCross =
paddingAndBorderForAxis(node, crossAxis, ownerWidth);
const float leadingPaddingAndBorderCross =
- node->style().computeInlineStartPaddingAndBorder(
+ node->style().computeFlexStartPaddingAndBorder(
crossAxis, direction, ownerWidth);
SizingMode sizingModeMainDim =
@@ -1589,16 +1588,14 @@ static void calculateLayoutImpl(
// top/left/bottom/right set, override all the previously computed
// positions to set it correctly.
const bool isChildLeadingPosDefined =
- child->style().isInlineStartPositionDefined(crossAxis, direction);
+ child->style().isFlexStartPositionDefined(crossAxis, direction);
if (isChildLeadingPosDefined) {
child->setLayoutPosition(
- child->style().computeInlineStartPosition(
+ child->style().computeFlexStartPosition(
crossAxis, direction, availableInnerCrossDim) +
- node->style().computeInlineStartBorder(
- crossAxis, direction) +
- child->style().computeInlineStartMargin(
+ node->style().computeFlexStartBorder(crossAxis, direction) +
+ child->style().computeFlexStartMargin(
crossAxis, direction, availableInnerWidth),
- // FIXME T175195745: Mismatched edge
flexStartEdge(crossAxis));
}
// If leading position is not defined or calculations result in Nan,
@@ -1607,10 +1604,9 @@ static void calculateLayoutImpl(
yoga::isUndefined(
child->getLayout().position(flexStartEdge(crossAxis)))) {
child->setLayoutPosition(
- node->style().computeInlineStartBorder(crossAxis, direction) +
- child->style().computeInlineStartMargin(
+ node->style().computeFlexStartBorder(crossAxis, direction) +
+ child->style().computeFlexStartMargin(
crossAxis, direction, availableInnerWidth),
- // FIXME T175195745: Mismatched edge
flexStartEdge(crossAxis));
}
} else {
@@ -1823,7 +1819,7 @@ static void calculateLayoutImpl(
}
if (resolveChildAlignment(node, child) == Align::Baseline) {
const float ascent = calculateBaseline(child) +
- child->style().computeInlineStartMargin(
+ child->style().computeFlexStartMargin(
FlexDirection::Column, direction, availableInnerWidth);
const float descent =
child->getLayout().measuredDimension(Dimension::Height) +
@@ -1853,20 +1849,18 @@ static void calculateLayoutImpl(
case Align::FlexStart: {
child->setLayoutPosition(
currentLead +
- child->style().computeInlineStartMargin(
+ child->style().computeFlexStartPosition(
crossAxis, direction, availableInnerWidth),
- // FIXME T175195745: Mismatched edge
flexStartEdge(crossAxis));
break;
}
case Align::FlexEnd: {
child->setLayoutPosition(
currentLead + lineHeight -
- child->style().computeInlineEndMargin(
+ child->style().computeFlexEndMargin(
crossAxis, direction, availableInnerWidth) -
child->getLayout().measuredDimension(
dimension(crossAxis)),
- // FIXME T175195745: Mismatched edge
flexStartEdge(crossAxis));
break;
}
@@ -1882,9 +1876,8 @@ static void calculateLayoutImpl(
case Align::Stretch: {
child->setLayoutPosition(
currentLead +
- child->style().computeInlineStartMargin(
+ child->style().computeFlexStartMargin(
crossAxis, direction, availableInnerWidth),
- // FIXME T175195745: Mismatched edge
flexStartEdge(crossAxis));
// Remeasure child with the line height as it as been only
@@ -1935,7 +1928,7 @@ static void calculateLayoutImpl(
child->setLayoutPosition(
currentLead + maxAscentForCurrentLine -
calculateBaseline(child) +
- child->style().computeInlineStartPosition(
+ child->style().computeFlexStartPosition(
FlexDirection::Column,
direction,
availableInnerCrossDim),