Backed out changeset 22cafa2fd162 (bug 1179111)

This commit is contained in:
Carsten "Tomcat" Book 2015-07-07 14:21:33 +02:00
Родитель 7987d2203e
Коммит 297c2b6a58
6 изменённых файлов: 42 добавлений и 35 удалений

Просмотреть файл

@ -218,6 +218,11 @@ public:
*/
Nullable<TimeDuration> GetCurrentOrPendingStartTime() const;
const nsString& Name() const
{
return mEffect ? mEffect->Name() : EmptyString();
}
bool IsPausedOrPausing() const
{
return PlayState() == AnimationPlayState::Paused ||

Просмотреть файл

@ -193,10 +193,12 @@ public:
KeyframeEffectReadOnly(nsIDocument* aDocument,
Element* aTarget,
nsCSSPseudoElements::Type aPseudoType,
const AnimationTiming &aTiming)
const AnimationTiming &aTiming,
const nsSubstring& aName)
: AnimationEffectReadOnly(aDocument)
, mTarget(aTarget)
, mTiming(aTiming)
, mName(aName)
, mIsFinishedTransition(false)
, mPseudoType(aPseudoType)
{
@ -225,6 +227,10 @@ public:
" pseudo-element is not yet supported.");
return mTarget;
}
void GetName(nsString& aRetVal) const
{
aRetVal = Name();
}
// Temporary workaround to return both the target element and pseudo-type
// until we implement PseudoElement.
@ -233,6 +239,12 @@ public:
aTarget = mTarget;
aPseudoType = mPseudoType;
}
// Alternative to GetName that returns a reference to the member for
// more efficient internal usage.
virtual const nsString& Name() const
{
return mName;
}
void SetParentTime(Nullable<TimeDuration> aParentTime);
@ -328,6 +340,7 @@ protected:
Nullable<TimeDuration> mParentTime;
AnimationTiming mTiming;
nsString mName;
// A flag to mark transitions that have finished and are due to
// be removed on the next throttle-able cycle.
bool mIsFinishedTransition;

Просмотреть файл

