old-content-object-fit-none.html (1584B)
1 <!DOCTYPE html> 2 <html class=reftest-wait> 3 <title>View transitions: display content in a pseudo with object-fit: none</title> 4 <link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/"> 5 <link rel="author" href="mailto:vmpstr@chromium.org"> 6 <link rel="match" href="content-object-fit-none-ref.html"> 7 <script src="/common/reftest-wait.js"></script> 8 <style> 9 #target { 10 width: 100px; 11 height: 100px; 12 contain: paint; 13 position: absolute; 14 top: 20px; 15 left: 20px; 16 view-transition-name: target; 17 background: lightblue; 18 } 19 #hidden { 20 background: pink; 21 width: 10px; 22 height: 10px; 23 view-transition-name: hidden; 24 } 25 26 html::view-transition-group(target) { 27 animation: unset; 28 transform: unset; 29 position: absolute; 30 top: 10px; 31 left: 10px; 32 width: 50px; 33 height: 50px; 34 } 35 36 html::view-transition-new(target) { 37 animation: unset; 38 opacity: 0; 39 } 40 html::view-transition-old(target) { 41 animation: unset; 42 opacity: 1; 43 object-fit: none; 44 object-position: 0% 0%; 45 } 46 47 html::view-transition-group(hidden) { 48 animation-duration: 500s; 49 visibility: hidden; 50 } 51 52 html::view-transition-group(root) { animation: unset; opacity: 0; } 53 html::view-transition { background: lightpink; } 54 </style> 55 56 <div id=target>This is text</div> 57 <div id=hidden></div> 58 59 <script> 60 failIfNot(document.startViewTransition, "Missing document.startViewTransition"); 61 62 async function runTest() { 63 document.startViewTransition(() => { 64 requestAnimationFrame(() => requestAnimationFrame(takeScreenshot)); 65 }); 66 } 67 onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest)); 68 </script>