containertiming-with-ignore-and-child-img.html (1761B)
1 <!DOCTYPE HTML> 2 <meta charset=utf-8> 3 <title>Container Timing: observe with a node with containertiming and containertiming-ignore, and an image child</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); 21 const entry = entryList.getEntries()[0]; 22 checkContainerEntry(entry, 'div_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 // and containertiming-ignore, that should be ignored as 31 // containertiming takes precedence. 32 const div = document.createElement('div'); 33 div.setAttribute('containertiming', 'div_ct'); 34 div.setAttribute('containertiming-ignore', ''); 35 document.body.appendChild(div); 36 // Add image of width equal to 100 and height equal to 100. 37 const img = document.createElement('img'); 38 img.src = '/container-timing/resources/square100.png'; 39 img.setAttribute('id', 'img_id'); 40 div.appendChild(img); 41 beforeRender = performance.now(); 42 }, 'Paint of the image child of container timing with ignore is not blocked.'); 43 </script> 44 45 </body>