Bug 879255: Refactor fix for bug 613888, step 1: create haveCurrentTransition variable. r=nrc

This commit is contained in:
L. David Baron 2013-06-05 09:35:52 +09:00
parent bab4eb2557
commit 96e910cca8

View File

@ -691,12 +691,14 @@ nsTransitionManager::ConsiderStartingTransition(nsCSSProperty aProperty,
nsStyleAnimation::Interpolate(aProperty, pt.mStartValue, pt.mEndValue,
0.5, dummyValue);
bool haveCurrentTransition = false;
uint32_t currentIndex = nsTArray<ElementPropertyTransition>::NoIndex;
if (aElementTransitions) {
nsTArray<ElementPropertyTransition> &pts =
aElementTransitions->mPropertyTransitions;
for (uint32_t i = 0, i_end = pts.Length(); i < i_end; ++i) {
if (pts[i].mProperty == aProperty) {
haveCurrentTransition = true;
currentIndex = i;
break;
}
@ -708,7 +710,7 @@ nsTransitionManager::ConsiderStartingTransition(nsCSSProperty aProperty,
if (!shouldAnimate) {
nsTArray<ElementPropertyTransition> &pts =
aElementTransitions->mPropertyTransitions;
if (currentIndex != nsTArray<ElementPropertyTransition>::NoIndex &&
if (haveCurrentTransition &&
(!haveValues || pts[currentIndex].mEndValue != pt.mEndValue)) {
// We're in the middle of a transition, but just got a
// non-transition style change changing to exactly the
@ -747,7 +749,7 @@ nsTransitionManager::ConsiderStartingTransition(nsCSSProperty aProperty,
// We need to check two things if we have a currently running
// transition for this property.
if (currentIndex != nsTArray<ElementPropertyTransition>::NoIndex) {
if (haveCurrentTransition) {
const ElementPropertyTransition &oldPT =
aElementTransitions->mPropertyTransitions[currentIndex];
@ -818,7 +820,7 @@ nsTransitionManager::ConsiderStartingTransition(nsCSSProperty aProperty,
"duplicate transitions for property");
}
#endif
if (currentIndex != nsTArray<ElementPropertyTransition>::NoIndex) {
if (haveCurrentTransition) {
pts[currentIndex] = pt;
} else {
if (!pts.AppendElement(pt)) {