Description
From an email thread with @domenic...
Here's how I would do it.
In the paint timing spec, define an algorithm "report paint timing" which takes a Document. HTML will call this during step 7.12 of its "update the rendering" step, something like
For each fully active Document in docs, update the rendering or user interface of that Document and its browsing context to reflect the current state, and report paint timing for that Document while doing so.
(We'll modify HTML via a pull request.)
Then the contents of the "report paint timing" algorithm contains most of https://github.com/WICG/paint-timing#definition, adapted to algorithm form. To adapt to algorithm form, you'll want to do things like storing a state ("no paint timing sent", "first-paint sent", "first-contentful-paint sent") which you check. And it will need to use the appropriate invocations around firing a performance entry. Otherwise the existing text there is pretty good, with regard to trying to be precise about the timing.