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 runWithKeyDown(function(){three.webkitRequestFullScreen()}); |
36 } | 38 } |
37 }; | 39 }; |
38 var startTest = function() { document.getElementById('three').webkitRequestFullS
creen(); }; | |
39 </script> | 40 </script> |
40 <script src="full-screen-test.js"></script> | 41 <script src="full-screen-test.js"></script> |
41 <style> | 42 <style> |
42 #one { | 43 #one { |
43 border: 4px solid darkgreen; | 44 border: 4px solid darkgreen; |
44 background-color: green; | 45 background-color: green; |
45 width: 600px; | 46 width: 600px; |
46 height: 400px; | 47 height: 400px; |
47 padding: 4px; | 48 padding: 4px; |
48 } | 49 } |
49 | 50 |
50 #two { | 51 #two { |
51 border: 4px solid darkred; | 52 border: 4px solid darkred; |
52 background-color: red; | 53 background-color: red; |
53 padding: 4px; | 54 padding: 4px; |
54 height: 384px; | 55 height: 384px; |
55 } | 56 } |
56 | 57 |
57 #three { | 58 #three { |
58 border: 4px solid darkblue; | 59 border: 4px solid darkblue; |
59 background-color: blue; | 60 background-color: blue; |
60 padding: 4px; | 61 padding: 4px; |
61 height: 368px; | 62 height: 368px; |
62 } | 63 } |
63 </style> | 64 </style> |
64 </head> | 65 </head> |
65 <body onload="init()"> | 66 <body onload="init()"> |
66 | |
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. | |
68 | |
69 <div id="one"> | 67 <div id="one"> |
70 <div id="two"> | 68 <div id="two"> |
71 <div id="three"></div> | 69 <div id="three"></div> |
72 </div> | 70 </div> |
73 </div> | 71 </div> |
74 | 72 </body> |
75 </script> | |
OLD | NEW |