From bac036a62800675f3f7a73fc29edcb726b7cf6e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 14 Oct 2026 11:23:14 +0200 Subject: [PATCH] UI: Don't let LinearLayout grow past an AT_MOST limit for weighted children After measuring the weighted children, the measured size could grow beyond the AT_MOST size the parent allowed. Co-Authored-By: Claude Opus 5.5 (1M context) --- Common/UI/ViewGroup.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/UI/ViewGroup.cpp b/Common/UI/ViewGroup.cpp index 502e167b06..931e974a33 100644 --- a/Common/UI/ViewGroup.cpp +++ b/Common/UI/ViewGroup.cpp @@ -721,7 +721,7 @@ void LinearLayout::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec v } if (horiz.type == AT_MOST && measuredWidth_ < horiz.size) { - measuredWidth_ += usedWidth; + measuredWidth_ = std::min(measuredWidth_ + usedWidth, horiz.size); } // Measure here in case maxOther moved (can happen due to word wrap.) @@ -769,7 +769,7 @@ void LinearLayout::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec v } if (vert.type == AT_MOST && measuredHeight_ < vert.size) { - measuredHeight_ += usedHeight; + measuredHeight_ = std::min(measuredHeight_ + usedHeight, vert.size); } // Measure here in case maxOther moved (can happen due to word wrap.)