RESOLVED FIXED 30286
SVG Gradients can't handle percentage values in userSpaceOnUse mode
https://bugs.webkit.org/show_bug.cgi?id=30286
Summary SVG Gradients can't handle percentage values in userSpaceOnUse mode
Dirk Schulze
Reported 2009-10-11 14:59:02 PDT
Created attachment 41004 [details] Gradient in userspaceOnUse and percentage values On using gradientSpace="userSpaceOnUse" we can't handle x,y,width,height values in percentage correct. The percentage should use the Userspace as refernce. The example in the attachement shows the problem. The above 3 rects schould look like the 3 rects on the bottom.
Attachments
Gradient in userspaceOnUse and percentage values (1.28 KB, image/svg+xml)
2009-10-11 14:59 PDT, Dirk Schulze
no flags
linearGradient userSpaceOnUse with percentage (11.61 KB, patch)
2009-10-12 05:30 PDT, Dirk Schulze
eric: review-
gradient userSpaceOnUse with values in percentage (169.90 KB, patch)
2009-10-12 15:38 PDT, Dirk Schulze
no flags
Dirk Schulze
Comment 1 2009-10-12 05:30:48 PDT
Created attachment 41033 [details] linearGradient userSpaceOnUse with percentage Some clean up. The problem was, that we transformed the values x1, ... y2 to doubles, saved them in LinearGradientAttributes and didn't differ between objectBoundingBox and userSpaceOnUse later. I removed LinearGradientAttributes and take the values of SVGLinearGradientElement directly. We needed LinearGradientAttributes to draw the gradients on the old platform dependent code of SVGPaintServer. We don't need it anymore and calculate the box in the element itself. The same has to be done on radialGradient too. I'll work on it once this code is landed. I'll create the test results at home.
Eric Seidel (no email)
Comment 2 2009-10-12 07:11:34 PDT
Comment on attachment 41033 [details] linearGradient userSpaceOnUse with percentage This needs a ChangeLog and a test. Otherwise I think this is a good change, but can't really tell.
Nikolas Zimmermann
Comment 3 2009-10-12 09:24:23 PDT
Hm, on first sight the change looks wrong to me. The whole idea behind LinearGradientAttributes is to correctly handle deep-nested gradients (aka. gradient referencing another gradient using xlink:href). We need to be careful to take the _right_ x1/y1/.. values from the correct origin. Are you sure this doesn't break existing tests? If it doesn't, something is wrong :-)
Dirk Schulze
Comment 4 2009-10-12 15:38:33 PDT
Created attachment 41064 [details] gradient userSpaceOnUse with values in percentage This patch fixes both radial as well as linear gradients. It gives GradientAttributes SVGLength values instead of double. This makes it possible to calculate the correct result on userSpaceOnUse mode with values in percentage.
Nikolas Zimmermann
Comment 5 2009-10-12 15:45:16 PDT
Comment on attachment 41064 [details] gradient userSpaceOnUse with values in percentage Excellent job, r=me.
WebKit Commit Bot
Comment 6 2009-10-12 16:05:30 PDT
Comment on attachment 41064 [details] gradient userSpaceOnUse with values in percentage Clearing flags on attachment: 41064 Committed r49481: <http://trac.webkit.org/changeset/49481>
WebKit Commit Bot
Comment 7 2009-10-12 16:05:34 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.