@ -173,7 +173,7 @@ CSSAnimation::QueueEvents(EventArray& aEventsToDispatch)
StickyTimeDuration elapsedTime =
std::min(StickyTimeDuration(mEffect->InitialAdvance()),
computedTiming.mActiveDuration);
AnimationEventInfo ei(target, mAnimationName, NS_ANIMATION_START,
AnimationEventInfo ei(target, Name(), NS_ANIMATION_START,
elapsedTime,
PseudoTypeAsString(targetPseudoType));
aEventsToDispatch.AppendElement(ei);
@ -196,7 +196,7 @@ CSSAnimation::QueueEvents(EventArray& aEventsToDispatch)
elapsedTime = computedTiming.mActiveDuration;
}
AnimationEventInfo ei(target, mAnimationName, message, elapsedTime,
AnimationEventInfo ei(target, Name(), message, elapsedTime,
PseudoTypeAsString(targetPseudoType));
aEventsToDispatch.AppendElement(ei);
}
@ -373,8 +373,7 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
CSSAnimation* a = collection->mAnimations[oldIdx]->AsCSSAnimation();
MOZ_ASSERT(a, "All animations in the CSS Animation collection should"
" be CSSAnimation objects");
if (a->AnimationName() ==
newAnim->AsCSSAnimation()->AnimationName()) {
if (a->Name() == newAnim->Name()) {
oldAnim = a;
break;
}
@ -551,7 +550,7 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext,
continue;
}
nsRefPtr<CSSAnimation> dest = new CSSAnimation(aTimeline, src.GetName());
nsRefPtr<CSSAnimation> dest = new CSSAnimation(aTimeline);
aAnimations.AppendElement(dest);
AnimationTiming timing;
@ -564,7 +563,8 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext,
nsRefPtr<KeyframeEffectReadOnly> destEffect =
new KeyframeEffectReadOnly(mPresContext->Document(), aTarget,
aStyleContext->GetPseudoType(), timing);
aStyleContext->GetPseudoType(), timing,
src.GetName());
dest->SetEffect(destEffect);
if (src.GetPlayState() == NS_STYLE_ANIMATION_PLAY_STATE_PAUSED) {

Просмотреть файл

@ -56,18 +56,12 @@ namespace dom {
class CSSAnimation final : public Animation
{
public:
explicit CSSAnimation(DocumentTimeline* aTimeline,
const nsSubstring& aAnimationName)
explicit CSSAnimation(DocumentTimeline* aTimeline)
: Animation(aTimeline)
, mAnimationName(aAnimationName)
, mIsStylePaused(false)
, mPauseShouldStick(false)
, mPreviousPhaseOrIteration(PREVIOUS_PHASE_BEFORE)
{
// We might need to drop this assertion once we add a script-accessible
// constructor but for animations generated from CSS markup the
// animation-name should never be empty.
MOZ_ASSERT(!mAnimationName.IsEmpty(), "animation-name should not be empty");
}
JSObject* WrapObject(JSContext* aCx,
@ -76,11 +70,7 @@ public:
virtual CSSAnimation* AsCSSAnimation() override { return this; }
// CSSAnimation interface
void GetAnimationName(nsString& aRetVal) const { aRetVal = mAnimationName; }
// Alternative to GetAnimationName that returns a reference to the member
// for more efficient internal usage.
const nsString& AnimationName() const { return mAnimationName; }
void GetAnimationName(nsString& aRetVal) const { aRetVal = Name(); }
// Animation interface overrides
virtual Promise* GetReady(ErrorResult& aRv) override;
@ -110,8 +100,6 @@ protected:
static nsString PseudoTypeAsString(nsCSSPseudoElements::Type aPseudoType);
nsString mAnimationName;
// When combining animation-play-state with play() / pause() the following
// behavior applies:
// 1. pause() is sticky and always overrides the underlying

Просмотреть файл

@ -41,6 +41,16 @@ using mozilla::dom::KeyframeEffectReadOnly;
using namespace mozilla;
using namespace mozilla::css;
const nsString&
ElementPropertyTransition::Name() const
{
if (!mName.Length()) {
const_cast<ElementPropertyTransition*>(this)->mName =
NS_ConvertUTF8toUTF16(nsCSSProps::GetStringValue(TransitionProperty()));
}
return dom::KeyframeEffectReadOnly::Name();
}
double
ElementPropertyTransition::CurrentValuePortion() const
{
@ -83,18 +93,6 @@ CSSTransition::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
return dom::CSSTransitionBinding::Wrap(aCx, this, aGivenProto);
}
void
CSSTransition::GetTransitionProperty(nsString& aRetVal) const
{
// Once we make the effect property settable (bug 1049975) we will need
// to store the transition property on the CSSTransition itself but for
// now we can just query the effect.
MOZ_ASSERT(mEffect && mEffect->AsTransition(),
"Transitions should have a transition effect");
nsCSSProperty prop = mEffect->AsTransition()->TransitionProperty();
aRetVal = NS_ConvertUTF8toUTF16(nsCSSProps::GetStringValue(prop));
}
AnimationPlayState
CSSTransition::PlayStateFromJS() const
{

Просмотреть файл

@ -35,12 +35,15 @@ struct ElementPropertyTransition : public dom::KeyframeEffectReadOnly
dom::Element* aTarget,
nsCSSPseudoElements::Type aPseudoType,
const AnimationTiming &aTiming)
: dom::KeyframeEffectReadOnly(aDocument, aTarget, aPseudoType, aTiming)
: dom::KeyframeEffectReadOnly(aDocument, aTarget, aPseudoType,
aTiming, EmptyString())
{ }
virtual ElementPropertyTransition* AsTransition() override { return this; }
virtual const ElementPropertyTransition* AsTransition() const override { return this; }
virtual const nsString& Name() const override;
nsCSSProperty TransitionProperty() const {
MOZ_ASSERT(Properties().Length() == 1,
"Transitions should have exactly one animation property. "
@ -87,7 +90,7 @@ public:
virtual CSSTransition* AsCSSTransition() override { return this; }
// CSSTransition interface
void GetTransitionProperty(nsString& aRetVal) const;
void GetTransitionProperty(nsString& aRetVal) const { aRetVal = Name(); }
// Animation interface overrides
virtual AnimationPlayState PlayStateFromJS() const override;