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)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla1.9.3a1
People
(Reporter: mstange, Assigned: dbaron)
References
(Blocks 1 open bug)
Details
Attachments
(4 files, 2 obsolete files)
|
646 bytes,
text/html
|
Details | |
|
3.13 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
1.82 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
7.47 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
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.
| Reporter | ||
Comment 1•16 years ago
|
||
| Reporter | ||
Comment 3•15 years ago
|
||
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.
| Reporter | ||
Comment 5•15 years ago
|
||
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
| Assignee | ||
Comment 6•15 years ago
|
||
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
| Assignee | ||
Comment 7•15 years ago
|
||
Attachment #416703 -
Attachment is obsolete: true
Attachment #416850 -
Flags: review?(bzbarsky)
| Assignee | ||
Comment 8•15 years ago
|
||
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)
| Assignee | ||
Comment 9•15 years ago
|
||
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)
Updated•15 years ago
|
Attachment #416850 -
Flags: review?(bzbarsky) → review+
Comment 10•15 years ago
|
||
Comment on attachment 416851 [details] [diff] [review]
patch 2: optimize GetElementTransitions
r=bzbarsky
Attachment #416851 -
Flags: review?(bzbarsky) → review+
Comment 11•15 years ago
|
||
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+
| Assignee | ||
Comment 12•15 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/5bd926e01c24
http://hg.mozilla.org/mozilla-central/rev/2ecf535b1505
http://hg.mozilla.org/mozilla-central/rev/a189e7282d6a
Priority: -- → P1
Target Milestone: --- → mozilla1.9.3a1
| Assignee | ||
Updated•15 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
| Assignee | ||
Updated•15 years ago
|
Blocks: css-transitions
You need to log in
before you can comment on or make changes to this bug.
Description
•