diff options
author | Sebastian Geerken <devnull@localhost> | 2014-05-02 11:38:00 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-05-02 11:38:00 +0200 |
commit | 212b6d04544a3d7bafac9daa06334a4405142882 (patch) | |
tree | a2faf4c40f3894375b5dde3bafad33e7e4961fe7 /dw/outofflowmgr.cc | |
parent | 413e63c3527d29d9a762a56a076ec55f244ebb57 (diff) |
Changed how floats with "width: auto" are handled.
Diffstat (limited to 'dw/outofflowmgr.cc')
-rw-r--r-- | dw/outofflowmgr.cc | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc index 57e6fd09..5e452627 100644 --- a/dw/outofflowmgr.cc +++ b/dw/outofflowmgr.cc @@ -2024,13 +2024,15 @@ void OutOfFlowMgr::ensureFloatSize (Float *vloat) if (vloat->getWidget()->usesHints ()) { // For widths defined by CSS, similar adjustments (extremes // etc.) like below are necessary, to prevent CPU hogging. - if (isAbsLength (vloat->getWidget()->getStyle()->width)) { - int width = absLengthVal (vloat->getWidget()->getStyle()->width); + + Length cssWidth = vloat->getWidget()->getStyle()->width; + if (isAbsLength (cssWidth)) { + int width = absLengthVal (cssWidth); DBG_OBJ_MSGF ("resize.oofm", 1, "about to set absolute width: %d", width); width = adjustFloatWidth (width, &extremes); vloat->getWidget()->setWidth (width); - } else if (isPerLength (vloat->getWidget()->getStyle()->width)) { + } else if (cssWidth == LENGTH_AUTO || isPerLength (cssWidth)) { // It is important that the width of the *CB* is not // larger than its minimal width, when the latter is set // as size hint; otherwise we have an endless queueResize @@ -2047,25 +2049,31 @@ void OutOfFlowMgr::ensureFloatSize (Float *vloat) // Not allocated: next allocation will take care. availWidth = containingBlock->getAvailWidth(); - int width = - multiplyWithPerLength (availWidth, - vloat->getWidget()->getStyle()->width); - - // Some more corrections (nonsense percentage values): - if (width < 1) - width = 1; - if (width > availWidth) + int width; + + if (cssWidth == LENGTH_AUTO) { width = availWidth; + DBG_OBJ_MSGF ("resize.oofm", 1, "setting width 'auto': %d", + width); + } else { + width = multiplyWithPerLength (availWidth, cssWidth); + + // Some more corrections (nonsense percentage values): + if (width < 1) + width = 1; + if (width > availWidth) + width = availWidth; + + DBG_OBJ_MSGF ("resize.oofm", 1, + "about to set percentage width: %d * %g -> %d", + availWidth, perLengthVal (cssWidth), width); + width = adjustFloatWidth (width, &extremes); + } - DBG_OBJ_MSGF ("resize.oofm", 1, - "about to set percentage width: %d * %g -> %d", - availWidth, - perLengthVal (vloat->getWidget()->getStyle()->width), - width); - width = adjustFloatWidth (width, &extremes); vloat->getWidget()->setWidth (width); } else - DBG_OBJ_MSG ("resize.oofm", 1, "setting no width: not defined"); + DBG_OBJ_MSG ("resize.oofm", 1, + "setting width: <b>relative length? may be a bug</b>"); } else DBG_OBJ_MSG ("resize.oofm", 1, "setting no width: uses no hints"); |