Bug 12064 - Need function for manual style-resolution for things like gradient stops
Summary: Need function for manual style-resolution for things like gradient stops
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
: 12545 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-01-01 18:52 PST by Eric Seidel (no email)
Modified: 2007-08-21 14:34 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2007-01-01 18:52:35 PST
Need function for manual style-resolution for things like gradient stops

Vector<SVGGradientStop> SVGGradientElement::buildStops() const
    // FIXME: Manual style resolution is a hack
    RenderStyle* gradientStyle = const_cast<SVGGradientElement*>(this)->styleForRenderer(parent()->renderer());


Gradient stops must inherit style via CSS.  The WebCore render tree is optimized not to bother computing styles for any node which does not have a renderer.  Furthermore, if anynode does not have a renderer, none of its ancestors do either.  Thus nodes like <defs> cause style resolution trouble.

In these cases, there should be a special function styleForResolution() (or better named), which can be used by SVG element which need to resolve style across "holes" in the render tree (as are to be expected by things such as <defs> <*Gradient> and possibly eventually <pattern>.

Right now the current solution for gradients breaks when gradients are inside <defs> (I think).
Comment 1 Dave Hyatt 2007-01-01 18:56:14 PST
We should chat about this at some point.  I don't think you need a new function necessarily.
Comment 2 Eric Seidel (no email) 2007-01-01 18:58:29 PST
I'm not sure I'm able to come up with a test case to demonstrate this.   This one seems to work fine in TOT:

<svg xmlns="http://www.w3.org/2000/svg" style='color: green'>
    <defs>
        <linearGradient id='gradient' x2='5'>
            <stop offset='0' stop-color='currentColor' />
            <stop offset='1' stop-color='red' />
        </linearGradient>
    </defs>
    <rect fill="url(#gradient)" width='100px' height='100px' />
</svg>

I still think a function do use to do this more cleanly would be nice.
Comment 3 Eric Seidel (no email) 2007-01-15 01:49:33 PST
An alternative way to fix all this is to actually make gradient stops have real renderers with real styles, such as suggested in:
http://bugs.webkit.org/show_bug.cgi?id=12193

This would also require <defs> to have a renderer, as mentioned in:
http://bugs.webkit.org/show_bug.cgi?id=12207
Comment 4 Eric Seidel (no email) 2007-06-12 10:29:25 PDT
*** Bug 12545 has been marked as a duplicate of this bug. ***
Comment 5 Nikolas Zimmermann 2007-08-21 14:34:28 PDT
Landed in r25175.