summaryrefslogtreecommitdiffstats
path: root/layout/base
diff options
context:
space:
mode:
authorJustOff <Off.Just.Off@gmail.com>2019-03-21 21:45:08 +0200
committerJustOff <Off.Just.Off@gmail.com>2019-03-21 21:45:08 +0200
commit96dfb2e6dfe677c3b79d6fc5710057a848007db1 (patch)
treedb8ddccd82f664da7d64e329e035029e69545944 /layout/base
parent890bb438b000821586c076ed8f880e95ea03f075 (diff)
downloadUXP-96dfb2e6dfe677c3b79d6fc5710057a848007db1.tar
UXP-96dfb2e6dfe677c3b79d6fc5710057a848007db1.tar.gz
UXP-96dfb2e6dfe677c3b79d6fc5710057a848007db1.tar.lz
UXP-96dfb2e6dfe677c3b79d6fc5710057a848007db1.tar.xz
UXP-96dfb2e6dfe677c3b79d6fc5710057a848007db1.zip
The result of adding any percentage factor to a size that is zero should also be zero
Diffstat (limited to 'layout/base')
-rw-r--r--layout/base/nsLayoutUtils.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index 63253fd10..0a82dbf6a 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -1439,13 +1439,14 @@ public:
/**
* This function increases an initial intrinsic size, 'aCurrent', according
* to the given 'aPercent', such that the size-increase makes up exactly
- * 'aPercent' percent of the returned value. If 'aPercent' is less than
- * or equal to zero the original 'aCurrent' value is returned. If 'aPercent'
- * is greater than or equal to 1.0 the value nscoord_MAX is returned.
+ * 'aPercent' percent of the returned value. If 'aPercent' or 'aCurrent' are
+ * less than or equal to zero the original 'aCurrent' value is returned.
+ * If 'aPercent' is greater than or equal to 1.0 the value nscoord_MAX is
+ * returned.
*/
static nscoord AddPercents(nscoord aCurrent, float aPercent)
{
- if (aPercent > 0.0f) {
+ if (aPercent > 0.0f && aCurrent > 0) {
return MOZ_UNLIKELY(aPercent >= 1.0f) ? nscoord_MAX
: NSToCoordRound(float(aCurrent) / (1.0f - aPercent));
}