OLD | NEW |
| (Empty) |
1 <script src="full-screen-test.js"></script> | |
2 <style> | |
3 #float { | |
4 margin: 10px 0 0 10px; | |
5 height: 50px; | |
6 width: 50px; | |
7 float: left; | |
8 background-color: red; | |
9 } | |
10 #clear { | |
11 clear:left; | |
12 } | |
13 #one { | |
14 background-color: lightblue; | |
15 float: left; | |
16 } | |
17 #two { | |
18 background-color: lightgreen; | |
19 } | |
20 </style> | |
21 <body> | |
22 <div>This layout test checks that the offset positions of the blue and green div
s does not change when the red div enters full-screen mode. Press <button oncli
ck="document.getElementById('float').webkitRequestFullScreen()">go full-screen</
a> to begin.</div> | |
23 <div id="float"></div> | |
24 <div id="one">One</div> | |
25 <div id="clear" /> | |
26 <span id="two">Two</span> | |
27 <script> | |
28 var one = document.getElementById('one'); | |
29 var two = document.getElementById('two'); | |
30 | |
31 // Bail out early if the full screen API is not enabled or is missing: | |
32 if (Element.prototype.webkitRequestFullScreen == undefined) { | |
33 logResult(false, "Element.prototype.webkitRequestFullScreen == undefined
"); | |
34 endTest(); | |
35 } else { | |
36 var oneState = {'offsetLeft': one.offsetLeft, 'offsetTop': one.offsetTop
}; | |
37 var twoState = {'offsetLeft': two.offsetLeft, 'offsetTop': two.offsetTop
}; | |
38 | |
39 | |
40 var callback; | |
41 var fullscreenChanged = function(event) | |
42 { | |
43 if (callback) | |
44 callback(event) | |
45 }; | |
46 waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged); | |
47 | |
48 var div = document.getElementById('float'); | |
49 | |
50 var divEnteredFullScreen = function() { | |
51 testExpected("document.webkitCurrentFullScreenElement", div); | |
52 testExpected("one.offsetLeft", oneState.offsetLeft); | |
53 testExpected("one.offsetTop", oneState.offsetTop); | |
54 testExpected("two.offsetLeft", twoState.offsetLeft); | |
55 testExpected("two.offsetTop", twoState.offsetTop); | |
56 callback = cancelledFullScreen; | |
57 runWithKeyDown(function(){document.webkitCancelFullScreen()}); | |
58 }; | |
59 | |
60 var cancelledFullScreen = function() { | |
61 testExpected("document.webkitCurrentFullScreenElement", null); | |
62 testExpected("one.offsetLeft", oneState.offsetLeft); | |
63 testExpected("one.offsetTop", oneState.offsetTop); | |
64 testExpected("two.offsetLeft", twoState.offsetLeft); | |
65 testExpected("two.offsetTop", twoState.offsetTop); | |
66 callback = null; | |
67 endTest(); | |
68 }; | |
69 | |
70 callback = divEnteredFullScreen; | |
71 runWithKeyDown(function(){div.webkitRequestFullScreen()}); | |
72 } | |
73 </script> | |
OLD | NEW |