Bug 1707930 - Account for reversed stops in the gradient cache key. r=gfx-reviewers,lsalzman

WebRender internally reverses gradient stops when they are ordered from right to left. This is done while building the GPU data and the gradient cache key stored the reversed stops without sepcifying if they were revered or originally in that order. This meant that if a page had two similar gradients with the only difference being that on was reversed but not the other, they could end up using the same cache key and one of the two would not be rendered properly.

This patch includes a boolean in the cache key to make sure reversed gradients don't accidentally use the same key as similar non-reversed gradients.

Differential Revision: https://phabricator.services.mozilla.com/D113975
This commit is contained in:
Nicolas Silva 2021-05-03 09:12:43 +00:00
Родитель 06ef812482
Коммит ab62b81a1f
17 изменённых файлов: 29 добавлений и 14 удалений

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

@ -512,6 +512,7 @@ impl LinearGradientTemplate {
scale: PointKey { x: self.scale.x, y: self.scale.y },
extend_mode: self.extend_mode,
stops: self.stops.iter().map(|stop| (*stop).into()).collect(),
reversed_stops: self.reverse_stops,
};
frame_state.resource_cache.request_render_task(
@ -706,4 +707,5 @@ pub struct LinearGradientCacheKey {
pub scale: PointKey,
pub extend_mode: ExtendMode,
pub stops: Vec<GradientStopKey>,
pub reversed_stops: bool,
}

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

@ -0,0 +1,13 @@
---
root:
items:
- type: gradient
bounds: 50 50 100 100
start: 0 0
end: 110 0
stops: [0.0, white, 1.0, black]
- type: gradient
bounds: 150 50 100 100
start: 0 0
end: 110 0
stops: [0.0, black, 1.0, white]

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

@ -0,0 +1,13 @@
---
root:
items:
- type: gradient
bounds: 50 50 100 100
start: 0 0
end: 110 0
stops: [0.0, white, 1.0, black]
- type: gradient
bounds: 150 50 100 100
start: 110 0
end: 0 0
stops: [0.0, white, 1.0, black]

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

@ -11,6 +11,7 @@ platform(linux,mac) == premultiplied-conic-2.yaml premultiplied-conic-2.png
== linear.yaml linear-ref.png
== linear-reverse.yaml linear-ref.png
fuzzy(255,1200) == linear-reverse-2.yaml linear-reverse-2-ref.yaml
== linear-reverse-3.yaml linear-reverse-3-ref.yaml
platform(linux,mac) fuzzy(1,35000) == linear-stops.yaml linear-stops-ref.png
== linear-clamp-1a.yaml linear-clamp-1-ref.yaml

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

@ -1,3 +1 @@
[shape-outside-linear-gradient-002.html]
expected:
if webrender and not swgl: FAIL

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

@ -1,4 +1,3 @@
[shape-outside-linear-gradient-005.html]
expected:
if webrender and not swgl: FAIL
if (os == "mac") and not webrender: FAIL

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

@ -1,4 +1,3 @@
[shape-outside-linear-gradient-006.html]
expected:
if webrender and not swgl: FAIL
if (os == "mac") and not webrender: FAIL

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

@ -1,4 +1,3 @@
[shape-outside-linear-gradient-007.html]
expected:
if webrender and not swgl: FAIL
if (os == "mac") and not webrender: FAIL

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

@ -1,4 +1,3 @@
[shape-outside-linear-gradient-008.html]
expected:
if webrender and not swgl: FAIL
if (os == "mac") and not webrender: FAIL

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

@ -1,4 +1,3 @@
[shape-outside-linear-gradient-009.html]
expected:
if webrender and not swgl: FAIL
if (os == "mac") and not webrender: FAIL

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

@ -1,4 +1,3 @@
[shape-outside-linear-gradient-010.html]
expected:
if webrender and not swgl: FAIL
if (os == "mac") and not webrender: FAIL

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

@ -1,4 +1,3 @@
[shape-outside-linear-gradient-011.html]
expected:
if webrender and not swgl: FAIL
if (os == "mac") and not webrender: FAIL

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

@ -1,4 +1,3 @@
[shape-outside-linear-gradient-012.html]
expected:
if webrender and not swgl: FAIL
if (os == "mac") and not webrender: FAIL

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

@ -1,4 +1,3 @@
[shape-outside-linear-gradient-013.html]
expected:
if webrender and not swgl: FAIL
if (os == "mac") and not webrender: FAIL

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

@ -1,4 +1,3 @@
[shape-outside-linear-gradient-014.html]
expected:
if webrender and not swgl: FAIL
if (os == "mac") and not webrender: FAIL

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

@ -1,4 +1,3 @@
[shape-outside-linear-gradient-015.html]
expected:
if webrender and not swgl: FAIL
if (os == "mac") and not webrender: FAIL

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

@ -1,4 +1,3 @@
[shape-outside-linear-gradient-016.html]
expected:
if webrender and not swgl: FAIL
if (os == "mac") and not webrender: FAIL