Bug 1487978 - Fix C4305 warning on msvc from bug 1471086.
authorXidorn Quan <me@upsuper.org>
Mon, 03 Sep 2018 11:45:32 +1000
changeset 434448 983079ec9a0d669b16e9fd03b58c4f9465ebc02c
parent 434447 cf8715e6d27c3ffb96278eba968a8a460435f2d4
child 434449 b1eb8b58455a174f42f2eb10b7a1e4c9d0c469ca
push id34559
push useraciure@mozilla.com
push dateMon, 03 Sep 2018 09:35:47 +0000
treeherdermozilla-central@2a4cf603095a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1487978, 1471086
milestone63.0a1
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 1487978 - Fix C4305 warning on msvc from bug 1471086.
widget/windows/nsNativeThemeWin.cpp
--- a/widget/windows/nsNativeThemeWin.cpp
+++ b/widget/windows/nsNativeThemeWin.cpp
@@ -4219,27 +4219,27 @@ GetScrollbarButtonColor(nscolor aTrackCo
 
   bool isActive = aStates.HasState(NS_EVENT_STATE_ACTIVE);
   bool isHover = aStates.HasState(NS_EVENT_STATE_HOVER);
   if (!isActive && !isHover) {
     return aTrackColor;
   }
   float luminance = RelativeLuminanceUtils::Compute(aTrackColor);
   if (isActive) {
-    if (luminance >= 0.18) {
-      luminance *= 0.134;
+    if (luminance >= 0.18f) {
+      luminance *= 0.134f;
     } else {
-      luminance /= 0.134;
+      luminance /= 0.134f;
       luminance = std::min(luminance, 1.0f);
     }
   } else {
-    if (luminance >= 0.18) {
-      luminance *= 0.805;
+    if (luminance >= 0.18f) {
+      luminance *= 0.805f;
     } else {
-      luminance /= 0.805;
+      luminance /= 0.805f;
     }
   }
   return RelativeLuminanceUtils::Adjust(aTrackColor, luminance);
 }
 
 static nscolor
 GetScrollbarArrowColor(nscolor aButtonColor)
 {
@@ -4290,26 +4290,26 @@ AdjustScrollbarFaceColor(nscolor aFaceCo
 
   bool isActive = aStates.HasState(NS_EVENT_STATE_ACTIVE);
   bool isHover = aStates.HasState(NS_EVENT_STATE_HOVER);
   if (!isActive && !isHover) {
     return aFaceColor;
   }
   float luminance = RelativeLuminanceUtils::Compute(aFaceColor);
   if (isActive) {
-    if (luminance >= 0.18) {
-      luminance *= 0.192;
+    if (luminance >= 0.18f) {
+      luminance *= 0.192f;
     } else {
-      luminance /= 0.192;
+      luminance /= 0.192f;
     }
   } else {
-    if (luminance >= 0.18) {
-      luminance *= 0.625;
+    if (luminance >= 0.18f) {
+      luminance *= 0.625f;
     } else {
-      luminance /= 0.625;
+      luminance /= 0.625f;
     }
   }
   return RelativeLuminanceUtils::Adjust(aFaceColor, luminance);
 }
 
 // This tries to draw a Windows 10 style scrollbar with given colors.
 nsresult
 nsNativeThemeWin::DrawCustomScrollbarPart(gfxContext* aContext,