Bug 1278214 - ensure operation result is floating point. r?mats draft
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Mon, 06 Jun 2016 17:14:37 +0300
changeset 375675 a0376869fab3642e76047ff246d620a1eaff1817
parent 375369 3e8ee3599a67edd971770af4982ad4b0fe77f073
child 522937 0295d5ec588559a81d5856ef9c02d87159b1d5bc
push id20349
push userBogdan.Postelnicu@softvision.ro
push dateMon, 06 Jun 2016 14:15:10 +0000
reviewersmats
bugs1278214
milestone49.0a1
Bug 1278214 - ensure operation result is floating point. r?mats MozReview-Commit-ID: AwIH4G2GlPv
layout/base/nsCSSRendering.cpp
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -3329,17 +3329,17 @@ ComputeDrawnSizeForBackground(const CSSS
  * aAvailableSpace: the background positioning area width/height
  * aRepeatSize: the image size plus gap size of app units for use as spacing
  * aRepeat: determine whether the image is repeated
  */
 static nscoord
 ComputeSpacedRepeatSize(nscoord aImageDimension,
                         nscoord aAvailableSpace,
                         bool& aRepeat) {
-  float ratio = aAvailableSpace / aImageDimension;
+  float ratio = static_cast<float>(aAvailableSpace) / aImageDimension;
 
   if (ratio < 2.0f) { // If you can't repeat at least twice, then don't repeat.
     aRepeat = false;
     return aImageDimension;
   } else {
     aRepeat = true;
     return (aAvailableSpace - aImageDimension) / (NSToIntFloor(ratio) - 1);
   }