Bug 1183461 part 2 - Reorder the parameters to EventInfo constructors; r=heycam

This patch lines up the parameters of AnimationEventInfo and
TransitionEventInfo constructors so that they are more logical and consistent.
Specifically, it groups the element and pseudo type together since they
form a logical pair denoting the event target. For AnimationEventInfo this
patch also places the type of event before the common event parameters since
the event type seems to be more significant.

This patch also performs some miscelleaneous housekeeping: removing some
unnecessary namespace prefixes, whitespace fixes, and making
TransitionEventInfo use the same concrete type to store the target element
as AnimationEventInfo (dom::Element instead of nsIContent).

--HG--
extra : rebase_source : ce6935f74f31dffadce4d0e7d4fa8859ec213740
This commit is contained in:
Brian Birtles 2015-09-15 14:04:05 +09:00
Родитель d135283802
Коммит ccaa539dfb
4 изменённых файлов: 26 добавлений и 25 удалений

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

@ -246,9 +246,9 @@ CSSAnimation::QueueEvents()
StickyTimeDuration elapsedTime =
std::min(StickyTimeDuration(InitialAdvance()),
computedTiming.mActiveDuration);
manager->QueueEvent(
AnimationEventInfo(owningElement, mAnimationName, eAnimationStart,
elapsedTime, owningPseudoType));
manager->QueueEvent(AnimationEventInfo(owningElement, owningPseudoType,
eAnimationStart, mAnimationName,
elapsedTime));
// Then have the shared code below append an 'animationend':
message = eAnimationEnd;
} else {
@ -267,9 +267,8 @@ CSSAnimation::QueueEvents()
elapsedTime = computedTiming.mActiveDuration;
}
manager->QueueEvent(
AnimationEventInfo(owningElement, mAnimationName, message, elapsedTime,
owningPseudoType));
manager->QueueEvent(AnimationEventInfo(owningElement, owningPseudoType,
message, mAnimationName, elapsedTime));
}
bool

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

@ -26,15 +26,16 @@ class Promise;
} /* namespace dom */
struct AnimationEventInfo {
nsRefPtr<mozilla::dom::Element> mElement;
mozilla::InternalAnimationEvent mEvent;
nsRefPtr<dom::Element> mElement;
InternalAnimationEvent mEvent;
AnimationEventInfo(mozilla::dom::Element *aElement,
const nsSubstring& aAnimationName,
AnimationEventInfo(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
EventMessage aMessage,
const mozilla::StickyTimeDuration& aElapsedTime,
nsCSSPseudoElements::Type aPseudoType)
: mElement(aElement), mEvent(true, aMessage)
const nsSubstring& aAnimationName,
const StickyTimeDuration& aElapsedTime)
: mElement(aElement)
, mEvent(true, aMessage)
{
// XXX Looks like nobody initialize WidgetEvent::time
mEvent.animationName = aAnimationName;
@ -44,7 +45,7 @@ struct AnimationEventInfo {
// InternalAnimationEvent doesn't support copy-construction, so we need
// to ourselves in order to work with nsTArray
AnimationEventInfo(const AnimationEventInfo &aOther)
AnimationEventInfo(const AnimationEventInfo& aOther)
: mElement(aOther.mElement)
, mEvent(true, aOther.mEvent.mMessage)
{

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

@ -145,12 +145,12 @@ CSSTransition::QueueEvents()
if (!presContext) {
return;
}
nsTransitionManager* manager = presContext->TransitionManager();
manager->QueueEvent(
TransitionEventInfo(owningElement, TransitionProperty(),
mEffect->Timing().mIterationDuration,
owningPseudoType));
nsTransitionManager* manager = presContext->TransitionManager();
manager->QueueEvent(TransitionEventInfo(owningElement, owningPseudoType,
TransitionProperty(),
mEffect->Timing()
.mIterationDuration));
}
bool

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

@ -59,7 +59,7 @@ struct ElementPropertyTransition : public dom::KeyframeEffectReadOnly
// mProperties[0].mSegments[0].mFromValue, except when this transition
// started as the reversal of another in-progress transition.
// Needed so we can handle two reverses in a row.
mozilla::StyleAnimationValue mStartForReversingTest;
StyleAnimationValue mStartForReversingTest;
// Likewise, the portion (in value space) of the "full" reversed
// transition that we're actually covering. For example, if a :hover
// effect has a transition that moves the element 10px to the right
@ -195,12 +195,13 @@ protected:
} // namespace dom
struct TransitionEventInfo {
nsCOMPtr<nsIContent> mElement;
nsRefPtr<dom::Element> mElement;
InternalTransitionEvent mEvent;
TransitionEventInfo(nsIContent *aElement, nsCSSProperty aProperty,
TimeDuration aDuration,
nsCSSPseudoElements::Type aPseudoType)
TransitionEventInfo(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
nsCSSProperty aProperty,
TimeDuration aDuration)
: mElement(aElement)
, mEvent(true, eTransitionEnd)
{
@ -213,7 +214,7 @@ struct TransitionEventInfo {
// InternalTransitionEvent doesn't support copy-construction, so we need
// to ourselves in order to work with nsTArray
TransitionEventInfo(const TransitionEventInfo &aOther)
TransitionEventInfo(const TransitionEventInfo& aOther)
: mElement(aOther.mElement)
, mEvent(true, eTransitionEnd)
{