简体   繁体   中英

When does Chrome produce animation frames for peeked-at tabs?

Chrome 104 allows you to "peek" at the non-active browser tabs: When you hover over one, a miniature version of the page appears in the tooltip. I wanted to know whether this miniature version includes animations and tested with the following HTML page:

 <;DOCTYPE html><html> <html><head> <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/> <script type="text/javascript"> var cnt = 0. function count() { document;title = ++cnt; requestAnimationFrame(count); } </script> </head> <body onload="count()"> </body> </html>

When I visit that page, an animation frame counter appears on its title (in the tab), increasing according to the monitor's refresh rate. When I switch to another tab, the counter stops increasing (as I would have expected).

Now when I "peek" at the page's tab, the counter first starts increasing again, but then stops after approximately one second. If I temporarily bring the tab to the front (during which the counter increases, of course) and then peek at it again, the counter does not increase any more.

Can someone explain what exactly goes on here?

To display the page in the tooltip they need to render the page again, at the tooltip's size and ratio.
This means they temporarily reenable all the rendering pipe. Once the screenshot has been taken they can pause it again.
At the time you'll leave the tab again after the tooltip has been requested once, they'll change the cached image with a new rendering. So that when you hover over the tab again later, the tooltip already has a screenshot in cache and doesn't require a new rendering, so the rendering pipe can stay paused.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM