ua-style-iframe.html (2275B)
1 <!DOCTYPE html> 2 <title>User-agent levels style sheet defaults for iframe</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/resources/testdriver.js"></script> 6 <script src="/resources/testdriver-vendor.js"></script> 7 <script src="../trusted-click.js"></script> 8 <style> 9 iframe { 10 border: 1px solid blue; 11 padding: 1px; 12 /* transform is also tested because of https://crbug.com/662393 */ 13 transform: scale(0.5); 14 } 15 </style> 16 <div id="log"></div> 17 <div id="ancestor"><iframe></iframe></div> 18 <script> 19 function assert_dir_properties(style, propBase, value, state) { 20 for (let dir of ["Top", "Right", "Bottom", "Left"]) { 21 let prop = propBase.replace("{}", dir); 22 assert_equals(style[prop], value, `${state} ${prop} style`); 23 } 24 } 25 26 promise_test(async (t) => { 27 t.add_cleanup(() => { 28 if (document.fullscreenElement) { 29 return document.exitFullscreen(); 30 } 31 }); 32 const ancestor = document.getElementById("ancestor"); 33 const iframe = ancestor.firstChild; 34 35 const initialStyle = getComputedStyle(iframe); 36 assert_dir_properties(initialStyle, "border{}Width", "1px", "initial"); 37 assert_dir_properties(initialStyle, "border{}Style", "solid", "initial"); 38 assert_dir_properties( 39 initialStyle, 40 "border{}Color", 41 "rgb(0, 0, 255)", 42 "initial" 43 ); 44 assert_dir_properties(initialStyle, "padding{}", "1px", "initial"); 45 assert_equals( 46 initialStyle.transform, 47 "matrix(0.5, 0, 0, 0.5, 0, 0)", 48 "initial transform style" 49 ); 50 51 await trusted_request(iframe); 52 await fullScreenChange(); 53 54 const fullscreenStyle = getComputedStyle(iframe); 55 assert_dir_properties( 56 fullscreenStyle, 57 "border{}Width", 58 "0px", 59 "fullscreen" 60 ); 61 assert_dir_properties( 62 fullscreenStyle, 63 "border{}Style", 64 "none", 65 "fullscreen" 66 ); 67 assert_dir_properties( 68 fullscreenStyle, 69 "border{}Color", 70 "rgb(0, 0, 0)", 71 "fullscreen" 72 ); 73 assert_dir_properties(fullscreenStyle, "padding{}", "0px", "fullscreen"); 74 assert_equals( 75 fullscreenStyle.transform, 76 "none", 77 "fullscreen transform style" 78 ); 79 }); 80 </script>