Use std::min and std::max, not the misc versions.

This commit is contained in:
2025-08-10 17:08:42 -04:00
parent 6c3bf19bbd
commit 640ccd02d3
26 changed files with 216 additions and 226 deletions

View File

@ -941,19 +941,19 @@ int Widget::calcWidth (style::Length cssValue, int refWidth, Widget *refWidget,
if (style::isAbsLength (cssValue)) {
DBG_OBJ_MSGF ("resize", 1, "absolute width: %dpx",
style::absLengthVal (cssValue));
width = misc::max (style::absLengthVal (cssValue) + boxDiffWidth (),
width = std::max (style::absLengthVal (cssValue) + boxDiffWidth (),
limitMinWidth);
} else if (style::isPerLength (cssValue)) {
DBG_OBJ_MSGF ("resize", 1, "percentage width: %g%%",
100 * style::perLengthVal_useThisOnlyForDebugging
(cssValue));
if (refWidth != -1)
width = misc::max (applyPerWidth (refWidth, cssValue), limitMinWidth);
width = std::max (applyPerWidth (refWidth, cssValue), limitMinWidth);
else {
int availWidth = refWidget->getAvailWidth (forceValue);
if (availWidth != -1) {
int containerWidth = availWidth - refWidget->boxDiffWidth ();
width = misc::max (applyPerWidth (containerWidth, cssValue),
width = std::max (applyPerWidth (containerWidth, cssValue),
limitMinWidth);
} else
width = -1;
@ -1051,20 +1051,20 @@ int Widget::calcHeight (style::Length cssValue, bool usePercentage,
DBG_OBJ_MSGF ("resize", 1, "absolute height: %dpx",
style::absLengthVal (cssValue));
height =
misc::max (style::absLengthVal (cssValue) + boxDiffHeight (), 0);
std::max (style::absLengthVal (cssValue) + boxDiffHeight (), 0);
} else if (style::isPerLength (cssValue)) {
DBG_OBJ_MSGF ("resize", 1, "percentage height: %g%%",
100 *
style::perLengthVal_useThisOnlyForDebugging (cssValue));
if (usePercentage) {
if (refHeight != -1)
height = misc::max (applyPerHeight (refHeight, cssValue), 0);
height = std::max (applyPerHeight (refHeight, cssValue), 0);
else {
int availHeight = refWidget->getAvailHeight (forceValue);
if (availHeight != -1) {
int containerHeight = availHeight - refWidget->boxDiffHeight ();
height =
misc::max (applyPerHeight (containerHeight, cssValue), 0);
std::max (applyPerHeight (containerHeight, cssValue), 0);
} else
height = -1;
}
@ -1791,7 +1791,7 @@ int Widget::getAvailWidthOfChild (Widget *child, bool forceValue)
/* We only compute when forceValue is true */
if (forceValue) {
width = misc::max (getAvailWidth (true) - boxDiffWidth (), 0);
width = std::max (getAvailWidth (true) - boxDiffWidth (), 0);
if (width != -1) {
/* Clamp to min-width and max-width if given */
@ -1847,7 +1847,7 @@ int Widget::getAvailHeightOfChild (Widget *child, bool forceValue)
if (child->getStyle()->height == style::LENGTH_AUTO) {
DBG_OBJ_MSG ("resize", 1, "no specification");
if (forceValue)
height = misc::max (getAvailHeight (true) - boxDiffHeight (), 0);
height = std::max (getAvailHeight (true) - boxDiffHeight (), 0);
else
height = -1;
} else {
@ -1859,7 +1859,7 @@ int Widget::getAvailHeightOfChild (Widget *child, bool forceValue)
if (style::isAbsLength (child->getStyle()->height)) {
DBG_OBJ_MSGF ("resize", 1, "absolute height: %dpx",
style::absLengthVal (child->getStyle()->height));
height = misc::max (style::absLengthVal (child->getStyle()->height)
height = std::max (style::absLengthVal (child->getStyle()->height)
+ child->boxDiffHeight (), 0);
} else {
assert (style::isPerLength (child->getStyle()->height));
@ -1872,7 +1872,7 @@ int Widget::getAvailHeightOfChild (Widget *child, bool forceValue)
height = -1;
else
height =
misc::max (child->applyPerHeight (availHeight -
std::max (child->applyPerHeight (availHeight -
boxDiffHeight (),
child->getStyle()->height),
0);