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

Time:08-12

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 onl oad="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?

CodePudding user response:

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.

  • Related