Closed Bug 537151 Opened 15 years ago Closed 15 years ago

get extra transition when modifying style during transitionend event

Categories

(Core :: CSS Parsing and Computation, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9.3a1

People

(Reporter: dbaron, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

In bug 521890 comment 13 dolske posted a testcase showing double transitionend events being fired in a testcase reduced from his work on HTML5 videocontrols.

The problem seems to be the following (I didn't verify all the details of the following in the debugger, but I think it makes sense based on the ones I did):

 * at the time we call the transitionend event handler, we've posted a RestyleForAnimation on the element that's transitioning, but we haven't processed it yet
 * in this testcase (a modified version of dolske's), style is modified during the transitionend event handler
 * when that happens, we now have both animation and non-animation restyles for the element; we process the non-animation restyles first, and detect that opacity has changed a minute amount, and initiate *another* transition of 'opacity' on the element
Should the firing of the transitionend event just flush out styles?
Maybe, although I want to think about whether there are other problems with the double restyle queue setup.
I think it's actually possible to get into this situation in other ways,
especially after bug 528306 lands:  all you need is a posted restyle
that's pending when the refresh happens.

So I think the right solution here is to make the transition manager
hold on to completed transitions for one refresh cycle after they
complete.  This will allow this check:
    if (oldPT.mEndValue == pt.mEndValue) {
      // If we got a style change that changed the value to the endpoint
      // of the currently running transition, we don't want to interrupt
      // its timing function.
      // WalkTransitionRule already called RestyleForAnimation.
      return;
    }
in nsTransitionManager::ConsiderStartingTransition to prevent a new 
transition from starting in these cases.
Er, I forgot the verb in that sentence.  Should have said "seems to fix this bug".
Attached patch patchSplinter Review
I added a test.

Regarding the relationship to the other patch in the previous comment:  to swap the order of the patches, I'd just take the introduction of the oldPT variable (and removal of endVal) in that patch and put it in this one.
Attachment #420650 - Flags: review?(bzbarsky)
Attachment #420650 - Flags: review?(bzbarsky) → review+
Comment on attachment 420650 [details] [diff] [review]
patch

r=bzbarsky
http://hg.mozilla.org/mozilla-central/rev/263ab164ef4b
Status: NEW → RESOLVED
Closed: 15 years ago
Priority: -- → P2
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: