diff --git a/gentest/fixtures/YGStaticPositionTest.html b/gentest/fixtures/YGStaticPositionTest.html index e73e35f3a5..30b781172b 100644 --- a/gentest/fixtures/YGStaticPositionTest.html +++ b/gentest/fixtures/YGStaticPositionTest.html @@ -1,11 +1,11 @@ -
+
-
+
diff --git a/java/tests/com/facebook/yoga/YGStaticPositionTest.java b/java/tests/com/facebook/yoga/YGStaticPositionTest.java index 3cc2f5459e..4b9635f973 100644 --- a/java/tests/com/facebook/yoga/YGStaticPositionTest.java +++ b/java/tests/com/facebook/yoga/YGStaticPositionTest.java @@ -26,7 +26,6 @@ public static Iterable nodeFactories() { @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test - @Ignore public void test_static_position_insets_have_no_effect_left_top() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -68,7 +67,6 @@ public void test_static_position_insets_have_no_effect_left_top() { } @Test - @Ignore public void test_static_position_insets_have_no_effect_right_bottom() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); diff --git a/javascript/tests/generated/YGStaticPositionTest.test.ts b/javascript/tests/generated/YGStaticPositionTest.test.ts index 5cd3eb62d4..c3628fc8f1 100644 --- a/javascript/tests/generated/YGStaticPositionTest.test.ts +++ b/javascript/tests/generated/YGStaticPositionTest.test.ts @@ -25,7 +25,7 @@ import { Wrap, } from 'yoga-layout'; -test.skip('static_position_insets_have_no_effect_left_top', () => { +test('static_position_insets_have_no_effect_left_top', () => { const config = Yoga.Config.create(); let root; @@ -72,7 +72,7 @@ test.skip('static_position_insets_have_no_effect_left_top', () => { config.free(); } }); -test.skip('static_position_insets_have_no_effect_right_bottom', () => { +test('static_position_insets_have_no_effect_right_bottom', () => { const config = Yoga.Config.create(); let root; diff --git a/tests/generated/YGStaticPositionTest.cpp b/tests/generated/YGStaticPositionTest.cpp index 21094c9908..3bdade9f47 100644 --- a/tests/generated/YGStaticPositionTest.cpp +++ b/tests/generated/YGStaticPositionTest.cpp @@ -12,8 +12,6 @@ #include TEST(YogaTest, static_position_insets_have_no_effect_left_top) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -56,8 +54,6 @@ TEST(YogaTest, static_position_insets_have_no_effect_left_top) { } TEST(YogaTest, static_position_insets_have_no_effect_right_bottom) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); diff --git a/yoga/node/Node.cpp b/yoga/node/Node.cpp index e69c96f5ae..1e59cde4ff 100644 --- a/yoga/node/Node.cpp +++ b/yoga/node/Node.cpp @@ -503,11 +503,16 @@ void Node::setLayoutDimension(float dimensionValue, Dimension dimension) { } // If both left and right are defined, then use left. Otherwise return +left or -// -right depending on which is defined. +// -right depending on which is defined. Ignore statically positioned nodes as +// insets do not apply to them. float Node::relativePosition( FlexDirection axis, Direction direction, float axisSize) const { + if (style_.positionType() == PositionType::Static && + !hasErrata(Errata::PositionStaticBehavesLikeRelative)) { + return 0; + } if (isInlineStartPositionDefined(axis, direction)) { return getInlineStartPosition(axis, direction, axisSize); } @@ -529,8 +534,7 @@ void Node::setPosition( const FlexDirection crossAxis = yoga::resolveCrossDirection(mainAxis, directionRespectingRoot); - // Here we should check for `PositionType::Static` and in this case zero inset - // properties (left, right, top, bottom, begin, end). + // In the case of position static these are just 0. See: // https://www.w3.org/TR/css-position-3/#valdef-position-static const float relativePositionMain = relativePosition(mainAxis, directionRespectingRoot, mainSize);