nested-containertiming-child-img-with-ignore.html (2235B)
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 between the roots</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 div with containertiming-ignore blocking propagation to 35 // the parent containertiming root 36 const div2 = document.createElement('div'); 37 div2.setAttribute('containertiming-ignore', ''); 38 div1.appendChild(div2); 39 40 // Add another div, child of the first, that is also a container root 41 const div3 = document.createElement('div'); 42 div3.setAttribute('containertiming', 'div2_ct'); 43 div2.appendChild(div3); 44 45 // Add image of width equal to 100 and height equal to 100. 46 img = document.createElement('img'); 47 img.src = '/container-timing/resources/square100.png'; 48 img.setAttribute('id', 'img_id'); 49 div3.appendChild(img); 50 51 beforeRender = performance.now(); 52 }, 'A parent containertiming root with transparent nesting policy does not get paints from children containertiming roots if an intermediate ignore is set.'); 53 </script> 54 55 </body>