OLD | NEW |
1 <head> | 1 <head> |
2 <script> | 2 <script> |
3 var runPixelTests = true; | 3 var runPixelTests = true; |
4 var init = function() { | 4 var init = function() { |
5 // Bail out early if the full screen API is not enabled or is missing: | 5 // Bail out early if the full screen API is not enabled or is missing: |
6 if (Element.prototype.webkitRequestFullScreen == undefined) { | 6 if (Element.prototype.webkitRequestFullScreen == undefined) { |
7 logResult(false, "Element.prototype.webkitRequestFullScreen == undefined
"); | 7 logResult(false, "Element.prototype.webkitRequestFullScreen == undefined
"); |
8 endTest(); | 8 endTest(); |
9 } else { | 9 } else { |
10 var callback; | 10 var callback; |
11 var fullscreenChanged = function(event) | 11 var fullscreenChanged = function(event) |
12 { | 12 { |
13 if (callback) | 13 if (callback) |
14 callback(event) | 14 callback(event) |
15 }; | 15 }; |
16 waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged); | 16 document.onwebkitfullscreenchange = fullscreenChanged; |
17 | 17 |
18 var one = document.getElementById('one'); | 18 var one = document.getElementById('one'); |
19 var two = document.getElementById('two'); | 19 var two = document.getElementById('two'); |
20 var three = document.getElementById('three'); | 20 var three = document.getElementById('three'); |
21 | 21 |
22 var threeEnteredFullScreen = function(event) { | 22 var threeEnteredFullScreen = function(event) { |
23 callback = threeExitedFullScreen; | 23 if (document.webkitCurrentFullScreenElement == three) { |
24 testExpected("document.webkitCurrentFullScreenElement", three); | 24 callback = threeExitedFullScreen; |
25 one.removeChild(two); | 25 one.removeChild(two); |
| 26 } |
26 }; | 27 }; |
27 | 28 |
28 var threeExitedFullScreen = function(event) { | 29 var threeExitedFullScreen = function(event) { |
29 callback = null; | 30 if (document.webkitCurrentFullScreenElement == null) { |
30 testExpected("document.webkitCurrentFullScreenElement", null); | 31 callback = null; |
31 endTest(); | 32 endTest(); |
| 33 } |
32 }; | 34 }; |
33 | 35 |
34 callback = threeEnteredFullScreen; | 36 callback = threeEnteredFullScreen; |
35 runWithKeyDown(function(){three.webkitRequestFullScreen()}); | 37 |
| 38 function goFullScreen() { |
| 39 document.getElementById('three').webkitRequestFullScreen(); |
| 40 } |
| 41 runWithKeyDown(goFullScreen); |
36 } | 42 } |
37 }; | 43 }; |
38 var startTest = function() { document.getElementById('three').webkitRequestFullS
creen(); }; | |
39 </script> | 44 </script> |
40 <script src="full-screen-test.js"></script> | 45 <script src="full-screen-test.js"></script> |
41 <style> | 46 <style> |
42 #one { | 47 #one { |
43 border: 4px solid darkgreen; | 48 border: 4px solid darkgreen; |
44 background-color: green; | 49 background-color: green; |
45 width: 600px; | 50 width: 600px; |
46 height: 400px; | 51 height: 400px; |
47 padding: 4px; | 52 padding: 4px; |
48 } | 53 } |
49 | 54 |
50 #two { | 55 #two { |
51 border: 4px solid darkred; | 56 border: 4px solid darkred; |
52 background-color: red; | 57 background-color: red; |
53 padding: 4px; | 58 padding: 4px; |
54 height: 384px; | 59 height: 384px; |
55 } | 60 } |
56 | 61 |
57 #three { | 62 #three { |
58 border: 4px solid darkblue; | 63 border: 4px solid darkblue; |
59 background-color: blue; | 64 background-color: blue; |
60 padding: 4px; | 65 padding: 4px; |
61 height: 368px; | 66 height: 368px; |
62 } | 67 } |
63 </style> | 68 </style> |
64 </head> | 69 </head> |
65 <body onload="init()"> | 70 <body onload="init()"> |
66 | 71 |
67 This tests that, if the ancestor of the current full-screen element is removed,
full screen mode will exit, and the document will render normally. At the compl
etion of the test, a green box should be visible. Click <button onclick="startTe
st()">go full screen</button> to run the test. | 72 This tests that, if the ancestor of the current full-screen element is removed,
full screen mode will exit, and the document will render normally. At the compl
etion of the test, a green box should be visible. Click <button onclick="goFullS
creen()">go full screen</button> to run the test. |
68 | 73 |
69 <div id="one"> | 74 <div id="one"> |
70 <div id="two"> | 75 <div id="two"> |
71 <div id="three"></div> | 76 <div id="three"></div> |
72 </div> | 77 </div> |
73 </div> | 78 </div> |
74 | 79 </body> |
75 </script> | |
OLD | NEW |