Closed
Bug 1442861
Opened 6 years ago
Closed 6 years ago
Clear mNeedStyleFlush flag after ProcessPendingRestyles() in PresShell::DoFlushPendingNotifications()
Categories
(Core :: DOM: Animation, enhancement)
Core
DOM: Animation
Tracking
()
RESOLVED
FIXED
mozilla60
Tracking | Status | |
---|---|---|
firefox60 | --- | fixed |
People
(Reporter: hiro, Assigned: hiro)
References
Details
Attachments
(1 file)
We clear mNeedStyleFlush at the top of PresShell::DoFlushPendingNotifications(), but we might set the flag again to update animations in sequential task or to flush throttled animations. https://treeherder.mozilla.org/#/jobs?repo=try&revision=76b6f53d51892195e54b925128ea966fed5d79e2 I don't know the reason the flag is originally cleared at the top of DoFlushPendingNotifications() instead of after ProcessPendingRestyles(), but I guess there is a reason for that, so I did put another "mNeedStyleFlush = false" in the above try instead of moving original one.
Assignee | ||
Comment 1•6 years ago
|
||
The test case in the patch fails intermittently; https://treeherder.mozilla.org/#/jobs?repo=try&revision=76b6f53d51892195e54b925128ea966fed5d79e2&filter-resultStatus=testfailed&filter-resultStatus=busted&filter-resultStatus=exception&filter-resultStatus=retry&filter-resultStatus=usercancel&filter-resultStatus=running&filter-resultStatus=pending&filter-resultStatus=runnable&selectedJob=165746701 I know why it does, because I used requestAnimationFrame() instead of waiting for MozAfterPaint since MozAfterPaint is not reliably fired for now (bug 1419226). So we have to wait for two requestAnimationFrame instead. https://treeherder.mozilla.org/#/jobs?repo=try&revision=3cc4b58fe355add9d560ec178a0b2208279afea8
Assignee | ||
Comment 2•6 years ago
|
||
I thought the failure reason is that the transform animation in the test case wasn't sent to the compositor. But actually it was. It means that there is/are (a) case(s) nsIPresShell::NeedFlush returns false even if there is an animation on the compositor.
Assignee | ||
Comment 3•6 years ago
|
||
I guess the reason is that normal styling happened in the failure case thus mNeedThrottledAnimationFlush was cleared. https://treeherder.mozilla.org/#/jobs?repo=try&revision=414854550614eb077a43611963530d86cd854a45 In the above try, I used requestIdleCallback instead of requestAnimationFrame and used opacity animation instead of transform to avoid unthrottling it periodically.
Assignee | ||
Comment 4•6 years ago
|
||
Oh no. I did skip test_getUnanimatedComputedStyle in the try, so it's the culprit.
Assignee | ||
Comment 5•6 years ago
|
||
Apart from this bug, test_domwindowutils.html which is the test file that I added a new test case here should be re-written with async/await. I've filed bug 1443029 for that.
Assignee | ||
Comment 6•6 years ago
|
||
Hmm still failed on WebRender. To make the test pass on all platforms is bit hard. Given that the failure happens at the place we check DOMWindowUtils.needsFlush() returns true if there is a throtteled animation before we flush styles/layout [1]. So it doesn't a big problem for this fix. This bug fixes the case that DOMWindowUtils.needsFlush() returns true *after* flushing styles/layout. So I will drop the check here. I think we need bug 1419226 or bug 1437036 or bug 1419851 to make the check before flusing layout work fine. A new try; https://treeherder.mozilla.org/#/jobs?repo=try&revision=e1848136fde2b70b3276ecc94b149842730319af [1] https://hg.mozilla.org/try/rev/de27f3fc6f20e1744b46ec07030fda4a9c760df2#l1.61
Keywords: leave-open
Comment hidden (mozreview-request) |
Comment 8•6 years ago
|
||
mozreview-review |
Comment on attachment 8955963 [details] Bug 1442861 - Clear mNeedStyleFlush flag after ProcessPendingRestyles(). https://reviewboard.mozilla.org/r/224912/#review230888 Please fix that, then r=me ::: dom/base/test/file_domwindowutils_animation.html:202 (Diff revision 1) > + ok(SpecialPowers.wrap(animation).isRunningOnCompositor, > + "Opacity animation should run on the compositor"); > + > + // FIXME! Bug 1442861: We should make sure needsFlush() returns true > + // before flusing layout. > + //ok(utils.needsFlush(SpecialPowers.Ci.nsIDOMWindowUtils.FLUSH_STYLE), todo_is(utils.needsFlush(..), true)? ::: layout/base/PresShell.cpp:4244 (Diff revision 1) > > didStyleFlush = true; > + // We have to clear mNeedStyleFlush here again since we might have set the > + // flag during ProcessPendingRestyles (to update animations in sequential > + // task) or during flushing throttled animations. > + mNeedStyleFlush = false; So I don't think it is sound to clear it here, given the `~nsAutoScriptBlocker` can run script (for XBL stuff, maybe others) and request more restyles. I think it should be cleared under the scope in which we call ProcessPendingRestyles, that is, right after the call.
Attachment #8955963 -
Flags: review?(emilio) → review+
Comment 9•6 years ago
|
||
mozreview-review |
Comment on attachment 8955963 [details] Bug 1442861 - Clear mNeedStyleFlush flag after ProcessPendingRestyles(). https://reviewboard.mozilla.org/r/224912/#review230892 ::: layout/base/PresShell.cpp:4244 (Diff revision 1) > > didStyleFlush = true; > + // We have to clear mNeedStyleFlush here again since we might have set the > + // flag during ProcessPendingRestyles (to update animations in sequential > + // task) or during flushing throttled animations. > + mNeedStyleFlush = false; Also please mention in the comment that this is not a correctness issue in any way. if only it'd be an optimization.
Assignee | ||
Comment 10•6 years ago
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #8) > Comment on attachment 8955963 [details] > Bug 1442861 - Clear mNeedStyleFlush flag after ProcessPendingRestyles(). > > https://reviewboard.mozilla.org/r/224912/#review230888 > > Please fix that, then r=me > > ::: dom/base/test/file_domwindowutils_animation.html:202 > (Diff revision 1) > > + ok(SpecialPowers.wrap(animation).isRunningOnCompositor, > > + "Opacity animation should run on the compositor"); > > + > > + // FIXME! Bug 1442861: We should make sure needsFlush() returns true > > + // before flusing layout. > > + //ok(utils.needsFlush(SpecialPowers.Ci.nsIDOMWindowUtils.FLUSH_STYLE), > > todo_is(utils.needsFlush(..), true)? Unfortunately we can't use todo_is it since the value is sometime true, sometimes isn't. > ::: layout/base/PresShell.cpp:4244 > (Diff revision 1) > > > > didStyleFlush = true; > > + // We have to clear mNeedStyleFlush here again since we might have set the > > + // flag during ProcessPendingRestyles (to update animations in sequential > > + // task) or during flushing throttled animations. > > + mNeedStyleFlush = false; > > So I don't think it is sound to clear it here, given the > `~nsAutoScriptBlocker` can run script (for XBL stuff, maybe others) and > request more restyles. I think it should be cleared under the scope in which > we call ProcessPendingRestyles, that is, right after the call. Oh right. Indeed. I will revise the comment. Thanks!
Assignee | ||
Comment 11•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=f1331c79c67b30abbe8100e542eba252ee31bdcf
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → hikezoe
Status: NEW → ASSIGNED
Comment hidden (mozreview-request) |
Comment 13•6 years ago
|
||
Pushed by hikezoe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a8e9cae3c0b9 Clear mNeedStyleFlush flag after ProcessPendingRestyles(). r=emilio
Comment 14•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a8e9cae3c0b9
Assignee | ||
Comment 15•6 years ago
|
||
Why did I set leave-open here?
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox60:
--- → fixed
Keywords: leave-open
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
Updated•6 years ago
|
status-firefox60:
--- → fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•