W3C home > Mailing lists > Public > www-style@w3.org > February 2012

Re: [css3-images] Referencing <svg> element directly with element()

From: Erik Dahlstrom <ed@opera.com>
Date: Fri, 24 Feb 2012 14:06:43 +0100
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-style@w3.org
Message-ID: <op.v96pdhdhgeuyw5@localhost.localdomain>
On Wed, 22 Feb 2012 18:35:48 +0100, Tab Atkins Jr. <jackalmage@gmail.com>  
wrote:

> [rearranged for better reply order]
>
> On Wed, Feb 22, 2012 at 3:15 AM, Erik Dahlstrom <ed@opera.com> wrote:
>> It seems to me that even the paint server model (svg gradients,  
>> patterns)
>> that is defined in the spec suffers from the same problem, even if the  
>> <svg>
>> contained only elements inside a <defs> the <svg> itself would still  
>> take up
>> space in the main document.
>
> If the SVG contains only paint servers, you can set it to
> display:none.  They'll still be usable in element().

Ok, that's fine.

...
>> Please
>> consider making <svg> as a "paint source" as well. That would make svg
>> easier to use here, since you wouldn't have to wrap the content inside a
>> <pattern> element.
>
> As Boris says, you can't do this in general, since there may be
> dependencies on the outside world for style information, percentages,
> etc.  I could finesse a definition that avoided some of these, but
> it's simpler to just require <pattern> and be done with it, both from
> a spec perspective and an author-learning perspective.

Ok, I guess I can live with that.

> Hmm.  <pattern> removes the layout-information dependencies, but not
> the style dependencies.  I've now corrected that so that paint sources
> that aren't rendered use initial values if they try to inherit.

Ok.

>> If I understand the spec correctly, elements that are "paint sources"  
>> (e.g
>> <img>, <canvas> and <video>) can still be used when referenced via  
>> element()
>> even if they are not rendered. Please clarify what "not rendered" means.
>> Would display:none be included in that definition for example?
>
> Yes, display:none is included in that.  I've clarified the term now -
> it's defined as any element that does not generate a box, or which is
> a descendant of <defs> in SVG.

The new definition of "not rendered" seems to allow creating arbitrary svg  
elements in script (without an enclosing <svg>) and inserting them into  
the document and then referencing them with element(), because they won't  
get boxes then as far as I know. Is that ok? I mean I could just create  
the <svg:pattern> element and insert it for example.

In svg, if you had a <pattern> inside a <metadata> it wouldn't render  
either, and same if it wasn't inside a <defs>. None of the paint servers  
render by themselves in svg. It would be enough to set display:none on the  
<svg> parent.

[[In SVG, the descendants of a <defs> element are also considered to not  
be rendered. Other host languages may define additional ways in which an  
element can be considered not rendered.]]

That makes it sound like SVG isn't allowed to change what is considered as  
"not rendered", and I'm not really convinced that <defs> is the only case.  
I'd suggest making the <defs> part a note, and also "s/Other host  
languages/Host languages/".

In http://dev.w3.org/csswg/css3-images/#paint-sources:
1. Please define what the 'painting area' that is referred to in the  
defintions of userSpaceOnUse/objectBoundingBox is.
2. In the definition of userSpaceOnUse please clarify how width and height  
are setup.
3. Please consider using the term "user coordinates" instead of "user  
units", and for clarity please add a link to the definition of each term  
(just to be clear on whether it's an svg term or a css term).

Cheers
-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed
Received on Friday, 24 February 2012 13:07:15 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:51 GMT