From 90e0e5b3bb0ff3c4dfbdaa6c6a22f2a6196b4f73 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Sun, 17 Mar 2024 10:15:32 +0100 Subject: Prefer CSS max-width when width is set to auto. When a widget has width to auto and the initial finalWidth is -1, set it by default to the max-width CSS value so it expands to the maximum available size. --- dw/widget.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'dw/widget.cc') diff --git a/dw/widget.cc b/dw/widget.cc index fd9daa3f..b778700b 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -947,11 +947,12 @@ void Widget::calcFinalWidth (style::Style *style, int refWidth, *finalWidth = width; /* Set the width if the min or max value is set and finalWidth is - * still -1 or exceeds the limit */ - if (minWidth != -1 && (*finalWidth == -1 || *finalWidth < minWidth)) - *finalWidth = minWidth; + * still -1 or exceeds the limit. Start by maxWidth so it defaults to + * the maximum available size. */ if (maxWidth != -1 && (*finalWidth == -1 || *finalWidth > maxWidth)) *finalWidth = maxWidth; + if (minWidth != -1 && (*finalWidth == -1 || *finalWidth < minWidth)) + *finalWidth = minWidth; DBG_OBJ_LEAVE_VAL ("%d", *finalWidth); } -- cgit v1.2.3