Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Container Timing: observe with a node with containertiming and an SVG image child</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 kSvgNS = 'http://www.w3.org/2000/svg';
const div = addContainerRoot(document.body, 'div_ct');
const svg = document.createElementNS(kSvgNS, 'svg');
svg.setAttribute('width', '100');
svg.setAttribute('height', '100');
svg.style.display = 'block';
const image = document.createElementNS(kSvgNS, 'image');
image.id = 'svg_img_id';
image.setAttribute('href', '/container-timing/resources/square100.png');
image.setAttribute('width', '100');
image.setAttribute('height', '100');
svg.appendChild(image);
const beforeRender = performance.now();
div.appendChild(svg);
const entries = await getContainerEntries(t);
assert_equals(entries.length, 1);
const entry = entries[0];
checkContainerEntry(entry, 'div_ct', 'svg_img_id', beforeRender);
assert_true(entry.lastPaintedElement instanceof SVGImageElement,
'lastPaintedElement is the SVG image');
assert_equals(entry.rootElement, div);
checkContainerIntersectionRect(entry, [0, 100, 0, 100]);
checkContainerSize(entry, 10000);
}, 'Paint of an SVG image inside a container timing root is reported.');
</script>
</body>