Closed Bug 522643 Opened 16 years ago Closed 15 years ago

Setting transition duration during a transition results in strange behaviour

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla1.9.3a1

People

(Reporter: mstange, Assigned: dbaron)

References

(Blocks 1 open bug)

Details

Attachments

(4 files, 2 obsolete files)

STR: 1. Load the testcase. 2. Click the buttons in this order: duration 5s, width 400px, duration 0, width 0 Actual results: The box grows all the way to 400px, and only when it's finished its width is set to zero. Expected results: Changing the width to 0 should be instantaneous.
Attached file testcase (obsolete) —
This looks fixed to me, using the latest trunk build.
It's fixed insofar as clicking the "width 0" button immediately causes a change of direction and doesn't complete the running transition first. But the transition back to zero width still takes time, even though transition-duration has been set to zero.
Oh, I see. That is indeed not correct behavior.
Attached file fixed testcase
I take that back. The only thing that has changed is that transition-duration no longer accepts the value '0' without a unit, which broke the testcase. With the fixed testcase nothing has changed.
Attachment #406632 - Attachment is obsolete: true
Attached patch patch (obsolete) — Splinter Review
Oops, I managed to miss the bugmail for this bug when you filed it (but, luckily, I saw it today). Here's a patch that fixes it. I'm not entirely happy with it, though; I'd like to consolidate the new code block in StyleContextChanged a bit better with the one right above it, at least. (And maybe I should also move the move-the-static-function-up and further-optimize-GetElementTransitions parts into separate patches, although I don't think it's that hard to follow...)
Assignee: nobody → dbaron
Status: NEW → ASSIGNED
The next patch will make us call GetElementTransitions much more, so we should make it faster than a hashtable lookup in most cases.
Attachment #416851 - Flags: review?(bzbarsky)
Attached patch patch 3: the fixSplinter Review
The diff -w for the chunk that involves reindentation is: @@ -487,5 +484,10 @@ // 'transition-property'. - if (et && disp->mTransitions[0].GetProperty() != - eCSSPropertyExtra_all_properties) { + // Also stop any transitions for properties that just changed (and are + // still in the set of properties to transition), but we didn't just + // start the transition because delay and duration are both zero. + if (et) { + PRBool checkProperties = + disp->mTransitions[0].GetProperty() != eCSSPropertyExtra_all_properties; nsCSSPropertySet allTransitionProperties; + if (checkProperties) { for (PRUint32 i = disp->mTransitionPropertyCount; i-- != 0; ) { @@ -512,2 +514,3 @@ } + } @@ -516,2 +519,3 @@ NS_ABORT_IF_FALSE(i != 0, "empty transitions list?"); + nsStyleAnimation::Value currentValue; do { @@ -519,3 +523,7 @@ ElementPropertyTransition &pt = pts[i]; - if (!allTransitionProperties.HasProperty(pt.mProperty)) { + if ((checkProperties && + !allTransitionProperties.HasProperty(pt.mProperty)) || + !TransExtractComputedValue(pt.mProperty, aNewStyleContext, + currentValue) || + currentValue != pt.mEndValue) { pts.RemoveElementAt(i);
Attachment #416853 - Flags: review?(bzbarsky)
Attachment #416850 - Flags: review?(bzbarsky) → review+
Comment on attachment 416851 [details] [diff] [review] patch 2: optimize GetElementTransitions r=bzbarsky
Attachment #416851 - Flags: review?(bzbarsky) → review+
Comment on attachment 416853 [details] [diff] [review] patch 3: the fix >+++ b/layout/style/nsTransitionManager.cpp >+ if ((checkProperties && >+ !allTransitionProperties.HasProperty(pt.mProperty)) || >+ !TransExtractComputedValue(pt.mProperty, aNewStyleContext, >+ currentValue) || >+ currentValue != pt.mEndValue) { This condition could use a comment explaining what it's really testing. r=me with that.
Attachment #416853 - Flags: review?(bzbarsky) → review+
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: