SMIL:CSS Animation

Current status

There's an existing smil_css patch in the smil-patches patch-queue. This patch...

  • applies on top of the other patches in the queue, and makes use of a basic GetOverrideStyle implementation.
  • can only currently animate CSS properties of type nsCSSValue. (not nsCSSValuePair / nsCSSValueRect / etc)
  • can only currently interpolate between fixed-length units. (inch, mm, pt, etc). (Need to tie in with PresContext / font-metrics to interpolate/interconvert between display-pixels / em-units / ex-units.)

Overview of Proposed Strategy

  • Per the documentation on the "SMIL Sandwich Model", I'm proposing to use an implementation backed by getOverrideStyle()
  • Basic outline of how to animate CSS properties:
    1. Clear the contents of getOverrideStyle() on each element, for each animated CSS property
    2. Perform SMIL interpolation / compositing for each animated CSS property, using getComputedStyle() as the base value.
    3. Store this property in the getOverrideStyle() stylesheet.
  • Note that we don't yet implement getOverrideStyle(). Here's a basic outline of how we'd implement getOverrideStyle():
    1. Add a new nsICSSStyleRule member variable on each nsStyledElement, which is used as a backing store for the override style.
    2. Internally, this should mostly behave like SVG's content style rule. (See mContentStyleRule in nsSVGElement.h and nsSVGElement.cpp )