Bug 1025833 - Fix img srcset inadvertently rounding density estimate to nearest int. r=jst, a=lmandel
authorJohn Schoenick <jschoenick@mozilla.com>
Mon, 16 Jun 2014 12:53:36 -0700
changeset 207427 8d78b04d12cba5b7663cd091f7ec6bae7ce4bdd3
parent 207426 0c3b5dc32458d604393516df62835dd2ce994fa6
child 207428 8bc2222d4b0d2ccd157cbb1340e55904f0b25b21
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst, lmandel
bugs1025833
milestone32.0a2
Bug 1025833 - Fix img srcset inadvertently rounding density estimate to nearest int. r=jst, a=lmandel
content/base/src/ResponsiveImageSelector.cpp
--- a/content/base/src/ResponsiveImageSelector.cpp
+++ b/content/base/src/ResponsiveImageSelector.cpp
@@ -222,17 +222,17 @@ ResponsiveImageSelector::GetBestCandidat
   nsIPresShell *shell = doc ? doc->GetShell() : nullptr;
   nsPresContext *pctx = shell ? shell->GetPresContext() : nullptr;
 
   if (!pctx) {
     MOZ_ASSERT(false, "Unable to find document prescontext");
     return -1;
   }
 
-  double displayDensity = pctx->CSSPixelsToDevPixels(1);
+  double displayDensity = pctx->CSSPixelsToDevPixels(1.0f);
 
   // Per spec, "In a UA-specific manner, choose one image source"
   // - For now, select the lowest density greater than displayDensity, otherwise
   //   the greatest density available
 
   int bestIndex = 0; // First index will always be the best so far
   double bestDensity = mCandidates[bestIndex].Density();
   for (int i = 1; i < numCandidates; i++) {