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

Pass document as input to paint timing algorithms #67

Merged
merged 1 commit into from
Mar 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions painttiming.bs
Original file line number Diff line number Diff line change
Expand Up @@ -96,35 +96,33 @@ Processing model {#sec-processing-model}
Reporting paint timing {#sec-reporting-paint-timing}
--------------------------------------------------------

<h4 dfn>Mark paint timing</h4>
<h4 dfn export>Mark paint timing</h4>

<div algorithm="Mark paint timing">
Perform the following steps:
When asked to [=mark paint timing=] given a [=Document=] |document| as input, perform the following steps:

1. Let |paintTimestamp| be the input timestamp.
1. If this instance of [=update the rendering=] is the [=first paint=], then record the timestamp as |paintTimestamp| and invoke the [[#report-paint-timing]] algorithm with two arguments: <code>"first-paint"</code> and |paintTimestamp|.
1. Let |paintTimestamp| be the [=current high resolution time=].
1. If this instance of [=update the rendering=] is the [=first paint=] of |document|, then invoke the [[#report-paint-timing]] algorithm with |document|, <code>"first-paint"</code>, and |paintTimestamp|.

NOTE: [=First paint=] excludes the default background paint, but includes non-default background paint.

1. Otherwise, if this instance of [=update the rendering=] is the [=first contentful paint</a>, then record the timestamp as |paintTimestamp| and invoke the [[#report-paint-timing]] algorithm with two arguments: <code>"first-contentful-paint"</code> and |paintTimestamp|.
1. If this instance of [=update the rendering=] is the [=first contentful paint=] of |document|, then invoke the [[#report-paint-timing]] algorithm with |document|, <code>"first-contentful-paint"</code>, and |paintTimestamp| as arguments.

NOTE: This paint must include text, image (including background images), non-white canvas or SVG.

1. Otherwise, do nothing and return.

NOTE: A parent frame should not be aware of the paint events from its child iframes, and vice versa. This means that a frame that contains just iframes will have [=first paint=] (due to the enclosing boxes of the iframes) but no [=first contentful paint=].
</div>

<h4 dfn>Report paint timing</h4>

<div algorithm="Report paint timing">
Given two arguments |paintType| and |paintTimestamp|, perform the following steps:
When asked to [=report paint timing=] given |document|, |paintType|, and |paintTimestamp| as arguments, perform the following steps:
1. Create a new {{PerformancePaintTiming}} object |newEntry| and set its attributes as follows:
1. Set |newEntry|'s {{PerformanceEntry/name}} attribute to |paintType|
1. Set |newEntry|'s {{PerformanceEntry/entryType}} attribute to <code>paint</code>
1. Set |newEntry|'s {{PerformanceEntry/startTime}} attribute to |paintTimestamp|
1. Set |newEntry|'s {{PerformanceEntry/name}} attribute to |paintType|.
1. Set |newEntry|'s {{PerformanceEntry/entryType}} attribute to <code>"paint"</code>.
1. Set |newEntry|'s {{PerformanceEntry/startTime}} attribute to |paintTimestamp|.
1. Set |newEntry|'s {{PerformanceEntry/duration}} attribute to 0.
1. <a href="https://w3c.github.io/performance-timeline/#dfn-queue-a-performanceentry">Add the PerformanceEntry</a> |newEntry| object.
1. <a href="https://w3c.github.io/performance-timeline/#dfn-queue-a-performanceentry">Add the PerformanceEntry</a> |newEntry| object, with |document|'s [=relevant global object=] as input.
</div>


Expand Down