Bug 1291528 - Fix gradient scaling in nsCSSRendering::PaintGradient. r=mstange, a=ritu
authorEdwin Flores <eflores@mozilla.com>
Wed, 17 Aug 2016 09:26:11 +0100
changeset 350252 c9d493c82e38023fd0a4f59bc7b60123bb66d170
parent 350251 d16c69ae7598faae957bfc58311cee859dab1632
child 350253 896ec9bfee489ed22542320b2a3b10fac74081a7
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange, ritu
bugs1291528
milestone50.0a2
Bug 1291528 - Fix gradient scaling in nsCSSRendering::PaintGradient. r=mstange, a=ritu
layout/base/nsCSSRendering.cpp
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -2740,25 +2740,25 @@ nsCSSRendering::PaintGradient(nsPresCont
     // right way up.
     if (lineStart.x > lineEnd.x || lineStart.y > lineEnd.y) {
       std::swap(lineStart, lineEnd);
       matrix.Scale(-1, -1);
     }
 
     // Fit the gradient line exactly into the source rect.
     if (lineStart.x != lineEnd.x) {
-      rectLen = srcSize.width;
+      rectLen = aPresContext->CSSPixelsToDevPixels(aSrc.width);
       offset = ((double)aSrc.x - lineStart.x) / lineLength;
       lineStart.x = aSrc.x;
-      lineEnd.x = aSrc.x + srcSize.width;
+      lineEnd.x = aSrc.x + rectLen;
     } else {
-      rectLen = srcSize.height;
+      rectLen = aPresContext->CSSPixelsToDevPixels(aSrc.height);
       offset = ((double)aSrc.y - lineStart.y) / lineLength;
       lineStart.y = aSrc.y;
-      lineEnd.y = aSrc.y + srcSize.height;
+      lineEnd.y = aSrc.y + rectLen;
     }
 
     // Adjust gradient stop positions for the new gradient line.
     double scale = lineLength / rectLen;
     for (size_t i = 0; i < stops.Length(); i++) {
       stops[i].mPosition = (stops[i].mPosition - offset) * fabs(scale);
     }