Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /container-timing/tentative/nested-containertiming-and-ignore-on-img.html - WPT Dashboard Interop Dashboard
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Container Timing: an image with both containertiming and containertimingignore inside an outer containertiming root</title>
<body>
<style>
body {
margin: 0;
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/container-timing/resources/container-timing-helpers.js"></script>
<script>
promise_test(async t => {
assert_implements(window.PerformanceContainerTiming, "PerformanceContainerTiming is not implemented");
const outer = addContainerRoot(document.body, 'outer_ct');
// Image that is itself a container timing root and has
// containertimingignore set. The ignore must prevent the image's paint
// from propagating to the outer containertiming root, but the image
// itself must still report under its own root.
addSquare100Image(outer, {
containertiming: 'image_ct',
containertimingignore: '',
id: 'my_id'
});
const beforeRender = performance.now();
const entries = await getContainerEntries(t);
// Only one entry: the inner image root. The outer containertiming
// root must NOT receive the paint because the image carries
// containertimingignore which blocks upward propagation.
assert_equals(entries.length, 1,
'one entry expected for the image root, none for the outer root');
const entry = entries[0];
checkContainerEntry(entry, 'image_ct', 'my_id', beforeRender);
checkContainerIntersectionRect(entry, [0, 100, 0, 100])
checkContainerSize(entry, 10000);
}, 'Image with containertiming + containertimingignore inside outer containertiming reports under itself only.');
</script>
</body>