OLD | NEW |
1 <body> | 1 <body> |
2 <script src="full-screen-test.js"></script> | 2 <script src="full-screen-test.js"></script> |
3 <style> | 3 <style> |
4 :-webkit-full-screen { background: lime; } | 4 :-webkit-full-screen { background: lime; } |
5 :-webkit-full-screen-document { color: blue; } | 5 :-webkit-full-screen-document { color: blue; } |
6 :root:-webkit-full-screen-document:not(:-webkit-full-screen) { background: r
ed; } | 6 :root:-webkit-full-screen-document:not(:-webkit-full-screen) { background: r
ed; } |
7 </style> | 7 </style> |
8 <span></span> | 8 <span></span> |
9 <script> | 9 <script> |
10 // Bail out early if the full screen API is not enabled or is missing: | 10 var callback; |
11 if (Element.prototype.webkitRequestFullScreen == undefined) { | 11 var fullscreenChanged = function(event) |
12 logResult(false, "Element.prototype.webkitRequestFullScreen == undefined
"); | 12 { |
| 13 if (callback) |
| 14 callback(event) |
| 15 }; |
| 16 waitForEvent(document, "webkitfullscreenchange", fullscreenChanged); |
| 17 |
| 18 var span = document.getElementsByTagName("span")[0]; |
| 19 |
| 20 testExpected("document.defaultView.getComputedStyle(span, null).getPropertyV
alue('background-color')", "rgba(0, 0, 0, 0)"); |
| 21 testExpected("document.defaultView.getComputedStyle(document.documentElement
, null).getPropertyValue('background-color')", "rgba(0, 0, 0, 0)"); |
| 22 testExpected("document.defaultView.getComputedStyle(document.documentElement
, null).getPropertyValue('color')", "rgb(0, 0, 0)"); |
| 23 |
| 24 var documentEnteredFullScreen = function(event) { |
| 25 testExpected("document.webkitCurrentFullScreenElement", document.documen
tElement); |
| 26 testExpected("document.defaultView.getComputedStyle(span, null).getPrope
rtyValue('background-color')", "rgba(0, 0, 0, 0)"); |
| 27 testExpected("document.defaultView.getComputedStyle(document.documentEle
ment, null).getPropertyValue('background-color')", "rgb(0, 255, 0)"); |
| 28 testExpected("document.defaultView.getComputedStyle(document.documentEle
ment, null).getPropertyValue('color')", "rgb(0, 0, 255)"); |
| 29 callback = spanEnteredFullScreen; |
| 30 runWithKeyDown(function(){span.webkitRequestFullScreen()}); |
| 31 }; |
| 32 |
| 33 var spanEnteredFullScreen = function(event) { |
| 34 testExpected("document.webkitCurrentFullScreenElement", span); |
| 35 testExpected("document.defaultView.getComputedStyle(span, null).getPrope
rtyValue('background-color')", "rgb(0, 255, 0)"); |
| 36 testExpected("document.defaultView.getComputedStyle(document.documentEle
ment, null).getPropertyValue('background-color')", "rgb(255, 0, 0)"); |
| 37 testExpected("document.defaultView.getComputedStyle(document.documentEle
ment, null).getPropertyValue('color')", "rgb(0, 0, 255)"); |
13 endTest(); | 38 endTest(); |
14 } else { | 39 }; |
15 var callback; | |
16 var fullscreenChanged = function(event) | |
17 { | |
18 if (callback) | |
19 callback(event) | |
20 }; | |
21 waitForEvent(document, "webkitfullscreenchange", fullscreenChanged); | |
22 | 40 |
23 var span = document.getElementsByTagName("span")[0]; | 41 callback = documentEnteredFullScreen; |
24 | 42 runWithKeyDown(function(){document.documentElement.webkitRequestFullScreen()
}); |
25 testExpected("document.defaultView.getComputedStyle(span, null).getPrope
rtyValue('background-color')", "rgba(0, 0, 0, 0)"); | |
26 testExpected("document.defaultView.getComputedStyle(document.documentEle
ment, null).getPropertyValue('background-color')", "rgba(0, 0, 0, 0)"); | |
27 testExpected("document.defaultView.getComputedStyle(document.documentEle
ment, null).getPropertyValue('color')", "rgb(0, 0, 0)"); | |
28 | |
29 var documentEnteredFullScreen = function(event) { | |
30 testExpected("document.webkitCurrentFullScreenElement", document.doc
umentElement); | |
31 testExpected("document.defaultView.getComputedStyle(span, null).getP
ropertyValue('background-color')", "rgba(0, 0, 0, 0)"); | |
32 testExpected("document.defaultView.getComputedStyle(document.documen
tElement, null).getPropertyValue('background-color')", "rgb(0, 255, 0)"); | |
33 testExpected("document.defaultView.getComputedStyle(document.documen
tElement, null).getPropertyValue('color')", "rgb(0, 0, 255)"); | |
34 callback = spanEnteredFullScreen; | |
35 runWithKeyDown(function(){span.webkitRequestFullScreen()}); | |
36 }; | |
37 | |
38 var spanEnteredFullScreen = function(event) { | |
39 testExpected("document.webkitCurrentFullScreenElement", span); | |
40 testExpected("document.defaultView.getComputedStyle(span, null).getP
ropertyValue('background-color')", "rgb(0, 255, 0)"); | |
41 testExpected("document.defaultView.getComputedStyle(document.documen
tElement, null).getPropertyValue('background-color')", "rgb(255, 0, 0)"); | |
42 testExpected("document.defaultView.getComputedStyle(document.documen
tElement, null).getPropertyValue('color')", "rgb(0, 0, 255)"); | |
43 endTest(); | |
44 }; | |
45 | |
46 callback = documentEnteredFullScreen; | |
47 runWithKeyDown(function(){document.documentElement.webkitRequestFullScre
en()}); | |
48 } | |
49 </script> | 43 </script> |
OLD | NEW |