fcp-background-size.html (1009B)
1 <!DOCTYPE html> 2 <head> 3 <title>Performance Paint Timing Test: FCP due to background size</title> 4 <style> 5 #main { 6 position: relative; 7 width: 100px; 8 height: 100px; 9 background-image: url(../resources/circles.png); 10 background-size: 0 0; 11 } 12 13 /* contentful class is defined in test_fcp script. */ 14 #main.contentful { 15 background-size: 100% 100%; 16 } 17 </style> 18 </head> 19 <body> 20 <script src="/resources/testharness.js"></script> 21 <script src="/resources/testharnessreport.js"></script> 22 <script src="../resources/utils.js"></script> 23 <div id="main"></div> 24 <script> 25 // Load the image into memory first to make sure it's decoded. 26 function load_image() { 27 const img = document.createElement("img"); 28 img.src = "../resources/circles.png"; 29 30 return new Promise(resolve => { 31 img.onload = async () => resolve(); 32 }); 33 } 34 35 test_fcp("First contentful paint fires due to background size.", load_image); 36 </script> 37 </body> 38 </html>