From 8ab01fde6eccc7babef8ce09fc6fcc395adb7617 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Wed, 12 Dec 2018 16:11:46 -0800 Subject: [PATCH] Back out "[yoga][PR] Fix aspect ratio when stretching with main axis margin" Summary: Original commit changeset: 6970e6072e79 Reviewed By: mdvacca Differential Revision: D13437552 fbshipit-source-id: 65a55d716da6b6582e38efa906d3f540e58418bf --- tests/YGAspectRatioTest.cpp | 23 ----------------------- yoga/Yoga.cpp | 10 ---------- 2 files changed, 33 deletions(-) diff --git a/tests/YGAspectRatioTest.cpp b/tests/YGAspectRatioTest.cpp index c3e5154f..9d99569b 100644 --- a/tests/YGAspectRatioTest.cpp +++ b/tests/YGAspectRatioTest.cpp @@ -895,26 +895,3 @@ TEST(YogaTest, aspect_ratio_should_prefer_flexed_dimension) { YGNodeFreeRecursive(root); } - -TEST( - YogaTest, - aspect_ratio_defined_by_cross_stretch_should_not_be_effected_by_margin_on_main_axis) { - const YGConfigRef config = YGConfigNew(); - YGConfigSetUseWebDefaults(config, true); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root, 200); - YGNodeStyleSetHeight(root, 100); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetMargin(root_child0, YGEdgeStart, 50); - YGNodeStyleSetAspectRatio(root_child0, 1); - YGNodeInsertChild(root, root_child0, 0); - - YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); - - ASSERT_EQ(100, YGNodeLayoutGetWidth(root_child0)); - ASSERT_EQ(100, YGNodeLayoutGetHeight(root_child0)); - - YGNodeFreeRecursive(root); -} diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index 6bc264a1..6abfb7d3 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -1382,16 +1382,6 @@ static void YGNodeComputeFlexBasisForChild( auto marginColumn = YGUnwrapFloatOptional( child->getMarginForAxis(YGFlexDirectionColumn, ownerWidth)); - if (YGNodeAlignItem(node, child) == YGAlignStretch) { - if (isMainAxisRow && !YGFloatIsUndefined(height)) { - childHeight = height; - childHeightMeasureMode = YGMeasureModeExactly; - } else if (!isMainAxisRow && !YGFloatIsUndefined(width)) { - childWidth = width; - childWidthMeasureMode = YGMeasureModeExactly; - } - } - if (isRowStyleDimDefined) { childWidth = YGUnwrapFloatOptional(YGResolveValue(