Re: [css3-images] Defining SVG paint servers as a CSS <image>

On Wed, 22 Jun 2011 02:53:12 +0200, Tab Atkins Jr. <jackalmage@gmail.com>  
wrote:

> On Tue, Jun 21, 2011 at 1:56 PM, Rik Cabanier <cabanier@gmail.com> wrote:
>> On Tue, Jun 21, 2011 at 1:12 PM, Tab Atkins Jr. <jackalmage@gmail.com>
>> wrote:
>>> On Tue, Jun 21, 2011 at 12:19 PM, Rik Cabanier <cabanier@gmail.com>  
>>> wrote:
>>> > It would even be better if there was a way that you could refer to a  
>>> SVG
>>> > symbol instead of a paint server.
>>> > We're working on converting Flash content to HTML+SVG and if the
>>> > animation
>>> > is complex, we create many external SVG files.
>>> > The size of the SVG files is not a problem but having to do a http
>>> > request
>>> > for each one causes a lot of overhead.
>>> > If we could refer to symbols, we could put all our content in 1  
>>> external
>>> > file which is much more efficient...
>>>
>>> That's theoretically doable by just targetting <svg> subelements
>>> directly, right?
>>
>> Correct but it requires JavaScript to make it work.
>
> Hmm, you miss my point.  The ability to refer to a single sub-<svg> of
> a larger SVG is part of the spec, right?  I think nobody does it, but
> I'll assume for now that it's something that can be fixed.

I think Firefox has some support of this for the 'background' property  
when used with SVG images, correct me if I'm wrong. I don't think all  
aspects of that is defined, e.g what coordinate space to use if you  
reference a sub-svg. Also see the fragment syntax defined for svg[1]. If  
that syntax applies then you could use one svg with several views defined  
as an option.

One thing to note is that unless the url was absolute it would be resolved  
against the base location of the stylesheet (which isn't always what you  
want), e.g background: (some.svg#foo) will only work if the file is in the  
right place. It might be nice to be able to mix the svg content into the  
html file and to reference the svg parts from a stylesheet without having  
to specify the file/location.

[1] http://www.w3.org/TR/SVG11/linking.html#LinksIntoSVG

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed

Received on Wednesday, 29 June 2011 09:18:09 UTC