diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-03-17 10:15:32 +0100 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-03-17 20:37:33 +0100 |
commit | 90e0e5b3bb0ff3c4dfbdaa6c6a22f2a6196b4f73 (patch) | |
tree | 52bb944c271e78866307403f5f7dce86920343fd | |
parent | fc762938d3459cf91dacf4ff08d6888c59a909e9 (diff) |
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.
-rw-r--r-- | dw/widget.cc | 7 |
1 files changed, 4 insertions, 3 deletions
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); } |