SMIL:CSS Animation: Difference between revisions
Jump to navigation
Jump to search
| Line 1: | Line 1: | ||
= Current status = | = Current status = | ||
There's an existing [http://hg.mozilla.org/users/dholbert_mozilla.com | There's an existing [http://hg.mozilla.org/users/dholbert_mozilla.com/smil-patches/file/tip/smil_css smil_css patch] in dholbert's [http://hg.mozilla.org/users/dholbert_mozilla.com/index.cgi/smil-patches smil-patches patch-queue]. This patch applies on top of the other patches in the queue, and it makes use of a simple [http://hg.mozilla.org/users/dholbert_mozilla.com/smil-patches/file/tip/getoverridestyle.patch "GetOverrideStyle" implementation] in order to set styles. | ||
* can only | The smil_css patch is not complete yet -- it currently has these limitations: | ||
* can only currently interpolate between fixed-length units. (inch, mm, pt, etc). ( | * It can only animate CSS properties of type nsCSSValue. (not nsCSSValuePair / nsCSSValueRect / etc) | ||
* It can only currently interpolate between fixed-length units. (inch, mm, pt, etc). (unit-conversion code needs a reference to the PresContext & font-metrics to interpolate/interconvert between fixed-length units / display pixels / em-units / ex-units.) | |||
= Overview of Proposed Strategy = | = Overview of Proposed Strategy = | ||
Revision as of 22:28, 30 October 2008
Current status
There's an existing smil_css patch in dholbert's smil-patches patch-queue. This patch applies on top of the other patches in the queue, and it makes use of a simple "GetOverrideStyle" implementation in order to set styles.
The smil_css patch is not complete yet -- it currently has these limitations:
- It can only animate CSS properties of type nsCSSValue. (not nsCSSValuePair / nsCSSValueRect / etc)
- It can only currently interpolate between fixed-length units. (inch, mm, pt, etc). (unit-conversion code needs a reference to the PresContext & font-metrics to interpolate/interconvert between fixed-length units / display pixels / em-units / ex-units.)
Overview of Proposed Strategy
- As suggested in the documentation on the "SMIL Sandwich Model" in the smil-animation spec, I'm proposing to use an implementation backed by getOverrideStyle()
- Basic outline of how to animate CSS properties:
- Clear the contents of getOverrideStyle() on each element, for each animated CSS property
- Perform SMIL interpolation / compositing for each animated CSS property, using getComputedStyle() as the base value.
- 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():
- Add a new nsICSSStyleRule member variable on each nsStyledElement, which is used as a backing store for the override style.
- Internally, this should mostly behave like SVG's content style rule. (See mContentStyleRule in nsSVGElement.h and nsSVGElement.cpp )