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

Hi www-svg,

So, while working on a patch for animating the XML versions of SVG 
"Presentational Attributes" in Mozilla, I've run across an area of the 
spec that contradicted my initial expectations.  I'd been assuming that 
these Presentational Attributes should be animated *separately* from 
their CSS-property counterparts, but the spec seems to disagree with me.

DISCUSSION OF SPEC
==================
Here's what SVG 1.1 section 6.4 says:
 > Animation of presentation attributes is equivalent to animating the
 > corresponding property. Thus, the same effect occurs from animating
 > the presentation attribute with attributeType="XML" as occurs with
 > animating the corresponding property with attributeType="CSS".
http://www.w3.org/TR/SVG11/styling.html#UsingPresentationAttributes

The words "equivalent" and "same effect" there imply that we should just 
*completely ignore* attributeType for presentational attributes, and 
*always* animate them as if they were attributeType="CSS".

The corresponding chunk of SVG Tiny 1.2 (section 6.3, final paragraph) 
refers to the "attributeType" definition, which says basically the same 
thing as SVG 1.1, but also adds a confusing caveat about style sheets:
 > In the absence of style sheets (external style sheets, 'style'
 > elements or 'style' attributes, as may be available in other
 > profiles of SVG) animation of presentation attributes is
 > equivalent to animating the corresponding property. Thus, for
 > properties listed in SVG Tiny 1.2, the same effect occurs from
 > animating the presentation attribute with attributeType="XML"
 > as occurs with animating the corresponding property with
 > attributeType="CSS".
http://www.w3.org/TR/SVGMobile12/animate.html#AttributeTypeAttribute

So this essentially says that attributeType can be safely ignored, 
**unless there's other sources of style involved (e.g. inline style)**. 
It doesn't give any clue as to what would happen when those other style 
sources come into play, though... Consider this example:
   <animate attributeName="font-size" attributeType="XML" by="10".../>
   <animate attributeName="font-size" attributeType="CSS" by="10".../>
So, SVG Tiny 1.2 implies that these animations should add together, 
collectively adding 20px to 'font-size' over their durations.  BUT, it 
also suggests that if there's some other source of style, *something* 
would be different -- but what?  Perhaps we'd ignore the XML animation 
but still honor the CSS one?  But how does that make sense, when they 
otherwise interact add nicely to each other?

CONCLUSIONS
===========
I only see two options for sane behavior here:
* (Behavior 1) Completely ignore attributeType for presentational 
attributes. (Ignoring SVG Tiny 1.2's vague exception)
* (Behavior 2) Honor attributeType for presentational attributes -- 
treat them as separate animation targets. Effectively, "XML" animates an 
override value for the XML attribute, and "CSS" animates an override 
value for the inline style.

"Behavior 1" is what's prescribed by SVG 1.1 section 6.4, and it's 
what's implemented by ASV.  It may also be simpler for authors to 
understand. (It's also trivial to implement.)

"Behavior 2" makes more intuitive sense to me as an implementer, and 
it's what Opera currently implements.

Also: With "Behavior 1", I think |attributeType| becomes completely 
useless.  AFAICT, the only place where |attributeType| could have a 
useful effect is in disambiguating between presentational attributes vs 
their CSS counterparts -- but with "Behavior 1", it'd be ignored in that 
situation.  Are there any other cases where |attributeType| might be 
useful?  (And if not, perhaps attributeType should be deprecated, if 
"Behavior 1" remains the specified behavior?)

Anyway -- at this point, I'm not sure which behavior (1 or 2) to go with 
for Mozilla's implementation.  Any thoughts here?

Thanks,
Daniel Holbert
Mozilla Corporation

Received on Thursday, 21 January 2010 20:43:50 UTC