Bug 916535. Avoid using repeating gradients for tiling when it won't work. r=roc

Avoiding normalization introduced in bug 895135 caused gradientStart/Stop to
not correspond to the firstStop and lastStop. This can cause us to incorrectly
decide to use the repeat fast path. This patch switches takes us back to the
same condition as we had before the regression.

--HG--
extra : rebase_source : f335e1db9166213115354eb14dbe90b09127a68b
This commit is contained in:
Jeff Muizelaar 2013-09-24 00:04:36 -04:00
Родитель f0029d8a39
Коммит 7480685294
4 изменённых файлов: 57 добавлений и 4 удалений

Просмотреть файл

@ -2354,6 +2354,8 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
// stops have been normalized.
gfxPoint gradientStart = lineStart + (lineEnd - lineStart)*stopOrigin;
gfxPoint gradientEnd = lineStart + (lineEnd - lineStart)*stopEnd;
gfxPoint gradientStopStart = lineStart + (lineEnd - lineStart)*firstStop;
gfxPoint gradientStopEnd = lineStart + (lineEnd - lineStart)*lastStop;
if (stopDelta == 0.0) {
// Stops are all at the same place. For repeating gradients, this will
@ -2363,6 +2365,7 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
// our stops will be at 0.0; we just need to set the direction vector
// correctly.
gradientEnd = gradientStart + (lineEnd - lineStart);
gradientStopEnd = gradientStopStart + (lineEnd - lineStart);
}
gradientPattern = new gfxPattern(gradientStart.x, gradientStart.y,
@ -2372,10 +2375,10 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
// to the right edge of a tile, then we can repeat by just repeating the
// gradient.
if (!cellContainsFill &&
((gradientStart.y == gradientEnd.y && gradientStart.x == 0 &&
gradientEnd.x == oneCellArea.width) ||
(gradientStart.x == gradientEnd.x && gradientStart.y == 0 &&
gradientEnd.y == oneCellArea.height))) {
((gradientStopStart.y == gradientStopEnd.y && gradientStopStart.x == 0 &&
gradientStopEnd.x == oneCellArea.width) ||
(gradientStopStart.x == gradientStopEnd.x && gradientStopStart.y == 0 &&
gradientStopEnd.y == oneCellArea.height))) {
forceRepeatToCoverTiles = true;
}
} else {

Просмотреть файл

@ -0,0 +1,24 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Grid</title>
<style>
body {
background: #fff;
}
.r {background: red; width: 300px; height: 50px}
.g {background: green; width: 300px; height: 50px}
</style>
</head>
<body>
<div class=r></div>
<div class=g></div>
<div class=r></div>
<div class=g></div>
<div class=r></div>
<div class=g></div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,25 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Grid</title>
<style>
body {
background: #fff;
}
div {
width: 300px;
height: 300px;
background-color: #269;
background-size: 100px 100px;
background-image:
linear-gradient( red 50px, green 50px);
}
</style>
</head>
<body>
<div ></div>
</body>
</html>

Просмотреть файл

@ -136,3 +136,4 @@ fuzzy-if(d2d,47,400) == linear-onestopposition-1.html linear-onestopposition-1-r
== repeating-radial-onestopposition-1a.html orange-square.html
== repeating-radial-onestopposition-1b.html orange-square.html
== repeating-radial-onestopposition-1c.html orange-square.html
== bug-916535-background-repeat-linear.html bug-916535-background-repeat-linear-ref.html