Implement non-visible pipeline and iframe visibility methods#10225
Implement non-visible pipeline and iframe visibility methods#10225bors-servo merged 1 commit intoservo:masterfrom jmr0:visibility_api
Conversation
|
Heads up! This PR modifies the following files:
|
|
r? @jdm |
|
Just left a few nits and questions, @jdm should still review it thoroughly. Review status: 0 of 14 files reviewed at latest revision, 7 unresolved discussions. components/compositing/pipeline.rs, line 363 [r1] (raw file): components/compositing/pipeline.rs, line 368 [r1] (raw file): components/compositing/pipeline.rs, line 369 [r1] (raw file): components/script/script_thread.rs, line 1384 [r1] (raw file): components/script/script_thread.rs, line 1397 [r1] (raw file): components/script/dom/htmliframeelement.rs, line 228 [r1] (raw file): tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_visibility.html, line 34 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: 0 of 14 files reviewed at latest revision, 7 unresolved discussions. components/script/script_thread.rs, line 1397 [r1] (raw file): Comments from the review on Reviewable.io |
|
components/script/dom/htmliframeelement.rs, line 228 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: 0 of 14 files reviewed at latest revision, 7 unresolved discussions. components/script/dom/htmliframeelement.rs, line 228 [r1] (raw file): Comments from the review on Reviewable.io |
|
I haven't tested, but can you make sure:
|
|
|
☔ The latest upstream changes (presumably #8641) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@jmr0 not sure you saw what I was saying on IRC:
|
|
Had a chat with @paulrouget on IRC and decided it might be better to work on the W3C Page Visibility API changes as part of a separate PR, noting that the visibility changes triggered by the Mozbrowser API should be reflected by documents within the Mozbrowser iframe (i.e. point #2 discussed above) |
|
Addressed @emilio's and @paulrouget's comments |
|
I'm really sorry that I haven't reviewed this yet; I've had a million other items vying for my attention. If I don't think I'm going to get to it this week I'll hand it off to somebody else. |
components/script/script_thread.rs
Outdated
| } | ||
| let document = inner_page.document(); | ||
| for iframe in &document.collect_descendant_iframes() { | ||
| iframe.set_visible(visible); |
There was a problem hiding this comment.
What about doing that at the pipeline level instead, where the frame tree is available.
There was a problem hiding this comment.
I mean in the constellation.
There was a problem hiding this comment.
Also - a frame can have multiple pipelines (history). And you want to change the visibility of these pipelines as well (in case of navigation). So this definitively needs to happen at the constellation level.
|
I looked quickly at the PR and added some comments. Please note that I'm not a reviewer, so take my comments with a grain of salt :D |
|
Note: I'm about halfway through reviewing these changes. |
|
Thank you so much for tackling this, @jmr0! This is really great work, and I apologize for the delay in reviewing it. I think the general design here is correct, but there are some subtleties about what we can skip and where we should be sending messages that need to be sorted out. I also agree with the majority of the comments that @paulrouget left. Let us know if there's anything we can do to help you! -S-awaiting-review +S-needs-code-changes Reviewed 2 of 14 files at r1, 6 of 10 files at r2, 6 of 7 files at r3. components/compositing/compositor.rs, line 255 [r3] (raw file): components/compositing/compositor.rs, line 728 [r3] (raw file): components/compositing/compositor.rs, line 736 [r3] (raw file): components/compositing/compositor.rs, line 1632 [r3] (raw file): components/compositing/constellation.rs, line 988 [r3] (raw file): components/compositing/constellation.rs, line 993 [r3] (raw file): components/compositing/constellation.rs, line 1353 [r3] (raw file): components/compositing/pipeline.rs, line 368 [r1] (raw file): components/compositing/pipeline.rs, line 62 [r3] (raw file): components/compositing/pipeline.rs, line 361 [r3] (raw file): components/compositing/pipeline.rs, line 366 [r3] (raw file): components/compositing/pipeline.rs, line 368 [r3] (raw file): components/compositing/pipeline.rs, line 372 [r3] (raw file): components/script/script_thread.rs, line 1397 [r1] (raw file): components/script/script_thread.rs, line 1420 [r3] (raw file): components/script/dom/document.rs, line 1495 [r3] (raw file): components/script/dom/htmliframeelement.rs, line 247 [r3] (raw file): components/script/dom/webidls/BrowserElement.webidl, line 87 [r3] (raw file): components/script/dom/webidls/BrowserElement.webidl, line 92 [r3] (raw file): components/script_traits/lib.rs, line 127 [r3] (raw file): tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_visibility.html, line 19 [r3] (raw file): tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_visibility.html, line 24 [r3] (raw file): Comments from Reviewable |
|
Review status: all files reviewed at latest revision, 11 unresolved discussions. tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_visibility.html, line 19 [r3] (raw file):
|
|
Thanks for sticking with this! Please squash these into one descriptive commit :) Reviewed 2 of 2 files at r11. tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_visibility.html, line 19 [r3] (raw file):
|
|
@jdm Thanks for all your help -- definitely learned quite a bit more about Servo's architecture with this one :) |
|
@bors-servo: r+ |
|
📌 Commit 2bff131 has been approved by |
Implement non-visible pipeline and iframe visibility methods This addresses #9566 and a good part of #9751, specifically: * Pipeline has a notion of visibility * IFrame setVisible/getVisible interface with IFrame's pipeline visibility * IFrame mozbrowservisibilitychange responds to changes in visibility * Pipeline visibility is used to limit animations (requestAnimationFrame does not tick animations when hidden) and to increase timer intervals (currently set to a minimum of 1 second while hidden) Absent for now are any changes to the Document API and general implementation of the Page Visibility API, since the more interesting parts require knowledge of whether the user agent is minimized, OS screen locked, etc. cc @paulrouget @jdm <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10225) <!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows |
|
Thank you @jmr0 ! This is excellent work. |
|
Thanks for all the help (and patience) @paulrouget! :) |
This addresses #9566 and a good part of #9751, specifically:
Absent for now are any changes to the Document API and general implementation of the Page Visibility API, since the more interesting parts require knowledge of whether the user agent is minimized, OS screen locked, etc.
cc @paulrouget @jdm
This change is