Add an animation compositor

RESOLVED FIXED in Firefox 46



DOM: Animation
3 years ago
2 years ago


(Reporter: birtles, Assigned: birtles)



Dependency tree / graph

Firefox Tracking Flags

(firefox42 affected, firefox46 fixed)



(1 attachment)



3 years ago
This is part of the refactoring to support script-generated animations, as outlined in bug 1151731 comment 5.

With regards to requesting restyles I think we could use an arrangement such as:

* Move throttling control and requesting restyles to AnimationEffect (from Animation::CanThrottle)

* Make Animation call AnimationEffect::UpdateTiming and pass a flag "layer needs update". This will be true when any of the Animation-related properties that are set on a layer are updated including pause state and playback rate. These properties are invisible to the AnimationEffect (i.e. don't produce a change in the handed-down local time) but need to be updated on the compositor.

* In KeyframeEffect we already store the current time so in SetParentTime we can calculate the progress and phase using the old time and then compare it to the new time. Then we can call RequestRestyle on the compositor as follows:
 - If we got "layer needs update" from the Animation, we need to request a layer update
 - If we had a change in phase, we need to request a layer update
 - If the progress has changed, we need to request a style update -- either throttled or unthrottled depending on if we are running on the compositor or not
 - Otherwise, we don't need to request a style update

There's a bit more complexity in that, but I think this would mean that we can avoid updating styles altogether when in the delay phase, or when we have a step timing function etc. It should also mean we can drop the mFinishedAtLastComposeStyle member from Animation.

Comment 1

2 years ago
Created attachment 8681123 [details] [diff] [review]
WIP patch v1

Initial WIP patch. I'll split this up into several bugs later, but for now I want to check the following approach works:

✓ 1. Store effects on elements
✓ 2. Make getAnimations() use the list of effects
✓ 3. Make EffectSet::GetEffectSet(const nsIFrame*) and use it wherever possible
✓ 4. Make a version of GetAnimationsForCompositor in AnimationCompositor
  5. Make ActiveLayerTracker::IsScaleSubjectToAnimation use the effect list
  6. Redo wins-in-cascade setting using the compositor
  7. Add a compositor per pres context (and set/clear the mPresContext member)
  8. Move the effect generation to the EffectCompositor
     (And update RestyleManager::GetMaxAnimationGenerationForFrame)
  9. Get KeyframeEffect to tell the EffectCompositor when it needs updates
     (Maintain two hash sets of elements: <needs updates now>
                                          <on-demand updates>)
  10. Move style updating to EffectCompositor
      - Implement AddStyleUpdatesTo on the EffectCompositor
        We need to work out what restyle hint to use. This requires logic where
        we work out what the last thing was and then select the appropriate sheet.
      - Merge in AnimationCollection::EnsureStyleRuleFor.
      - Make EffectCompositor inherit from nIStyleRuleProcessor and implement
        all the necessary methods
  11. Tidy up
     - Remove the linked-list parts from AnimationCollection
     - Make AnimationCollection templated or somehow refer to CSSAnimations/CSSTransitions specifically
     - Rename the managers to AnimationBuilder and TransitionBuilder
     - Delete CommonAnimationManager
  12. Optimizations described in comment 0
Assignee: nobody → bbirtles

Comment 2

2 years ago
The WIP patch is based on the patches for bug 1216030.
Depends on: 1216030


2 years ago
Depends on: 1225699


2 years ago
Depends on: 1226118


2 years ago
Depends on: 1228229


2 years ago
Depends on: 1229280


2 years ago
Depends on: 1230040


2 years ago
Depends on: 1230056

Comment 3

2 years ago
All dependent bugs are now fixed.
Last Resolved: 2 years ago
status-firefox46: --- → fixed
Keywords: meta
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.