Bug 1291528 - Fix gradient scaling in nsCSSRendering::PaintGradient. r=mstange, a=ritu
--- 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);
}