W3C home > Mailing lists > Public > www-svg@w3.org > January 2010

Re: SVG Presentational Attributes, attributeType="CSS" vs "XML": same or different?

From: Daniel Holbert <dholbert@mozilla.com>
Date: Fri, 22 Jan 2010 13:57:49 -0800
Message-ID: <4B5A1F5D.80407@mozilla.com>
To: www-svg@w3.org
Hi www-svg,

I've got a related question on |attributeType| (assuming we go with the 
"Behavior 2" from my original message in this thread, treating 
attributeType="CSS" vs "XML" as distinct animation targets).

Suppose we have an additive attributeType="CSS" animation, whose base 
value comes from an XML attribute, and the XML attribute *itself* is 
animated (using a separate attributeType="XML" animation).  Should the 
XML animation feed into the base value of the CSS animation?

I'd argue that the answer should be "yes".  Webkit seems to agree with 
me, though Opera does not.

Here's a concrete example:
   <svg xmlns="http://www.w3.org/2000/svg">
     <text y="80" font-size="30px">
       abc
       <animate attributeName="font-size" attributeType="XML"
                by="10px" begin="0s" dur="1s" fill="freeze"/>
       <animate attributeName="font-size" attributeType="CSS"
                by="50px" begin="1s" dur="1s" fill="freeze"/>
     </text>
  </svg

So, here's what I think should happen here:
* From time 0 to 1s, clearly the font-size should increase slowly from 
30px to 40px, due to the first animation.
* Then at time=1s, when the second (CSS) animation takes effect, I'd 
argue that we should *continue* growing (much quicker now - 40px/sec), 
ending up at a final frozen value of 90px at time 2s. (See "P.S" for 
reasoning.)

Note that if the example were modified to use an inline style attribute 
for the base value, like this...

     <text y="80" style="font-size: 30px">abc

...then the attributeType="XML" animation wouldn't produce any 
noticeable effect, because the inline style "30px" would mask the 
(animated) XML attribute. In that case, nothing should happen for the 
first second, and then during the next second, we should grow from 30px 
to 80px.

ACTUAL BEHAVIOR IN BROWSERS
===========================
I've got a live testcase up with both examples here:
http://people.mozilla.org/~dholbert/tests/smil/compat_tests/xmlVsCss_fontsize_baseValues_v1.svg

WebKit (Safari 4.04) agrees with me in the first case.
It does no animation at all in the second case (using inline style), but 
I think this is just a bug, because it *does* animate from 1s-2s if I 
remove the (ineffective) XML animation.

Opera 10.10 disagrees with me in the first case -- at t=1s, it *resets* 
back to the original font-size value of 30px, and it grows from there to 
30+40=70px.  See the "P.S." for why I think this is incorrect.
Like Safari, Opera does no animation in the second case (using inline 
style), though I'm not sure why. (If I remove the XML animation there, 
it still does no animation. So it's not the same bug that Safari has.)

Thanks,
Daniel Holbert

P.S. Reasoning for why I think we should *continue* growing from 1s to 
2s, in the first testcase above:
  - The attributeType="XML" animation starts with the "font-size" 
attribute-value, and modifies it to produce an animated value for that 
attribute.  This is that attribute's "presentation value", and it's what 
gets fed into the style system for that attribute.  (That's how it takes 
effect.)
  - This will affect the style-system's computed value for "font-size", 
which ends up as 40px.
  - The attributeType="CSS" animation takes the style system's computed 
value of the "font-size" property as its base value (40px in this case), 
and it modifies it to produce an animated presentation value (40px+50px 
= 90px, at time=2s).
Received on Friday, 22 January 2010 21:58:23 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:44 GMT