OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <title>Override user-agent level style sheet defaults for an iframe</title> | |
3 <script src="../../resources/testharness.js"></script> | |
4 <script src="../../resources/testharnessreport.js"></script> | |
5 <script src="../trusted-event.js"></script> | |
6 <style> | |
7 iframe { | |
8 /* Override everything which is !important in the UA style sheet. */ | |
9 position: relative !important; | |
10 top: auto !important; | |
11 right: auto !important; | |
12 bottom: auto !important; | |
13 left: auto !important; | |
14 margin: 10px !important; | |
15 box-sizing: content-box !important; | |
16 min-width: 50% !important; | |
17 max-width: 50% !important; | |
18 min-height: 50% !important; | |
19 max-height: 50% !important; | |
20 width: 50% !important; | |
21 height: 50% !important; | |
22 object-fit: none !important; | |
23 flex: 1 1 auto !important; | |
24 transform: translate(0, 0) !important; | |
25 } | |
26 </style> | |
27 <div id="log"></div> | |
28 <div> | |
29 <iframe></iframe> | |
30 </div> | |
31 <script> | |
32 async_test(function() | |
33 { | |
34 var iframe = document.querySelector("iframe"); | |
35 // The HTML user-agent level style sheet defaults gives iframe a border. | |
36 // https://html.spec.whatwg.org/#embedded-content-rendering-rules | |
37 assert_equals(getComputedStyle(iframe).borderStyle, "inset"); | |
38 | |
39 document.addEventListener("fullscreenchange", this.step_func_done(function() | |
40 { | |
41 var style = getComputedStyle(iframe); | |
42 // All properties should match the UA style sheet. | |
43 assert_equals(style.position, "fixed"); | |
44 assert_equals(style.top, "0px"); | |
45 assert_equals(style.right, "0px"); | |
46 assert_equals(style.bottom, "0px"); | |
47 assert_equals(style.left, "0px"); | |
48 assert_equals(style.margin, "0px"); | |
49 assert_equals(style.boxSizing, "border-box"); | |
50 assert_equals(style.minWidth, "0px"); | |
51 assert_equals(style.maxWidth, "none"); | |
52 assert_equals(style.minHeight, "0px"); | |
53 assert_equals(style.maxHeight, "none"); | |
54 assert_equals(style.width, window.innerWidth + "px"); | |
55 assert_equals(style.height, window.innerHeight + "px"); | |
Julien - ping for review
2015/03/04 17:50:22
You forgot to remove these 2 per your comment on p
philipj_slow
2015/03/05 04:05:06
I meant that I added back with width and height ov
| |
56 assert_equals(style.objectFit, "contain"); | |
57 assert_equals(style.flex, "0 0 auto"); // none computes to 0 0 auto | |
58 assert_equals(style.transform, "none"); | |
59 // The Fullscreen user-agent level style sheet defaults remove the borde r. | |
60 assert_equals(style.borderStyle, "none"); | |
61 })); | |
62 | |
63 trusted_request(iframe); | |
64 }); | |
65 </script> | |
OLD | NEW |