Skip to content

Commit

Permalink
Bug 1292001 - Drop ElementPropertyTransition; r=boris
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D64523

--HG--
extra : moz-landing-system : lando
  • Loading branch information
birtles committed Mar 2, 2020
1 parent 47e8e27 commit 1ed864c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 39 deletions.
8 changes: 0 additions & 8 deletions dom/animation/AnimationEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
#include "nsWrapperCache.h"

namespace mozilla {

struct ElementPropertyTransition;

namespace dom {

class Animation;
Expand All @@ -37,11 +34,6 @@ class AnimationEffect : public nsISupports, public nsWrapperCache {

virtual KeyframeEffect* AsKeyframeEffect() { return nullptr; }

virtual ElementPropertyTransition* AsTransition() { return nullptr; }
virtual const ElementPropertyTransition* AsTransition() const {
return nullptr;
}

nsISupports* GetParentObject() const { return ToSupports(mDocument); }

bool IsCurrent() const;
Expand Down
2 changes: 0 additions & 2 deletions dom/animation/KeyframeEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ struct AnimationProperty {
const dom::Element* aElement);
};

struct ElementPropertyTransition;

namespace dom {

class Animation;
Expand Down
23 changes: 9 additions & 14 deletions layout/style/nsTransitionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,19 +668,15 @@ bool nsTransitionManager::ConsiderInitiatingTransition(
startValue.IsInterpolableWith(aProperty, endValue);

bool haveCurrentTransition = false;
size_t currentIndex = nsTArray<ElementPropertyTransition>::NoIndex;
size_t currentIndex = nsTArray<KeyframeEffect>::NoIndex;
const CSSTransition* oldTransition = nullptr;
const ElementPropertyTransition* oldPT = nullptr;
if (aElementTransitions) {
OwningCSSTransitionPtrArray& animations = aElementTransitions->mAnimations;
for (size_t i = 0, i_end = animations.Length(); i < i_end; ++i) {
if (animations[i]->TransitionProperty() == aProperty) {
haveCurrentTransition = true;
currentIndex = i;
oldTransition = animations[i];
oldPT = oldTransition->GetEffect()
? oldTransition->GetEffect()->AsTransition()
: nullptr;
break;
}
}
Expand Down Expand Up @@ -717,8 +713,7 @@ bool nsTransitionManager::ConsiderInitiatingTransition(
OwningCSSTransitionPtrArray& animations =
aElementTransitions->mAnimations;
animations[currentIndex]->CancelFromStyle(PostRestyleMode::IfNeeded);
oldPT = nullptr; // Clear pointer so it doesn't dangle
oldTransition = nullptr;
oldTransition = nullptr; // Clear pointer so it doesn't dangle
animations.RemoveElementAt(currentIndex);
EffectSet* effectSet = EffectSet::GetEffectSet(aElement, aPseudoType);
if (effectSet) {
Expand Down Expand Up @@ -788,21 +783,22 @@ bool nsTransitionManager::ConsiderInitiatingTransition(
}

KeyframeEffectParams effectOptions;
RefPtr<ElementPropertyTransition> pt = new ElementPropertyTransition(
RefPtr<KeyframeEffect> keyframeEffect = new KeyframeEffect(
aElement->OwnerDoc(), OwningAnimationTarget(aElement, aPseudoType),
std::move(timing), effectOptions);

pt->SetKeyframes(GetTransitionKeyframes(aProperty, std::move(startValue),
std::move(endValue)),
&aNewStyle);
keyframeEffect->SetKeyframes(
GetTransitionKeyframes(aProperty, std::move(startValue),
std::move(endValue)),
&aNewStyle);

RefPtr<CSSTransition> animation =
new CSSTransition(mPresContext->Document()->GetScopeObject());
animation->SetOwningElement(OwningElementRef(*aElement, aPseudoType));
animation->SetTimelineNoUpdate(timeline);
animation->SetCreationSequence(
mPresContext->RestyleManager()->GetAnimationGeneration());
animation->SetEffectFromStyle(pt);
animation->SetEffectFromStyle(keyframeEffect);
animation->SetReverseParameters(std::move(startForReversingTest),
reversePortion);
animation->PlayFromStyle();
Expand Down Expand Up @@ -846,8 +842,7 @@ bool nsTransitionManager::ConsiderInitiatingTransition(
}

animations[currentIndex]->CancelFromStyle(PostRestyleMode::IfNeeded);
oldPT = nullptr; // Clear pointer so it doesn't dangle
oldTransition = nullptr;
oldTransition = nullptr; // Clear pointer so it doesn't dangle
animations[currentIndex] = animation;
} else {
if (!animations.AppendElement(animation)) {
Expand Down
15 changes: 0 additions & 15 deletions layout/style/nsTransitionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,6 @@ struct StyleTransition;
*****************************************************************************/

namespace mozilla {

struct ElementPropertyTransition : public dom::KeyframeEffect {
ElementPropertyTransition(dom::Document* aDocument,
OwningAnimationTarget&& aTarget,
TimingParams&& aTiming,
const KeyframeEffectParams& aEffectOptions)
: dom::KeyframeEffect(aDocument, std::move(aTarget), std::move(aTiming),
aEffectOptions) {}

ElementPropertyTransition* AsTransition() override { return this; }
const ElementPropertyTransition* AsTransition() const override {
return this;
}
};

namespace dom {

class CSSTransition final : public Animation {
Expand Down

0 comments on commit 1ed864c

Please sign in to comment.