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