From 9ab8e538fb07d46cca4d9729871b98217c868e0c Mon Sep 17 00:00:00 2001 From: Josh Hargreaves Date: Mon, 2 Mar 2026 15:31:00 -0500 Subject: [PATCH 1/2] Add failing test for min_width_larger_than_width_propagates_to_auto_parent --- tests/YGMeasureTest.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/YGMeasureTest.cpp b/tests/YGMeasureTest.cpp index c88e882624..cdc9c6017f 100644 --- a/tests/YGMeasureTest.cpp +++ b/tests/YGMeasureTest.cpp @@ -977,3 +977,37 @@ TEST(YogaTest, measure_border_box) { YGNodeFreeRecursive(root); } + +TEST(YogaTest, min_width_larger_than_width_propagates_to_auto_parent) { + YGNodeRef root = YGNodeNew(); + + YGNodeRef root_child0 = YGNodeNew(); + YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); + YGNodeStyleSetHeight(root_child0, 50); + YGNodeInsertChild(root, root_child0, 0); + + YGNodeRef root_child0_child0 = YGNodeNew(); + YGNodeStyleSetWidth(root_child0_child0, 50); + YGNodeStyleSetMinWidth(root_child0_child0, 100); + YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeInsertChild(root_child0, root_child0_child0, 0); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_EQ(50, YGNodeLayoutGetHeight(root)); + + ASSERT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_EQ(100, YGNodeLayoutGetWidth(root_child0)); + ASSERT_EQ(50, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeFreeRecursive(root); +} From b17446615773f491e8e0a81c5bf0480f9725833d Mon Sep 17 00:00:00 2001 From: Josh Hargreaves Date: Mon, 2 Mar 2026 15:31:09 -0500 Subject: [PATCH 2/2] Add fix for min_width_larger_than_width_propagates_to_auto_parent --- yoga/algorithm/CalculateLayout.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/yoga/algorithm/CalculateLayout.cpp b/yoga/algorithm/CalculateLayout.cpp index 81a5f3b8a0..0b59245af6 100644 --- a/yoga/algorithm/CalculateLayout.cpp +++ b/yoga/algorithm/CalculateLayout.cpp @@ -1113,7 +1113,14 @@ static void justifyMainAxis( // dimensionWithMargin. flexLine.layout.mainDim += child->style().computeMarginForAxis(mainAxis, availableInnerWidth) + - childLayout.computedFlexBasis.unwrap(); + boundAxisWithinMinAndMax( + child, + direction, + mainAxis, + childLayout.computedFlexBasis, + mainAxisOwnerSize, + ownerWidth) + .unwrap(); flexLine.layout.crossDim = availableInnerCrossDim; } else { // The main dimension is the sum of all the elements dimension plus