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:

    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];
            org.apache.batik.css.engine.value.Value v = vm.createValue(lu, this);
            style.putMask(idx, (short) 0);
            style.putValue(idx, v);
            style.putOrigin(idx, StyleMap.NON_CSS_ORIGIN);
            int[] props = { idx };
            propagateChanges(elt, props);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

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.

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?  If there isn't one, would temporary
changes to the StyleMap as I'm doing above be appropriate?  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?)

Thanks,

Cameron

-- 
Cameron McCormack
|  Web: http://mcc.id.au/
|  ICQ: 26955922

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

Reply via email to