Repository navigation
layout: Add effective_visual_size to PaintTimingHandler - #43378
Conversation
|
I think this just missing a test and perhaps a link to the specification if one is available. |
I need some more time on this, need little more research on this. |
b6b323e to
6de8bb6
Compare
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
6de8bb6 to
1a2f2f6
Compare
effective_visual_size to PaintTimingHandler
a4dda18 to
a73828b
Compare
effective_visual_size to PaintTimingHandlereffective_visual_size to PaintTimingHandler
03bb7de to
ab0c320
Compare
| @@ -1,3 +1,4 @@ | |||
| [image-full-viewport.html] | |||
| expected: TIMEOUT | |||
There was a problem hiding this comment.
Test checks for Text as LCP. Missing Implementation
ab0c320 to
48bc8d3
Compare
|
🔨 Triggering try run (#30881638487) for Linux (WPT) |
|
Test results for linux-wpt from try job (#30881638487): Flaky unexpected result (37)
Stable unexpected results that are known to be intermittent (15)
|
|
✨ Try run (#30881638487) succeeded. |
| if result.is_none() { | ||
| return; | ||
| } |
There was a problem hiding this comment.
| if result.is_none() { | |
| return; | |
| } | |
| let Some(result) = result else { | |
| return; | |
| } |
| // If size is less than or equal to document’s largest contentful paint size, return. | ||
| if size <= self.lcp_size { | ||
| // Step 4.6. If result’s size is less than or equal to largestSize, continue. | ||
| if result.is_some_and(|size| size <= self.lcp_size) { |
There was a problem hiding this comment.
| if result.is_some_and(|size| size <= self.lcp_size) { | |
| if result <= self.lcp_size { |
| } | ||
|
|
||
| // Step 4.7. Set largestSize to result’s size. | ||
| self.lcp_size = result.unwrap(); |
There was a problem hiding this comment.
| self.lcp_size = result.unwrap(); | |
| self.lcp_size = result; |
48bc8d3 to
1089c66
Compare
|
My previous patch created conflict. Rebased. Please help to merge. |
1089c66 to
f7beb96
Compare
Signed-off-by: Shubham Gupta <shubham.gupta@chromium.org>
Signed-off-by: Shubham Gupta <shubhamg13.work@gmail.com>
Signed-off-by: Shubham Gupta <shubhamg13.work@gmail.com>
f7beb96 to
3b5f18a
Compare
|
Results from last dry run: https://github.com/shubhamg13/servo/actions/runs/31090394766 |
) Align size calculations as much as possible close to W3C specs Testing: More WPT Passed Fixes: Part of servo#42000 --------- Signed-off-by: Shubham Gupta <shubham.gupta@chromium.org> Signed-off-by: Shubham Gupta <shubhamg13.work@gmail.com>
Hi, I'm a spec champion for the Container Timing feature and I wanted to add it to Servo (behind a flag). The Container Timing API enables monitoring when annotated sections of the DOM are displayed on screen and have finished their initial paint. I am one of the spec authors, and i've been helping this land in both [Chromium](https://developer.chrome.com/blog/container-timing-origin-trial) and [Firefox](https://phabricator.services.mozilla.com/D279373) This PR implements the [Container Timing API](https://github.com/WICG/container-timing), following the same layout > paint > constellation pipeline already used for LCP. Steps for calculating Container Timing: 1. When an element has the `containertiming` attribute, a [flag is propagated down through its descendants](https://github.com/jasonwilliams/servo/blob/403908fa99f47da3e18faaca88d2abdb01498cf7/components/script/dom/node/node.rs#L378-L387) (set on the Node/fragment) so layout can cheaply tell "is this inside a container-timing root" without walking back up the tree on every fragment. 2. While building the display list, each painted text/image fragment that belongs to a container-timing root [reports its viewport-clipped size and rect to a PaintTimingHandler](https://github.com/jasonwilliams/servo/blob/403908fa99f47da3e18faaca88d2abdb01498cf7/components/layout/display_list/mod.rs#L706-L718), similar to how LCP candidates are collected. 3. PaintTimingHandler keeps one running record per container root (keyed by a stable node ID, since the containertiming value itself is optional and not unique), accumulating size/rect across paints, and tracks which containers were actually touched since the last hand-off. 4. Layout [hands the finished per-container records to script](https://github.com/jasonwilliams/servo/blob/403908fa99f47da3e18faaca88d2abdb01498cf7/components/layout/layout_impl.rs#L1561-L1567) as part of the reflow result 5. once webrender confirms that epoch composited, [it sends PaintMetricEvent::ContainerTiming(paint_time, ids)](https://github.com/jasonwilliams/servo/blob/403908fa99f47da3e18faaca88d2abdb01498cf7/components/paint/painter.rs#L585-L589) to script, which stamps the already-stored records with the real paint/first-render time and queues the finished PerformanceContainerTiming entries. Testing: - There are plenty of [Web Platform Tests](https://wpt.fyi/results/container-timing/tentative?label=master&label=experimental&aligned&q=container%20timing) for Container Timing. I have been testing the build against these as i have been going along, 19/29 tests pass. - There are tests for some components, such as paintedRegion Follow ups & investigation: - `lastPaintedElement` selection picks by traversal order, not largest area - [Tidy Up] The `effective_visual_size` check was [originally written for LCP](servo#43378), but is useful for Container Timing as well, we should make this API generic --------- Signed-off-by: jasonwilliams <jase.williams@gmail.com>
Hi, I'm a spec champion for the Container Timing feature and I wanted to add it to Servo (behind a flag). The Container Timing API enables monitoring when annotated sections of the DOM are displayed on screen and have finished their initial paint. I am one of the spec authors, and i've been helping this land in both [Chromium](https://developer.chrome.com/blog/container-timing-origin-trial) and [Firefox](https://phabricator.services.mozilla.com/D279373) This PR implements the [Container Timing API](https://github.com/WICG/container-timing), following the same layout > paint > constellation pipeline already used for LCP. Steps for calculating Container Timing: 1. When an element has the `containertiming` attribute, a [flag is propagated down through its descendants](https://github.com/jasonwilliams/servo/blob/403908fa99f47da3e18faaca88d2abdb01498cf7/components/script/dom/node/node.rs#L378-L387) (set on the Node/fragment) so layout can cheaply tell "is this inside a container-timing root" without walking back up the tree on every fragment. 2. While building the display list, each painted text/image fragment that belongs to a container-timing root [reports its viewport-clipped size and rect to a PaintTimingHandler](https://github.com/jasonwilliams/servo/blob/403908fa99f47da3e18faaca88d2abdb01498cf7/components/layout/display_list/mod.rs#L706-L718), similar to how LCP candidates are collected. 3. PaintTimingHandler keeps one running record per container root (keyed by a stable node ID, since the containertiming value itself is optional and not unique), accumulating size/rect across paints, and tracks which containers were actually touched since the last hand-off. 4. Layout [hands the finished per-container records to script](https://github.com/jasonwilliams/servo/blob/403908fa99f47da3e18faaca88d2abdb01498cf7/components/layout/layout_impl.rs#L1561-L1567) as part of the reflow result 5. once webrender confirms that epoch composited, [it sends PaintMetricEvent::ContainerTiming(paint_time, ids)](https://github.com/jasonwilliams/servo/blob/403908fa99f47da3e18faaca88d2abdb01498cf7/components/paint/painter.rs#L585-L589) to script, which stamps the already-stored records with the real paint/first-render time and queues the finished PerformanceContainerTiming entries. Testing: - There are plenty of [Web Platform Tests](https://wpt.fyi/results/container-timing/tentative?label=master&label=experimental&aligned&q=container%20timing) for Container Timing. I have been testing the build against these as i have been going along, 19/29 tests pass. - There are tests for some components, such as paintedRegion Follow ups & investigation: - `lastPaintedElement` selection picks by traversal order, not largest area - [Tidy Up] The `effective_visual_size` check was [originally written for LCP](servo#43378), but is useful for Container Timing as well, we should make this API generic --------- Signed-off-by: jasonwilliams <jase.williams@gmail.com>
Align size calculations as much as possible close to W3C specs
Testing: More WPT Passed
Fixes: Part of #42000