w3c / webdriver-bidi

Bidirectional WebDriver protocol for browser automation
https://w3c.github.io/webdriver-bidi/
351 stars 38 forks source link

Editorial: formalize screenshot waiting algorithm #538

Open jugglinmike opened 11 months ago

jugglinmike commented 11 months ago

Alternatively, we might define an algorithm for HTML to explicitly invoke during Update the rendering. There's certainly precedence for this, as HTML already signals three other specifications near the moment we're interested in here in BiDi.

By integrating with requestAnimationFrame, this approach precludes coordination with HTML, but it's not without its downsides, e.g.

...and with that, I've all but talked myself out of this patch :P


Preview | Diff

jugglinmike commented 11 months ago

I believe the correct way to do this would be with a specific step in https://html.spec.whatwg.org/#update-the-rendering (c.f. mark paint timing) rather than invoking DOM APIs.

Great minds think alike--that's exactly what I was getting at in the description of this pull request! I've added a commit to use that approach, instead. I'm expecting folks will want to workshop the design some more, so I'm going to hold off on submitting anything to HTML. But to help explain this patch, here's how it could be integrated in its current form:

      <li><p>For each <span>fully active</span> <code>Document</code> <var>doc</var> in
      <var>docs</var> run <span>process top layer removals</span> given <var>doc</var>.</p></li>

+     <li><p>For each <span>fully active</span> <code>Document</code> <var>doc</var> in
+     <var>docs</var> run <span>resume suspended renderings</span> given <var>doc</var>'s
+     <span>browsing context</span>. <ref>WEBDRIVERBIDI</ref></p></li>
     </ol>
    </li>
jugglinmike commented 9 months ago

I just realized that BiDi has a formal mechanism for tracking patches to external specs. I've pushed up a commit to include the change I described in my previous comment, and I've resolved merge conflicts from recent changes in the main branch.

What do you think, @jgraham?