Cameron McCormack wrote:
I'm starting to implement animation. At the moment I'm writing the override style code so that the simple animations I have got so far will work on this rather than modifying the computed style map directly.
Very cool!
What I'm wondering is how I should notify the CSSEngine that override style map has changed so it can rerun the cascade. In SVGStylableElement I have a class OverrideStyleDeclaration, modelled after SVGStylableElement.StyleDeclaration. Each SVGStylableElement has an object of this class which is returned from SVGOMDocument.getOverrideStyle. I think there are a couple of ways I could notify the CSSEngine that the override style was modified.
I like this basic approach of having an OverrideStyleDeclaration, although it might be possible to merge the two implementations with only one or two small modifications between StyleDeclaration and OverrideStyleDeclaration. Which points to how I would implement this call back. Currently StyleDeclaration directly notifies the CSS engine when the style attribute is changed. This is what I would do with the OverrideStyleDeclaration.
So a quick sketch of the architecture I would picture is:
A SMIL time container engine that triggers animations at the proper time (and in response to the proper events).
The animation objects would modify the override style (and animated interfaces) of the element involved.
The override style would then automatically notify the CSSEngine of the changes.
It sounds like you were planning on modifying the override style and then independently notify the CSSEngine. Or is the question just how should the override style notify the CSSEngine? In this case I wouldn't be too picky the two classes are pretty intimately related so having it call methods on CSSEngine isn't a problem.
I guess #2 would be a _very_ slight preference, the trade off is involving a third class in the whole mess vs having a slightly more general architecture.
1. Make CSSEngine.invalidateProperties public and just call it directly. This is all I need the CSSEngine to do, so it would be easy for me to call it from the OverrideStyleDeclaration {textChanged,propertyRemoved,propertyChanged} methods.
2. When the the CSSEngine is associated with the SVGOMDocument it registers an event listener with the document which will get fired when any override stylesheet in that document is modified. Maintaining a list of listeners here seems a bit of waste though when the CSSEngine is going to be the only class interested in the events.
3. Something I haven't thought of. :)
Any suggestions? After typing my thoughts down I think 2 isn't such a bad idea.
Also, in CSSEngine the "MainPropertyReciever" interface should be "MainPropertyReceiver". That interface's method also has a typo -- "setMainPoperty" should be "setMainProperty".
Thanks, these are fixed in CVS.
I'll submit a patch when I've finished the override style stuff (without the animation support, which'll take a bit longer).
That would be great! Do you have an Apache CLA on file? If not you should probably review it and make sure you can sign one.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]