diff options
-rw-r--r-- | dw/style.hh | 9 | ||||
-rw-r--r-- | dw/widget.cc | 18 |
2 files changed, 19 insertions, 8 deletions
diff --git a/dw/style.hh b/dw/style.hh index da214ca1..578e65c0 100644 --- a/dw/style.hh +++ b/dw/style.hh @@ -435,7 +435,8 @@ inline int absLengthVal(Length l) { return l >> 2; } * When possible, do not use this function directly; it may be removed * soon. Instead, use multiplyWithPerLength or multiplyWithPerLengthRounded. */ -inline double perLengthVal(Length l) { return (double)(l & ~3) / (1 << 18); } +inline double perLengthVal_useThisOnlyForDebugging(Length l) +{ return (double)(l & ~3) / (1 << 18); } /** \brief Returns the value of a relative length, as a float. * @@ -450,7 +451,7 @@ inline double relLengthVal(Length l) { return (double)(l & ~3) / (1 << 18); } * Use this instead of perLengthVal, when possible. */ inline int multiplyWithPerLength(int x, Length l) { - return x * perLengthVal(l); + return x * perLengthVal_useThisOnlyForDebugging (l); } /** @@ -459,8 +460,8 @@ inline int multiplyWithPerLength(int x, Length l) { * * (This function exists for backward compatibility.) */ -inline int multiplyWithPerLengthRounded (int x, Length l) { - return lout::misc::roundInt (x * perLengthVal(l)); +inline int multiplyWithPerLengthRounded(int x, Length l) { + return lout::misc::roundInt (x * perLengthVal_useThisOnlyForDebugging (l)); } inline int multiplyWithRelLength(int x, Length l) { diff --git a/dw/widget.cc b/dw/widget.cc index 3a804bac..1aecec84 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -425,10 +425,15 @@ void Widget::correctRequisition (Requisition *requisition, DBG_OBJ_MSG_START (); if (container == NULL) { - if (style::isAbsLength (getStyle()->width)) + if (style::isAbsLength (getStyle()->width)) { + DBG_OBJ_MSGF ("resize", 1, "absolute width: %dpx", + style::absLengthVal (getStyle()->width)); requisition->width = style::absLengthVal (getStyle()->width) + boxDiffWidth (); - else if (style::isPerLength (getStyle()->width)) { + } else if (style::isPerLength (getStyle()->width)) { + DBG_OBJ_MSGF ("resize", 1, "percentage width: %g%%", + 100 * style::perLengthVal_useThisOnlyForDebugging + (getStyle()->width)); int viewportWidth = layout->viewportWidth - (layout->canvasHeightGreater ? layout->vScrollbarThickness : 0); @@ -438,11 +443,16 @@ void Widget::correctRequisition (Requisition *requisition, } // TODO Perhaps split first, then add box ascent and descent. - if (style::isAbsLength (getStyle()->height)) + if (style::isAbsLength (getStyle()->height)) { + DBG_OBJ_MSGF ("resize", 1, "absolute height: %dpx", + style::absLengthVal (getStyle()->height)); splitHeightFun (style::absLengthVal (getStyle()->height) + boxDiffHeight (), &requisition->ascent, &requisition->descent); - else if (style::isPerLength (getStyle()->height)) { + } else if (style::isPerLength (getStyle()->height)) { + DBG_OBJ_MSGF ("resize", 1, "percentage height: %g%%", + 100 * style::perLengthVal_useThisOnlyForDebugging + (getStyle()->height)); // For layout->viewportHeight, see comment in getAvailHeight(). splitHeightFun (style::multiplyWithPerLength (layout->viewportHeight, getStyle()->height) |