Closed Bug 1190235 Opened 9 years ago Closed 8 years ago

Add an animation compositor

Categories

(Core :: DOM: Animation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox42 --- affected
firefox46 --- fixed

People

(Reporter: birtles, Assigned: birtles)

References

Details

(Keywords: meta)

Attachments

(1 file)

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.
Attached patch WIP patch v1Splinter Review
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
Status: NEW → ASSIGNED
The WIP patch is based on the patches for bug 1216030.
Depends on: 1216030
All dependent bugs are now fixed.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Keywords: meta
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: