diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-03-23 00:16:21 +0100 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-03-23 00:23:14 +0100 |
commit | 342c81d5970e181566b96ea81be58cd1869b7632 (patch) | |
tree | 42099acb83bb4bde1d553f73f7f167189a8ce2e1 /dw | |
parent | b0f6a3f055039c5c9c3ab651029a315a88eb6134 (diff) |
Revert "Constraint width with min-width or max-width"
This reverts commit 24bcd67df29a5418d05600b038a9283a00e555d2.
Fixes: https://github.com/dillo-browser/dillo/issues/99
Diffstat (limited to 'dw')
-rw-r--r-- | dw/widget.cc | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/dw/widget.cc b/dw/widget.cc index 59cbdd9b..f4506b84 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -651,15 +651,22 @@ int Widget::getAvailWidth (bool forceValue) DBG_OBJ_ENTER ("resize", 0, "getAvailWidth", "%s", forceValue ? "true" : "false"); - int width = -1; - int scrollbarThickness = - layout->canvasHeightGreater ? layout->vScrollbarThickness : 0; - int viewportWidth = layout->viewportWidth - scrollbarThickness; + int width; if (parent == NULL && quasiParent == NULL) { DBG_OBJ_MSG ("resize", 1, "no parent, regarding viewport"); DBG_OBJ_MSG_START (); + // TODO Consider nested layouts (e. g. <button>). + + int viewportWidth = + layout->viewportWidth - (layout->canvasHeightGreater ? + layout->vScrollbarThickness : 0); + width = -1; + calcFinalWidth (getStyle (), viewportWidth, NULL, 0, forceValue, &width); + if (width == -1) + width = viewportWidth; + DBG_OBJ_MSG_END (); } else if (parent) { DBG_OBJ_MSG ("resize", 1, "delegated to parent"); @@ -673,15 +680,6 @@ int Widget::getAvailWidth (bool forceValue) DBG_OBJ_MSG_END (); } - /* The refWidth will be used for relative sizes. If not set, use the - * viewport width */ - int refWidth = width == -1 ? viewportWidth : width; - - /* Constraint the width with min-width and max-width */ - calcFinalWidth (getStyle (), refWidth, NULL, 0, forceValue, &width); - if (width == -1) - width = refWidth; - DBG_OBJ_LEAVE_VAL ("%d", width); return width; } |