Skip to content

Commit 340ed56

Browse files
jdapenachromium-wpt-export-bot
authored andcommitted
ContainerTiming: block upwards propagation for container roots with ignore attribute
If an element has containertiming (so it is set as a container timing root) and containertiming-ignore, it should report the paints in its tree, but not propagate to container timing root ancestors. This is practical as it allows to isolate parts of the tree, while still allowing to record its paints independently. I.e. for an overlay or a dialog. Explainer: https://github.com/bloomberg/container-timing/blob/main/README.md Chromestatus: https://chromestatus.com/feature/5110962817073152 I2P: https://groups.google.com/a/chromium.org/g/blink-dev/c/J-WxY0w7bNk/m/VkqnomK-CAAJ Ticket for what should happen: bloomberg/container-timing#26 Bug: 382422286 Change-Id: I6f5aa521cf4fd9e13f7d638fd5b4f8183f6fb823 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7150901 Reviewed-by: Michal Mocny <[email protected]> Commit-Queue: José Dapena Paz <[email protected]> Cr-Commit-Position: refs/heads/main@{#1546663}
1 parent 282e73d commit 340ed56

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!DOCTYPE HTML>
2+
<meta charset=utf-8>
3+
<title>Container Timing: two nested containertiming nodes, with a child img inside of the inner, and a containertiming-ignore in the descendant root</title>
4+
<body>
5+
<style>
6+
body {
7+
margin: 0;
8+
}
9+
</style>
10+
<script src="/resources/testharness.js"></script>
11+
<script src="/resources/testharnessreport.js"></script>
12+
<script src="/container-timing/resources/container-timing-helpers.js"></script>
13+
<script src="/element-timing/resources/element-timing-helpers.js"></script>
14+
<script>
15+
let beforeRender;
16+
async_test(function (t) {
17+
assert_implements(window.PerformanceContainerTiming, "PerformanceContainerTiming is not implemented");
18+
const observer = new PerformanceObserver(
19+
t.step_func_done(function(entryList) {
20+
assert_equals(entryList.getEntries().length, 1, 'one entry expected for the image, for the inner containertiming');
21+
const entry = entryList.getEntries()[0];
22+
checkContainerEntry(entry, 'div2_ct', 'img_id', beforeRender)
23+
checkRect(entry, [0, 100, 0, 100])
24+
checkContainerSize(entry, 10000);
25+
})
26+
);
27+
observer.observe({entryTypes: ['container']});
28+
29+
// Add a div that is the container timing root
30+
const div1 = document.createElement('div');
31+
div1.setAttribute('containertiming', 'div1_ct');
32+
document.body.appendChild(div1);
33+
34+
// Intermediate container timing root with containertiming-ignore blocking
35+
// propagation to the parent containertiming root but still receiving paints
36+
// from children
37+
const div2 = document.createElement('div');
38+
div2.setAttribute('containertiming', 'div2_ct');
39+
div2.setAttribute('containertiming-ignore', '');
40+
div1.appendChild(div2);
41+
42+
// Add image of width equal to 100 and height equal to 100.
43+
img = document.createElement('img');
44+
img.src = '/container-timing/resources/square100.png';
45+
img.setAttribute('id', 'img_id');
46+
div2.appendChild(img);
47+
48+
beforeRender = performance.now();
49+
}, 'A parent containertiming root with transparent nesting policy does not get paints from children containertiming roots with ignore.');
50+
</script>
51+
52+
</body>

0 commit comments

Comments
 (0)