diff --git a/index.bs b/index.bs
index 7b677f1..45c22a7 100644
--- a/index.bs
+++ b/index.bs
@@ -51,6 +51,15 @@ urlPrefix: https://html.spec.whatwg.org/multipage/webappapis.html; spec: html;
text: height; url: #dom-img-height;
urlPrefix: https://drafts.csswg.org/cssom-view/; spec: CSSOM-VIEW;
type: dfn; text: visual viewport; url: visual-viewport;
+urlPrefix: https://w3c.github.io/paint-timing/; spec: PAINT-TIMING;
+ type: dfn; url:#the-paint-timing-steps; text: the paint timing steps
+ type: dfn; url:#set-of-owned-text-nodes; text: set of owned text nodes
+ type: dfn; url:#exposed-for-paint-timing; text: exposed for paint timing
+ type: dfn; url:#pending-image-record; text: pending image record
+ type: dfn; for:pending image record; url:#pending-image-record-element; text: element
+ type: dfn; for:pending image record; url:#pending-image-record-loadtime; text: loadTime
+ type: dfn; for:pending image record; url:#pending-image-record-request; text: request
+ type: dfn; url:#timing-eligible; text: timing-eligible
Introduction {#sec-intro}
@@ -59,22 +68,19 @@ Introduction {#sec-intro}
This section is non-normative.
The LargestContentfulPaint API enables developers to gain visibility into the loading and rendering process of the web pages, in order for them to be able to optimize it.
-Developers today don't have a reliable metric that correlates with their user's visual rendering experience. Existing metrics such as First Paint and First Contentful Paint focus on initial rendering, but don't take into account the importance of the painted content, and therefore may indicate times in which the user still does not consider the page useful.
+Developers need a reliable metric that correlates with their user's visual rendering experience. Paint loading metrics such as First Paint and First Contentful Paint focus on initial rendering, but don't take into account the importance of the painted content, and therefore may indicate times in which the user still does not consider the page useful.
-Largest Contentful Paint (LCP) aims to be a new page-load metric that:
-* better correlates with user experience than the existing page-load metrics
+Largest Contentful Paint (LCP) aims to be a page-load metric that:
+* better correlates with user experience than First Paint and First Contentful Paint
* is easy to understand and reason about
* reduces the chance of gaming
The largest paint during the loading process of the page is likely to signify a meaningful event from the user's perspective, and is therefore something we want to expose by default to developers, enabling performance teams, analytics providers and lab-based measurement tools to collect those metrics without requiring extra annotation work by the folks creating the content itself.
-The API relies heavily on [[ELEMENT-TIMING]], which can be thought of as the low-level primitive that this high-level feature is built on top of. For cases where the content creators are willing to annotate their content and indicate the important points in the page's loading cycle, Element Timing is the API that will provide them more control over the elements that get reported.
+The API relies heavily on concepts defined in [[PAINT-TIMING]], which can be thought of as the low-level primitive that this high-level feature is built on top of. For cases where the content creators are willing to annotate their content and indicate the important points in the page's loading cycle, [[ELEMENT-TIMING]] is the API that will provide them more control over the elements that get reported.
-Elements exposed {#sec-elements-exposed}
-------------------------
-
-The Largest Contentful Paint API will only expose element types that are already exposed by the Element Timing API. In this case, there is no need to annotate them with the elementtiming
attribute.
+NOTE: The Largest Contentful Paint API will only expose elements that are [=timing-eligible=]. Note that unlike Element Timing, there is no need to annotate elements in order to have them be eligible for Largest Contentful Paint.
Largest content {#sec-largest-content}
------------------------
@@ -109,6 +115,24 @@ The LargestContentfulPaint API is based on heuristics. As such, it is error pron
* To account for image carousels, content is still considered as the largest even if it's removed. This presents problems for websites with splash screens that use large content as placeholders.
+Terminology {#sec-terminology}
+==============================
+
+A largest contentful paint candidate is a [=struct=] containing the
+following members:
+
+* element, an [=/element=]
+* request, a [=/Request=] or null
+
+An [=largest contentful paint candidate=] |candidate| is eligible to be largest contentful paint if it meets the
+following criteria:
+
+* |candidate|'s [=largest contentful paint candidate/element=]'s opacity is > 0
+* |candidate|'s [=largest contentful paint candidate/element=] is a text node, or |candidate|'s [=largest contentful paint candidate/request=]'s
+ [=/response=]'s content length in bytes is >= |candidate|'s [=largest contentful paint candidate/element=]'s [=effective visual size=] * 0.004
+
+ Note: This heuristic tests whether the image resource contains sufficient data to be seen as contentful to the user. It compares the transferred file size with the number of pixels which are actually produced, after decoding and any image scaling is applied. Images which encode a very large number of pixels with in a very small number of bytes are typically low-content backgrounds, gradients, and the like, and are not considered as [=largest contentful paint candidates=].
+
Largest Contentful Paint {#sec-largest-contentful-paint}
=======================================
@@ -131,32 +155,36 @@ interface LargestContentfulPaint : PerformanceEntry {
Each {{LargestContentfulPaint}} object has these associated concepts:
-* A renderTime, initially set to 0.
-* A size, initially set to 0.
-* A loadTime, initially set to 0.
-* An id, initially set to the empty string.
-* A url, initially set to the empty string.
-* An element containing the associated {{Element}}, initially set to null
.
+* A renderTime, initially set to 0.
+* A size, initially set to 0.
+* A loadTime, initially set to 0.
+* An id, initially set to the empty string.
+* A url, initially set to the empty string.
+* An element containing the associated {{Element}}, initially set to null
.
The {{PerformanceEntry/entryType}} attribute's getter must return the {{DOMString}} "largest-contentful-paint"
.
The {{PerformanceEntry/name}} attribute's getter must return the empty string.
-The {{PerformanceEntry/startTime}} attribute's getter must return the value of this's renderTime if it is not 0, and the value of this's loadTime otherwise.
+The {{PerformanceEntry/startTime}} attribute's getter must return the value of [=this=]'s renderTime if it is not 0, and the value of [=this=]'s [=LargestContentfulPaint/loadTime=] otherwise.
The {{PerformanceEntry/duration}} attribute's getter must return 0.
-The {{LargestContentfulPaint/renderTime}} attribute must return the value of this's renderTime.
+The {{LargestContentfulPaint/renderTime}} attribute must return the value of [=this=]'s [=LargestContentfulPaint/renderTime=].
-The {{LargestContentfulPaint/loadTime}} attribute must return the value of this's loadTime.
+The {{LargestContentfulPaint/loadTime}} attribute must return the value of [=this=]'s [=LargestContentfulPaint/loadTime=].
-The {{LargestContentfulPaint/size}} attribute must return the value of this's size.
+The {{LargestContentfulPaint/size}} attribute must return the value of [=this=]'s [=LargestContentfulPaint/size=].
-The {{LargestContentfulPaint/id}} attribute must return the value of this's id.
+The {{LargestContentfulPaint/id}} attribute must return the value of [=this=]'s [=LargestContentfulPaint/id=].
-The {{LargestContentfulPaint/url}} attribute must return the value of this's url.
+The {{LargestContentfulPaint/url}} attribute must return the value of [=this=]'s [=LargestContentfulPaint/url=].
-The {{LargestContentfulPaint/element}} attribute's getter must return the value returned by running the get an element algorithm with element and null as inputs.
+The {{LargestContentfulPaint/element}} attribute's getter must perform the following steps:
+
"largest-contentful-paint"
in {{PerformanceObserver/supportedEntryTypes}} for {{Window}} contexts.
-This allows developers to detect support for the API.
-In order to potentially add a {{LargestContentfulPaint}} entry, the user agent must run the following steps:
-|width| * |height|
.
1. Let |root| be |document|'s browsing context's top-level browsing context's active document.
1. Let |rootWidth| be |root|'s visual viewport's width, excluding any scrollbars.
1. Let |rootHeight| be |root|'s visual viewport's height, excluding any scrollbars.
- 1. If |size| is equal to |rootWidth| times |rootHeight|, return.
+ 1. If |size| is equal to |rootWidth| times |rootHeight|, return null.
+ 1. If |imageRequest| is not [=eligible to be largest contentful paint=], return null.
1. If |imageRequest| is not null, run the following steps to adjust for image position and upscaling:
1. Let |concreteDimensions| be |imageRequest|'s [=concrete object size=] within |element|.
1. Let |visibleDimensions| be |concreteDimensions|, adjusted for positioning by 'object-position' or 'background-position' and |element|'s [=content box=].
@@ -210,16 +267,43 @@ In order to potentially add a {{LargestContentfulPaint}} entry
1. Let |intersectingClientContentRect| be the intersection of |clientContentRect| with |intersectionRect|.
1. Set |size| to |intersectingClientContentRect|'s {{DOMRectReadOnly/width}} * |intersectingClientContentRect|'s {{DOMRectReadOnly/height}}
.
- Note: this ensure that we only intersect with the image itself and not with the element's decorations.
+ Note: this ensures that we only intersect with the image itself and not with the element's decorations.
1. Let |naturalArea| be |imageRequest|'s [=natural width=] * |imageRequest|'s [=natural height=]
.
- 1. If |naturalArea| is 0, then return.
+ 1. If |naturalArea| is 0, then return null.
1. Let |boundingClientArea| be |clientContentRect|'s {{DOMRectReadOnly/width}} * |clientContentRect|'s {{DOMRectReadOnly/height}}
.
1. Let |scaleFactor| be |boundingClientArea| / |naturalArea|
.
1. If |scaleFactor| is greater than 1, then divide |size| by |scaleFactor|.
+ 1. Return |size|.
+"largest-contentful-paint"
in {{PerformanceObserver/supportedEntryTypes}} for {{Window}} contexts.
+This allows developers to detect support for the API.
+
+In order to potentially add a {{LargestContentfulPaint}} entry, the user agent must run the following steps:
+