mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 828173 patch 3: Add a concept of pending animations to Layer, like pending transform. r=mattwoodrow
This commit is contained in:
parent
806b550de7
commit
e80d256f0e
@ -190,6 +190,8 @@ Layer::AddAnimation()
|
||||
{
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) AddAnimation", this));
|
||||
|
||||
MOZ_ASSERT(!mPendingAnimations, "should have called ClearAnimations first");
|
||||
|
||||
Animation* anim = mAnimations.AppendElement();
|
||||
|
||||
Mutated();
|
||||
@ -199,6 +201,8 @@ Layer::AddAnimation()
|
||||
void
|
||||
Layer::ClearAnimations()
|
||||
{
|
||||
mPendingAnimations = nullptr;
|
||||
|
||||
if (mAnimations.IsEmpty() && mAnimationData.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
@ -209,6 +213,28 @@ Layer::ClearAnimations()
|
||||
Mutated();
|
||||
}
|
||||
|
||||
Animation*
|
||||
Layer::AddAnimationForNextTransaction()
|
||||
{
|
||||
MOZ_ASSERT(mPendingAnimations,
|
||||
"should have called ClearAnimationsForNextTransaction first");
|
||||
|
||||
Animation* anim = mPendingAnimations->AppendElement();
|
||||
|
||||
return anim;
|
||||
}
|
||||
|
||||
void
|
||||
Layer::ClearAnimationsForNextTransaction()
|
||||
{
|
||||
// Ensure we have a non-null mPendingAnimations to mark a future clear.
|
||||
if (!mPendingAnimations) {
|
||||
mPendingAnimations = new AnimationArray;
|
||||
}
|
||||
|
||||
mPendingAnimations->Clear();
|
||||
}
|
||||
|
||||
static nsCSSValueSharedList*
|
||||
CreateCSSValueList(const InfallibleTArray<TransformFunction>& aFunctions)
|
||||
{
|
||||
@ -641,6 +667,13 @@ Layer::ApplyPendingUpdatesForThisTransaction()
|
||||
Mutated();
|
||||
}
|
||||
mPendingTransform = nullptr;
|
||||
|
||||
if (mPendingAnimations) {
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) PendingUpdatesForThisTransaction", this));
|
||||
mPendingAnimations->SwapElements(mAnimations);
|
||||
mPendingAnimations = nullptr;
|
||||
Mutated();
|
||||
}
|
||||
}
|
||||
|
||||
const float
|
||||
|
@ -950,6 +950,13 @@ public:
|
||||
// layout code. To add an animation to this layer, use AddAnimation.
|
||||
void SetAnimations(const AnimationArray& aAnimations);
|
||||
|
||||
// These are a parallel to AddAnimation and clearAnimations, except
|
||||
// they add pending animations that apply only when the next
|
||||
// transaction is begun. (See also
|
||||
// SetBaseTransformForNextTransaction.)
|
||||
Animation* AddAnimationForNextTransaction();
|
||||
void ClearAnimationsForNextTransaction();
|
||||
|
||||
/**
|
||||
* CONSTRUCTION PHASE ONLY
|
||||
* If a layer is "fixed position", this determines which point on the layer
|
||||
@ -1410,6 +1417,8 @@ protected:
|
||||
float mPostYScale;
|
||||
gfx::Matrix4x4 mEffectiveTransform;
|
||||
AnimationArray mAnimations;
|
||||
// See mPendingTransform above.
|
||||
nsAutoPtr<AnimationArray> mPendingAnimations;
|
||||
InfallibleTArray<AnimData> mAnimationData;
|
||||
float mOpacity;
|
||||
gfx::CompositionOp mMixBlendMode;
|
||||
|
Loading…
Reference in New Issue
Block a user