Hi Cameron,

Cameron McCormack wrote:

I am playing around with changing the values in an element's StyleMap
without having to modify the actual document to cause the update.  I've
written a method in SVGCSSEngine:

One issue is that the following code will not work for short-hand properties (we may have a similar issue in a few other places in Batik).

    public void setProperty(CSSStylableElement elt, String property, String value) {
        try {
            StyleMap style = elt.getComputedStyleMap(null);
            int idx = getPropertyIndex(property);
            org.w3c.css.sac.LexicalUnit lu = parser.parsePropertyValue(value);
            ValueManager vm = valueManagers[idx];

Shorthand properties aren't in this array.


style.putOrigin(idx, StyleMap.NON_CSS_ORIGIN);

Do you think this is the best way to change the style of an object
without modifying the document itself?  I notice that if
invalidateProperties is called (which will happen any time some CSS
related thing is changed in the document) that my changes to the
StyleMap will be overwritten.  Ideally if the cascade was done
again I'd like my changes to the StyleMap to be kept.

Apparently in CSS there is a concept of an 'override' style. This would most likely appear as a new origin in the StyleMap class. The invalidate etc stuff should then respect this source as trumping cascaded values.

Also, since this issue is sort of related to animation, where would the
animated values for CSS properties be stored? I know that for the XML
attributes such as x, y, width, height, etc. there is an appropriate
SVGAnimated* class that will store the base and animated values. What
would be the equivalent for CSS?

The SVG specification seems to indicate that the 'override' style is the appropriate place.

If there isn't one, would temporary
changes to the StyleMap as I'm doing above be appropriate?

Well the loss of values is pretty problematic.


I notice
that the CSSStyleDeclaration interface doesn't have any notion of
animated values, so if you are animating a CSS value is it impossible
through script to get at that animated value?  (Or if animated values
*are* returned, is it impossible to get the base value?)

So I don't know the SAC very well but I am under the impression that it is possible (although I don't really know how :).




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to