New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement visibility API and the notion of non-visible pipeline #9751
Comments
I could probably take a stab at this with a little guidance. Let me know if you have any other thoughts I could use as a starting point or any places in the codebase off the top of your head where you'd expect to see some major changes. |
This has several parts:
|
And I'll add:
This is needed to make a pipeline non visible. |
Re starting point: I built a fake This is wrong because it uses You need to start Servo with Hope that helps. |
Thanks guys -- I'll start looking at adapting the pipeline and preparing the Document API changes and circle back with any questions. Feel free to assign. |
@jmr0 Any progress? Any questions? |
Hey @jdm, I caught up with Paul over on IRC yesterday and decided I'd focus on the iframe part, since it seems we currently don't support the events necessary to hook to the Document API (e.g. OS lock screen, screen minimized). Ongoing work is here https://github.com/jmr0/servo/commits/visibility_api -- hope to have something deliverable over the weekend. Thanks! |
Almost there with this one. Ended up implementing set/getVisible (Browser API) and some of the timer/compositor reactions to Pipeline visibility changes. Need to take a closer look at requestAnimationFrame and add some tests but all the other parts are pretty much complete. https://github.com/servo/servo/compare/master...jmr0:visibility_api?expand=1 |
@jmr0 is it possible to set the iframe visibility property in
Does that make sense? Also - the fact that 1) there is an event and 2) getVisibility() is async, doesn't make a lot of sense. It's a consequence of how it was built in Gecko. I think getVisibility() should not be async. |
@paulrouget Yeah that makes perfect sense, I had added that hack to |
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 -->
@paulrouget @jdm We can probably close this and #9566, and possibly open a new related issue with the caveats and parts that weren't covered in #10225 (as per my PR comment) and include anything else you folks can think of. Happy to file that if you agree! |
That's reasonable. Please do! |
Spec: https://w3c.github.io/page-visibility/
MDN: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
When a document is not visible (usually a background tab), the document is in "slow mode".
setTimeout
andsetInterval
are called less often,requestAnimationFrame
is not called and there's probably a lot more things that can slowed down, or stopped.We can't just use
pipeline.freeze()
/pipeline.thaw()
as we still need events to occur.Related issue: #9566
The text was updated successfully, but these errors were encountered: