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