Bug 646731. Avoid float-to-double promotion in Is(Margin|Pading)Zero. r=dbaron
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Fri, 08 Apr 2011 10:59:52 -0700
changeset 67624 8adbca2b3518bb5ee2c22940a51a89f0dcb1968c
parent 67623 760c50e2239a82bac1ca7bc43f3b5c17459b5295
child 67665 1d17596bbf5f830272cd8b1d3cacaf742451cf3c
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs646731
milestone2.2a1pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 646731. Avoid float-to-double promotion in Is(Margin|Pading)Zero. r=dbaron Caught with -Wdouble-promotion. This may not impact codegen but it's more correct.
layout/base/nsLayoutUtils.h
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -868,29 +868,29 @@ public:
            (aCBHeight == NS_AUTOHEIGHT && aCoord.HasPercent());
   }
 
   static PRBool IsPaddingZero(const nsStyleCoord &aCoord)
   {
     return (aCoord.GetUnit() == eStyleUnit_Coord &&
             aCoord.GetCoordValue() == 0) ||
            (aCoord.GetUnit() == eStyleUnit_Percent &&
-            aCoord.GetPercentValue() == 0.0) ||
+            aCoord.GetPercentValue() == 0.0f) ||
            (aCoord.IsCalcUnit() &&
             // clamp negative calc() to 0
             nsRuleNode::ComputeCoordPercentCalc(aCoord, nscoord_MAX) <= 0 &&
             nsRuleNode::ComputeCoordPercentCalc(aCoord, 0) <= 0);
   }
 
   static PRBool IsMarginZero(const nsStyleCoord &aCoord)
   {
     return (aCoord.GetUnit() == eStyleUnit_Coord &&
             aCoord.GetCoordValue() == 0) ||
            (aCoord.GetUnit() == eStyleUnit_Percent &&
-            aCoord.GetPercentValue() == 0.0) ||
+            aCoord.GetPercentValue() == 0.0f) ||
            (aCoord.IsCalcUnit() &&
             nsRuleNode::ComputeCoordPercentCalc(aCoord, nscoord_MAX) == 0 &&
             nsRuleNode::ComputeCoordPercentCalc(aCoord, 0) == 0);
   }
 
   /*
    * Calculate the used values for 'width' and 'height' for a replaced element.
    *