diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /gfx/wr/webrender_api/src/gradient_builder.rs | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/wr/webrender_api/src/gradient_builder.rs')
-rw-r--r-- | gfx/wr/webrender_api/src/gradient_builder.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gfx/wr/webrender_api/src/gradient_builder.rs b/gfx/wr/webrender_api/src/gradient_builder.rs index 6347396f79..545b2d328a 100644 --- a/gfx/wr/webrender_api/src/gradient_builder.rs +++ b/gfx/wr/webrender_api/src/gradient_builder.rs @@ -132,10 +132,6 @@ impl GradientBuilder { let first = *stops.first().unwrap(); let last = *stops.last().unwrap(); - // Express the assertion so that if one of the offsets is NaN, we don't panic - // and instead take the branch that handles degenerate gradients. - assert!(!(first.offset > last.offset)); - let stops_delta = last.offset - first.offset; if stops_delta > 0.000001 { @@ -144,6 +140,14 @@ impl GradientBuilder { } (first.offset, last.offset) + } else if stops_delta.is_nan() { + // We have no good way to render a NaN offset, but make something + // that is at least renderable. + stops.clear(); + stops.push(di::GradientStop { color: last.color, offset: 0.0, }); + stops.push(di::GradientStop { color: last.color, offset: 1.0, }); + + (0.0, 1.0) } else { // We have a degenerate gradient and can't accurately transform the stops // what happens here depends on the repeat behavior, but in any case |