diff --git a/index.bs b/index.bs index 3bd8859..5dc9d2b 100644 --- a/index.bs +++ b/index.bs @@ -188,12 +188,40 @@ A [=browsing context=] |ctx| is paint-timing eligible when one of the NOTE: this allows user agents to enable paint-timing only for some of the frames, in addition to the main frame, if they so choose. For example, a user agent may decide to disable paint-timing for cross-origin iframes, as in some scenarios their paint-timing might reveal information about the main frame. +The {{PaintTimingMixin}} interface {#sec-PaintTimingMixin} +
+ [Exposed=Window] + interface mixin PaintTimingMixin { + readonly attribute DOMHighResTimeStamp paintTime; + readonly attribute DOMHighResTimeStamp? presentationTime; + }; ++ +Objects including the {{PaintTimingMixin}} interface mixin have an associated paint timing info (null or a [=/paint timing info=]). + +paint timing info is a [=struct=]. It has the following [=struct/items=]: + +
[Exposed=Window] interface PerformancePaintTiming : PerformanceEntry {}; + PerformancePaintTiming includes PaintTimingMixin;{{PerformancePaintTiming}} extends the following attributes of {{PerformanceEntry}} interface: @@ -319,7 +347,7 @@ Reporting paint timing {#sec-reporting-paint-timing}
"first-paint"
, and the user agent is configured to mark [=first paint=], then invoke the [[#report-paint-timing]] algorithm with |document|, "first-paint"
, and |paintTimestamp|.
+ 1. Let |flushPaintTimings| be the following steps:
+ 1. If |reportedPaints| does not contain "first-paint"
, and the user agent is configured to mark [=first paint=], then [=report paint timing=] given |document|, "first-paint"
, and |paintTimingInfo|.
+
+ NOTE: [=First paint=] excludes the default background paint, but includes non-default background paint.
+
+ ISSUE: This should be turned into a normative note.
- NOTE: [=First paint=] excludes the default background paint, but includes non-default background paint.
+ 1. If |document| [=should report first contentful paint=], then:
+ 1. [=Report paint timing=] given |document|, "first-contentful-paint"
, and |paintTimingInfo|.
- ISSUE: This should be turned into a normative note.
+ 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=].
- 1. If |document| [=should report first contentful paint=], then:
- 1. Invoke the [[#report-paint-timing]] algorithm with |document|, "first-contentful-paint"
, and |paintTimestamp| as arguments.
+ NOTE: A [=document=] is not guaranteed to mark "first-paint"
or "first-contentful-paint"
. A completely blank [=document=] may never mark [=first paint=], and a [=document=] containing only elements that are not [=contentful=] may never mark [=first contentful paint=].
- 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=].
+ NOTE: The marking of [=first paint=] is optional. User-agents implementing paint timing should at the very least mark [=first contentful paint=].
- NOTE: A [=document=] is not guaranteed to mark "first-paint"
or "first-contentful-paint"
. A completely blank [=document=] may never mark [=first paint=], and a [=document=] containing only elements that are not [=contentful=] may never mark [=first contentful paint=].
+ 1. [=Report largest contentful paint=] given |document|, |paintTimingInfo|,
+ |paintedImages| and |paintedTextNodes|.
+ 1. [=Report element timing=] given |document|, |paintTimingInfo|,
+ |paintedImages| and |paintedTextNodes|.
- NOTE: The marking of [=first paint=] is optional. User-agents implementing paint timing should at the very least mark [=first contentful paint=].
+ 1. If the user-agent does not support implementation-defined presentation times, call |flushPaintTimings| and return.
- 1. [=Report largest contentful paint=] given |document|, |paintTimestamp|,
- |paintedImages| and |paintedTextNodes|.
- 1. [=Report element timing=] given |document|, |paintTimestamp|,
- |paintedImages| and |paintedTextNodes|.
+ 1. Run the following steps [=In parallel=]:
+ 1. Wait until an implementation-defined time when the current frame has been presented to the user.
+ 1. Set |paintTimingInfo|'s [=implementation-defined presentation time=] to the [=current high resolution time=] given |document|'s [=relevant global object=].
+ 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|.
"paint"
.
- 1. Set |newEntry|'s {{PerformanceEntry/startTime}} attribute to |paintTimestamp|.
+ 1. Set |newEntry|'s {{PerformanceEntry/startTime}} attribute to the [=default paint timestamp=] given |paintTimingInfo|.
1. Set |newEntry|'s {{PerformanceEntry/duration}} attribute to 0.
- 1. Add the PerformanceEntry |newEntry| object.
+ 1. Set |newEntry|'s [=PaintTimingMixin/paint timing info=] to |paintTimingInfo|.
+ 1. [=queue a PerformanceEntry|Queue=] |newEntry| in |document|'s [=relevant realm=].
1. [=list/Append=] |paintType| to |document|'s [=set of previously reported paints=].