summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fullscreen/full-screen-prefixed-and-unprefixed.html
blob: aac7d6ae7f102d5d47f5c47d7ba6249f5c105c6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<title>Mixed prefixed and unprefixed requests</title>
<script src="full-screen-test.js"></script>
<div><span></span></div>
<script>
var callback;
function fullscreenChanged(event)
{
    if (callback)
        callback(event)
}
waitForEvent(document, "fullscreenchange", fullscreenChanged);
waitForEvent(document, "webkitfullscreenchange", fullscreenChanged);

var div = document.querySelector("div");
var span = document.querySelector("span");

function divEnteredFullscreen()
{
    testExpected("document.fullscreenElement", div);
    testExpected("document.webkitFullscreenElement", div);
    callback = spanEnteredFullscreen;
    runWithKeyDown(function() { span.requestFullscreen(); });
}

function spanEnteredFullscreen()
{
    testExpected("document.fullscreenElement", span);
    testExpected("document.webkitFullscreenElement", span);
    callback = spanExitedFullscreen;
    document.webkitExitFullscreen();
}

function spanExitedFullscreen()
{
    testExpected("document.fullscreenElement", div);
    testExpected("document.webkitFullscreenElement", div);
    callback = divExitedFullscreen;
    document.webkitExitFullscreen();
}

function divExitedFullscreen()
{
    testExpected("document.fullscreenElement", null);
    testExpected("document.webkitFullscreenElement", null);
    endTest();
}

callback = divEnteredFullscreen;
runWithKeyDown(function() { div.webkitRequestFullscreen(); });
</script>