Summary: | Implement repeating CSS3 gradients | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Simon Fraser (smfr) <simon.fraser> | ||||
Component: | CSS | Assignee: | Simon Fraser (smfr) <simon.fraser> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | krit, peter, simon.fraser, webmaster | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | PC | ||||||
OS: | OS X 10.5 | ||||||
URL: | http://dev.w3.org/csswg/css3-images/#gradients | ||||||
Attachments: |
|
Description
Simon Fraser (smfr)
2011-01-03 12:01:56 PST
Created attachment 78028 [details]
Patch
Comment on attachment 78028 [details]
Patch
The 60 lines of code in addStops might be better off in a separate function.
r=me though whatever you decide to do.
(In reply to comment #3) > http://trac.webkit.org/changeset/75097 Is it possible to pull this down to Gradient? This way platforms could benefit of their own implementations and we could reuse the code for SVG. (In reply to comment #4) > (In reply to comment #3) > > http://trac.webkit.org/changeset/75097 > > Is it possible to pull this down to Gradient? This way platforms could benefit of their own implementations and we could reuse the code for SVG. No, because you have to know the size of the box being rendered into to know how many repeats you add. This cannot be in Gradient, because a single Gradient may be re-used to render to different places. (In reply to comment #5) > (In reply to comment #4) > > (In reply to comment #3) > > > http://trac.webkit.org/changeset/75097 > > > > Is it possible to pull this down to Gradient? This way platforms could benefit of their own implementations and we could reuse the code for SVG. > > No, because you have to know the size of the box being rendered into to know how many repeats you add. > > This cannot be in Gradient, because a single Gradient may be re-used to render to different places. Hm. You're right, gradient should be as independent of the drawing area as possible to reuse it :-/ But you'Re adding the color stops manually, so reusing it might cause the gradient to be not-reusable as well. And what about adding supportsSpreadMethods() to Gradient and add a check CSSGradientValue::addStops? Platforms could decide for their own if they return true or false. setSpreadMethod is also able to handle more than just repeating and pad (default). Doesn't CSS support reflection as well (http://doc.trolltech.com/4.7/qradialgradient.html)? > Hm. You're right, gradient should be as independent of the drawing area as possible to reuse it :-/ But you're adding the color stops manually, so reusing it might cause the gradient to be not-reusable as well. In CSSGradientValue I know that this Gradient is only used to render into boxes of a given size. > And what about adding supportsSpreadMethods() to Gradient and add a check CSSGradientValue::addStops? Platforms could decide for their own if they return true or false. setSpreadMethod is also able to handle more than just repeating and pad (default). Doesn't CSS support reflection as well (http://doc.trolltech.com/4.7/qradialgradient.html)? That sounds OK. |