Closed Bug 1638051 Opened 4 years ago Closed 4 years ago

Incorrect rendering of SVG <radialGradient>s where the start circle is outside the end circle

Categories

(Core :: SVG, defect)

defect

Tracking

()

VERIFIED FIXED
mozilla79
Tracking Status
firefox79 --- verified

People

(Reporter: fsoder, Assigned: longsonr)

References

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36 OPR/68.0.3618.55 (Edition beta)

Steps to reproduce:

Load the attached testcase.

Actual results:

The top gradient (using SVG <radialGradient>) renders differently to the same gradient (the bottom gradient) rendered using <canvas>. It appears to clamp the location of the start circle ('fx', 'fy', 'fr') to the edge of the end circle ('cx', 'cy', 'r').

Expected results:

The top and bottom gradients should look the same.

The clamping of the location seems to follow SVG 1.1: https://www.w3.org/TR/SVG11/pservers.html#RadialGradients
But per SVG2 there should be no clamping: https://svgwg.org/svg2-draft/pservers.html#RadialGradientNotes

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Canvas: 2D
Product: Firefox → Core
Component: Canvas: 2D → SVG

Removing the clamping makes the reporters testcase work but other gradients (i.e. two of the gradients in https://dxr.mozilla.org/mozilla-central/source/layout/reftests/svg/radialGradient-basic-03.svg) are oddly cut off. Chrome cuts them off too, Safari displays the parts that Firefox and Chrome cut off in black.

Severity: -- → S4

We have to remove one of the radialGradient-basic-03-ref.svg tests (id=gradient5)
because it's testing clamping i.e. an fr just inside the radius is the same as
just outside and that's no longer true. Two of the other references are now different
due to the lack of clamping. Note that the test and reference are similar but
not identical gradients so we're not expecting an exact match here.

Assignee: nobody → longsonr
Status: NEW → ASSIGNED

This change makes us match Chrome, but not Safari. Safari doesn't clamp but displays black areas if the gradient would have been subject to SVG 1.1 clamping. We also now match canvas.

Pushed by longsonr@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/c98948afa16b
Stop clamping radialGradients. r=dholbert
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
QA Whiteboard: [qa-79b-p2]

Reproduced with Firefox 78.0a1 (20200514211114) on Ubuntu 18.04 and Windows 10x64 using the attached test case.
The issue is verified fixed with Firefox 79.0b9 on Windows 10x64, macOS 10.12 and Ubuntu 18.04.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-79b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: