Open
Bug 649247
Opened 14 years ago
Updated 2 years ago
Style resolution race conditions when triggering CSS transitions / animations
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
NEW
People
(Reporter: fryn, Unassigned)
References
(Depends on 2 open bugs, )
Details
I plan to discuss style resolution in relation to CSS transitions with David Baron soon, but Gavin wanted me to file a bug and reference it in the patch I'm about to land, so here it is.
A typical block of code that I write to skip the animation once is:
CSS:
#foo { width: 50px; -moz-transition: width 1s; }
JS:
var foo = document.getElementById('foo');
foo.style.MozTransition = 'none';
foo.style.width = '100px';
foo.clientTop; // force style resolution
foo.style.MozTransition = '';
Using element.clientTop in this way is rather common in our codebase:
https://mxr.mozilla.org/mozilla-central/search?string=.clientTop%3B
Gavin considers this to be a hack and would like some investigation and dicussion on why we need this or how to make it better.
Last week, I made a few testcases for this here:
http://frankyan.com/labs/racy.html
It is so named for the race conditions.
Whether or not the transitions occur seem to be unpredictable for the last two boxes on Linux.
Comment 1•14 years ago
|
||
So, a few thoughts here:
* it would probably be good if we had common functions for flush_style, flush_frames(), flush_layout(), etc. In this case we only need flush_style() (which you can do with something like getComputedStyle(document.documentElement, "").color -- at least so that we can spot intentional flushes easily, and perhaps work on figuring out how we can avoid them
* a possible solution here would be an API like the one I proposed here:
http://lists.w3.org/Archives/Public/www-style/2011Mar/0729.html though the only response so far: http://lists.w3.org/Archives/Public/www-style/2011Mar/0730.html is not exactly supportive. With an API like this, if you're doing *all* your transitions from script, you could just use this API rather than using style-change-triggered transitions.
Comment 2•14 years ago
|
||
> * it would probably be good if we had common functions for flush_style,
> flush_frames(), flush_layout(), etc.
Yes! Can we put them somewhere where reftest can trigger them too?
Reporter | ||
Updated•12 years ago
|
Reporter | ||
Updated•12 years ago
|
Summary: Investigate / discuss style resolution in relation to CSS transitions → Style resolution race conditions when triggering CSS transitions / animations
Reporter | ||
Updated•11 years ago
|
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INCOMPLETE
Updated•11 years ago
|
Reporter | ||
Updated•11 years ago
|
Status: REOPENED → NEW
Reporter | ||
Updated•9 years ago
|
Group: core-security
Comment 3•9 years ago
|
||
Frank: What is the concern that caused you to mark this a security bug?
Flags: needinfo?(fryn)
Updated•9 years ago
|
Group: core-security → layout-core-security
Updated•9 years ago
|
Group: layout-core-security
Updated•6 years ago
|
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•