Re: [Params] Some comments

Hi, Cameron-

Some more thoughts about your proposed alternate syntax...

Doug Schepers wrote (on 4/26/09 10:48 PM):
>
>> An alternative syntax strawman (not to solve the previous paragraph):
>>
>> <g>
>> <rect id="button_rect" x="5" y="5" width="100" height="30" rx="15"
>> ry="15"
>> fill="param(color, blue)" stroke="param(outline, navy)" />
>> <text id="button_label" x="55" y="30" text-anchor="middle"
>> font-size="25" fill="black" font-family="Verdana">
>> <tspan content="param(text-label, 'button')" />
>> </text>
>> </g>
>>
>> where content="" is a presentation attribute for the CSS ‘content’
>> property. An advantage would be that param() could be used in CSS
>> without the need for an <svg:ref> element, so it could easily be used in
>> HTML+CSS content.
>
> My original idea looked like this, but then I mutated it to match the
> tref/filter/gradient mechanism. I was actually toying with similar
> syntax again, and I think it might actually be better in some ways.
>
> For 'fill' and 'stroke', we already allow fallbacks, so we could reuse
> that functionality:
> <rect ... fill="param(color) blue" stroke="param(outline) navy" />
>
> I like the idea of adding a new fallback content mechanism on <tref>,
> since FF doesn't support <tref> yet (and if the reference doesn't
> resolve, the user has no idea that some text should have been there).
> I'm not so convinced that it should be an attribute rather than child
> content, but I also don't want to complicate the mechanism.

One of the reasons I went with a <ref> model instead of the more direct 
"param(name)" syntax was that I thought it might be useful to be able to 
change all the instances in one place, from within the SVG.  However, 
you could still create that level of indirection by using existing paint 
servers:

<svg ...>
   <defs>
     <solidColor id="foo" solid-color="param(shade) maroon"/>
       <animateColor ... from="param(shade) maroon" to="param(shade2) red"/>
     </solidColor>
   </defs>

   <circle ... fill="url(#foo)"/>
   <rect ... stroke="url(#foo)"/>
   <path ... fill="url(#foo)"/>
   <text ... fill="url(#foo)">A</text>
</svg>


I still think SVG needs an equivalent of <param>, but I'm coming around 
again on the syntax question.  I think it might be easier to author in 
the simple cases, and more or less equal complexity in the hard cases. I 
think I was too intent on duplicating existing mechanisms.

Regards-
-Doug Schepers
W3C Team Contact, SVG and WebApps WGs

Received on Monday, 27 April 2009 05:16:34 UTC