Skip to content
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

Add PaintTimingMixin, exposing interoperable + implementation defined paint timestamps #108

Merged
merged 2 commits into from
Nov 12, 2024

Conversation

noamr
Copy link
Contributor

@noamr noamr commented Nov 12, 2024

Add PaintTimingMixin, which exposes two timestamps:

  • paintTime (the end of "update the rendering phase")
  • presentationTime (an optional implementation-defined timestamp)

startTime returns presentationTime, or paintTime if presentationTime is not implemented.

Currently this PaintTimingMixin is only included in PerformancePaintTiming, but it will be included in ElementTiming, LargestContentfulPaint, PerformanceEventTiming, and PerformanceLongAnimationFrameTiming as a follow up.

This is based on a resolution at the web performance working group. Minutes: https://docs.google.com/document/d/1ZWAUJZBJUvSUyShvKXNEU-cuCe47jpgbR69ckWZUTfI/edit?tab=t.0#heading=h.kb3idfbysfg7

Closes #62


Preview | Diff

- `paintTime` (the end of "update the rendering phase")
- `presentationTime` (an optional implementation-defined timestamp)

`startTime` returns `presentationTime`, or `paintTime` if `presentationTime`
is not implemented.

Currently this `PaintTimingMixin` is only included in `PerformancePaintTiming`,
but it will be included in `ElementTiming`, `LargestContentfulPaint`,
`PerformanceEventTiming`, and `PerformanceLongAnimationFrameTiming` as a follow up.

This is based on a resolution at the web performance working group.
Minutes: https://docs.google.com/document/d/1ZWAUJZBJUvSUyShvKXNEU-cuCe47jpgbR69ckWZUTfI/edit?tab=t.0#heading=h.kb3idfbysfg7

Closes #62
@noamr noamr changed the title Add PaintTimingMixin, which exposes two timestamps: Add PaintTimingMixin, exposing interoperable + implementation defined paint timestamps Nov 12, 2024
index.bs Outdated

The {{PaintTimingMixin/paintTime}} attribute's getter step is to return [=/this=]'s [=PaintTimingMixin/paint timing info=]'s [=paint timing info/rendering update end time=].

The {{PaintTimingMixin/presentationTime}} attribute's getter step is to return [=/this=]'s [=PaintTimingMixin/paint timing info=]'s [=paint timing info/implementation-defined presentation time=] if it is not null; Otherwise zero.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this return undefined if the implementation does not support the presentationTime attribute? I thought that's why it was marked optional. Zero might be misinterpreted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

index.bs Outdated
1. If |document|'s [=environment settings object/cross-origin isolated capability=] is false, then:
1. Coarsen |paintTimingInfo|'s [=implementation-defined presentation time=] to the next multiple of 4 milliseconds, or coarser.
1. Wait until the [=current high resolution time=] is |paintTimingInfo|'s [=implementation-defined presentation time=].
1. [=Queue a global task=] on the [=performance timeline task source=] given |document|'s [=relevant global object=] to |flushPaintTimings|.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably read "to execute |flushPaintTimings|"

(or "call", "run", etc... but I think you need a verb.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@clelland clelland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks great

@noamr noamr merged commit 5260924 into main Nov 12, 2024
2 checks passed
github-actions bot added a commit that referenced this pull request Nov 12, 2024
…ed paint timestamps (#108)

SHA: 5260924
Reason: push, by noamr

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Timestamps should be specified in an interoperative way
2 participants