"width" and "height" are not animatable as CSS properties

RESOLVED FIXED

Status

()

Core
SVG
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: bz, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

nsSMILCSSProperty::IsPropertyAnimatable returns false for eCSSProperty_width/height.

Is this on purpose?  If so, why?  At the very least, it would be good to document the code.

Note that getComputedStyle doesn't actually return computed style for these properties, so maybe that's the issue?

Comment 1

6 years ago
width and height amongst others are attributes only in SVG and are not mapped to style. You can animate the attributes directly though.
Yes, but shouldn't you be able to animate the CSS properties anyway?  In particular, this is useful when applying SMIL animations to non-SVG elements.

Comment 3

6 years ago
SVG divides things into regular and presentation attributes: http://www.w3.org/TR/SVG/attindex.html#RegularAttributes

presentataion map to style/css, regular don't, although the SVG specification describes presentation attributes as CSS styles that you can specify as attributes which comes to the same thing.

SVG regular attributes are complicated things with a baseVal and an animVal that html doesn't have.
Yes, I'm well aware of that.  I'm talking about the particular case of attributeType="CSS" in the SMIL.

Comment 5

6 years ago
You mean when animating html where width and height are styles. If so then yes we should be able to do that with attributeType="CSS" even though that should not work to animate SVG elements that have width and height as there they are only regular attributes.
Right.  I'm just saying that when attributeType="CSS" we should change the computed value of "width" and "height", period.  It just happens that SVG elements ignore that computed value, as I understand, so won't be affected by it.  Sound about right?

Comment 7

6 years ago
(In reply to Boris Zbarsky (:bz) from comment #6)
> Right.  I'm just saying that when attributeType="CSS" we should change the
> computed value of "width" and "height", period.  It just happens that SVG
> elements ignore that computed value, as I understand, so won't be affected
> by it.  Sound about right?

Absolutely.
Actually we do map 'width' and 'height' into style for outer-<svg>, but only if those attributes are explicitly set. Anyway, regardless, on outer-<svg>, the CSS properties count. Seems like IsPropertyAnimatable() is currently too simplistic an interface to account for that though.

Comment 9

5 years ago
bug 764851 fixes this.
Depends on: 764851

Updated

5 years ago
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.