From c11d213a1436d7d20b1e6805a509f7c3d2dd8f09 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 15 Aug 2024 18:40:52 +0200 Subject: Set the viewport width as initial width value When the initial width is -1, the contrainsts of min-width and max-width are not applied. If we set the viewport width after calcFinalWidth() it may exceed max-width. It is guaranteed to return a value different from -1 when the initial width is positive. --- dw/widget.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'dw') diff --git a/dw/widget.cc b/dw/widget.cc index 1a8743ee..8824baeb 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -662,11 +662,9 @@ int Widget::getAvailWidth (bool forceValue) int viewportWidth = layout->viewportWidth - (layout->canvasHeightGreater ? layout->vScrollbarThickness : 0); - width = -1; + width = viewportWidth; calcFinalWidth (getStyle (), viewportWidth, NULL, 0, forceValue, &width); - if (width == -1) - width = viewportWidth; - + assert(width != -1); DBG_OBJ_MSG_END (); } else if (parent) { DBG_OBJ_MSG ("resize", 1, "delegated to parent"); -- cgit v1.2.3