Closed Bug 441780 Opened 16 years ago Closed 16 years ago

SVG radialGradient won't be rendered correct when focus point is moved (outside the radius)

Categories

(Core :: SVG, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.9.1b3

People

(Reporter: paroga, Assigned: longsonr)

References

Details

(Keywords: regression, testcase, verified1.9.1)

Attachments

(5 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9) Gecko/2008052906 Firefox/3.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9) Gecko/2008052906 Firefox/3.0

Try the SVG.

Reproducible: Always

Steps to Reproduce:
Try the following SVG:
<svg xmlns="http://www.w3.org/2000/svg">
	<defs>
		<radialGradient id="gradient1" fx="0">
			<stop offset="0" style="stop-color:#FF0000;stop-opacity:1" />
			<stop offset="1" style="stop-color:#00FF00;stop-opacity:1" />
		</radialGradient>
		<radialGradient id="gradient2" r="0.4" fx="0.1">
			<stop offset="0" style="stop-color:#FF0000;stop-opacity:1" />
			<stop offset="1" style="stop-color:#00FF00;stop-opacity:1" />
		</radialGradient>
		<radialGradient id="gradient3" r="0.4" fx="0.2">
			<stop offset="0" style="stop-color:#FF0000;stop-opacity:1" />
			<stop offset="1" style="stop-color:#00FF00;stop-opacity:1" />
		</radialGradient>
		<radialGradient id="gradient4" fx="1">
			<stop offset="0" style="stop-color:#FF0000;stop-opacity:1" />
			<stop offset="1" style="stop-color:#00FF00;stop-opacity:1" />
		</radialGradient>
		<radialGradient id="gradient5" r="0.7" fx="1.3">
			<stop offset="0" style="stop-color:#FF0000;stop-opacity:1" />
			<stop offset="1" style="stop-color:#00FF00;stop-opacity:1" />
		</radialGradient>
		<radialGradient id="gradient6" r="0.6" fx="1.3">
			<stop offset="0" style="stop-color:#FF0000;stop-opacity:1" />
			<stop offset="1" style="stop-color:#00FF00;stop-opacity:1" />
		</radialGradient>
	</defs>
	<circle cx="100" cy="100" r="50" style="fill:url(#gradient1);" />
	<circle cx="100" cy="200" r="50" style="fill:url(#gradient2);" />
	<circle cx="100" cy="300" r="50" style="fill:url(#gradient3);" />
	<circle cx="200" cy="100" r="50" style="fill:url(#gradient4);" />
	<circle cx="200" cy="200" r="50" style="fill:url(#gradient5);" />
	<circle cx="200" cy="300" r="50" style="fill:url(#gradient6);" />
</svg>
Actual Results:  
Some gradients are handled incorrect.


In Firefox 2 the gradients rendered correctly.
Can you add the SVG as an attachment please? Also a screenshot of what you expect it to look like would be nice.
Component: General → SVG
Product: Firefox → Core
QA Contact: general → general
Attached image The SVG as file
Attached image Rendering in Firefox 2
Attached image Rendering in Firefox 3
Keywords: testcase
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
A regression range would help.
CC'ing Vlad on this regression from the 16.16 work.
Attached patch patch (obsolete) — Splinter Review
Comment on attachment 352940 [details] [diff] [review]
patch

The key thing is that .99 < 127/128 which is the limit of 24.8 resolution.
Attachment #352940 - Flags: review?(jwatt)
Assignee: nobody → longsonr
Comment on attachment 352940 [details] [diff] [review]
patch

Nice! r=jwatt. Can you also note this in the comment? Perhaps append the following:


>     // The focal point (fFx and fFy) must be clamped to be *inside* - not on -
>
>     // the circumference of the gradient or we'll get rendering anomalies. We
>
>     // calculate the distance from the focal point to the gradient center and
>
>-    // make sure it is *less* than the gradient radius. 0.999 is used as the
>
>+    // make sure it is *less* than the gradient radius. 0.99 is used as the
>
>     // factor of the radius because it's close enough to 1 that we won't get a
>
>     // fringe at the edge of the gradient if we clamp, but not so close to 1
>
>     // that rounding error will give us the same results as using fR itself.


    // Also note that .99 < 127/128, which is the limit of the fractional part of
    // cairo's 24.8 fixed point representation.
Attachment #352940 - Flags: review?(jwatt) → review+
Attachment #352940 - Attachment is obsolete: true
Attachment #353029 - Flags: superreview?(roc)
Attachment #353029 - Flags: superreview?(roc) → superreview+
Keywords: checkin-needed
Whiteboard: check in the patch and the reftest
Attachment #353029 - Flags: approval1.9.1?
Comment on attachment 353029 [details] [diff] [review]
address review comment
[Checkin: Comment 15 & 18]

Simple low risk change that fixes a regression we've had since Firefox 2
Pushed 05bf7c30877e to trunk.
Status: NEW → RESOLVED
Closed: 16 years ago
Flags: in-testsuite+
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: check in the patch and the reftest
I agree we should have this for 3.1.
Flags: blocking1.9.1?
Flags: blocking1.9.1? → blocking1.9.1+
Whiteboard: [needs 191 landing]
Comment on attachment 353029 [details] [diff] [review]
address review comment
[Checkin: Comment 15 & 18]

Since this blocks, we no longer need 1.9.1 approval
Attachment #353029 - Flags: approval1.9.1?
Keywords: checkin-needed
Whiteboard: [needs 191 landing] → [needs 191 landing] check in patch and reftest to 1.9.1
Attachment #353029 - Attachment description: address review comment → address review comment [Checkin: Comment 15 & 18]
Attachment #353160 - Attachment description: reftest → reftest [Checkin: Comment 15 & 18]
http://hg.mozilla.org/releases/mozilla-1.9.1/rev/dc2948a5ba22
Whiteboard: [needs 191 landing] check in patch and reftest to 1.9.1
Target Milestone: --- → mozilla1.9.1b3
verified FIXED on builds:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.1pre) Gecko/20090720 Shiretoko/3.5.1pre ID:20090720042942

and

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2a1pre) Gecko/20090721 Minefield/3.6a1pre ID:20090721044139
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: