Confirmed users
220
edits
| Line 1: | Line 1: | ||
== Add layers::Animation into mAnimations of Layer == | == Add layers::Animation into mAnimations of Layer == | ||
nsDisplayTransform::BuildLayer() | nsDisplayTransform::BuildLayer() | ||
|-> '''AddAnimationsAndTransitionsToLayer'''(Layer* aLayer, nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem, nsCSSProperty aProperty) | |||
|-> AddAnimationsAndTransitionsToLayer(Layer* aLayer, nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem, nsCSSProperty aProperty) | |||
|-> aLayer->ClearAnimations(); | |-> aLayer->ClearAnimations(); | ||
Rest of the part below is skipped if OMTA is not supported nor async animations is not supported. | |||
1. Check to see if the animations(transitions) can perform on compositor thread. | |||
|-> ElementTransitions* et = nsTransitionManager::GetTransitionsForCompositor(content, aProperty); | |||
ElementAnimations* ea = nsAnimationManager::GetAnimationsForCompositor(content, aProperty); | |||
2. Check to see if async animations is enabled (Can draw by GPU), currently, only Display type of Transform and Opacity adapt OMTA. | |||
|-> aItem->CanUseAsyncAnimations(aBuilder) | |-> aItem->CanUseAsyncAnimations(aBuilder) | ||
3. Set up some extra information for transformation, so that a gfx3DMatrix can applied directly to the layer. (defined in LayersMessage.ipdlh) | |||
|-> some implementation here. | |||
|-> AnimationData data = TransformData(...); | |-> AnimationData data = TransformData(...); | ||
| | | | ||
| | 4. For each ElementPropertyTransition in et, convert its transition properties into a ElementAnimation, and add it to aLayer (details describe in section 5). | ||
|-> ElementPropertyTransition* pt = &et->mPropertyTransitions[tranIdx]; | |||
|-> ElementAnimation anim; | |||
|-> ''AddAnimationsForProperty(frame, aProperty, &anim, aLayer, data);'' | |||
5. For each ElementAnimation (anim) in ElementAnimations (ea), extract some data out from anim, create a layers::Animation from those data, and append this new created layers::Animation to the animation list of aLayer (mAnimations). | |||
|-> ElementAnimation* anim = &ea->mAnimations[animIdx]; | |-> ElementAnimation* anim = &ea->mAnimations[animIdx]; | ||
|-> AddAnimationsForProperty(frame, aProperty, anim, aLayer, data); | |-> ''AddAnimationsForProperty(frame, aProperty, anim, aLayer, data);'' | ||
|-> layers::Animation* animation = aLayer->AddAnimation() | |-> layers::Animation* animation = aLayer->AddAnimation(startTime, duration, | ||
iterations, direction, | |||
aProperty, aData) | |||
5.1 For each segment in a anim: | |||
|-> AddTransformFunctions() | |-> AddTransformFunctions() | ||
6. Update the number of animations. | |||
|-> aLayer->SetAnimationGeneration(a number); | |-> aLayer->SetAnimationGeneration(a number); | ||