Bug 1947516 - Always provide a consistent EventContext, not just depending on the event type. r=boris
Otherwise you get into situations where a transitions X and Y compare differently depending on whether you're a cancel event or not, which trips the weak ordering guarantees. Differential Revision: https://phabricator.services.mozilla.com/D242817
This commit is contained in:
@@ -78,22 +78,14 @@ struct AnimationEventInfo {
|
||||
Maybe<dom::Animation::EventContext> GetEventContext() const {
|
||||
if (mData.is<CssAnimationData>()) {
|
||||
const auto& data = mData.as<CssAnimationData>();
|
||||
return data.mMessage == eAnimationCancel
|
||||
? Some(dom::Animation::EventContext{
|
||||
NonOwningAnimationTarget(data.mTarget),
|
||||
data.mAnimationIndex})
|
||||
: Nothing();
|
||||
return Some(dom::Animation::EventContext{
|
||||
NonOwningAnimationTarget(data.mTarget), data.mAnimationIndex});
|
||||
}
|
||||
|
||||
if (mData.is<CssTransitionData>()) {
|
||||
const auto& data = mData.as<CssTransitionData>();
|
||||
return data.mMessage == eTransitionCancel
|
||||
? Some(dom::Animation::EventContext{
|
||||
NonOwningAnimationTarget(data.mTarget),
|
||||
data.mAnimationIndex})
|
||||
: Nothing();
|
||||
return Some(dom::Animation::EventContext{
|
||||
NonOwningAnimationTarget(data.mTarget), data.mAnimationIndex});
|
||||
}
|
||||
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
|
||||
@@ -242,18 +242,18 @@ int32_t CSSTransition::CompareCompositeOrder(
|
||||
|
||||
// 1. Sort by document order
|
||||
const OwningElementRef& owningElement1 =
|
||||
aContext ? OwningElementRef(aContext->mTarget) : mOwningElement;
|
||||
IsTiedToMarkup() ? mOwningElement : OwningElementRef(aContext->mTarget);
|
||||
const OwningElementRef& owningElement2 =
|
||||
aOtherContext ? OwningElementRef(aOtherContext->mTarget)
|
||||
: aOther.mOwningElement;
|
||||
aOther.IsTiedToMarkup() ? aOther.mOwningElement
|
||||
: OwningElementRef(aOtherContext->mTarget);
|
||||
if (!owningElement1.Equals(owningElement2)) {
|
||||
return owningElement1.Compare(owningElement2, aCache);
|
||||
}
|
||||
|
||||
// 2. (Same element and pseudo): Sort by transition generation
|
||||
const uint64_t& index1 = aContext ? aContext->mIndex : mAnimationIndex;
|
||||
const uint64_t& index2 =
|
||||
aOtherContext ? aOtherContext->mIndex : aOther.mAnimationIndex;
|
||||
const uint64_t index1 = IsTiedToMarkup() ? mAnimationIndex : aContext->mIndex;
|
||||
const uint64_t index2 =
|
||||
aOther.IsTiedToMarkup() ? aOther.mAnimationIndex : aOtherContext->mIndex;
|
||||
if (index1 != index2) {
|
||||
return index1 < index2 ? -1 : 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user