1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/pointerlock/file_targetOutOfFocus.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,70 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 + <!-- 1.7 + https://bugzilla.mozilla.org/show_bug.cgi?id=633602 1.8 + --> 1.9 + <head> 1.10 + <title>Bug 633602 - file_targetOutOfFocus.html</title> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"> 1.12 + </script> 1.13 + <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"> 1.14 + </script> 1.15 + <script type="application/javascript" src="pointerlock_utils.js"></script> 1.16 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.17 + </head> 1.18 + <body> 1.19 + <a target="_blank" 1.20 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602"> 1.21 + Mozilla Bug 633602 1.22 + </a> 1.23 + <p id="display"></p> 1.24 + <div id="content"> 1.25 + </div> 1.26 + <div id="div"></div> 1.27 + <input id="input" type="text" /> 1.28 + <pre id="test"> 1.29 + <script type="application/javascript"> 1.30 + /* 1.31 + * Test for Bug 633602 1.32 + * Element doesn't need to have focus to request 1.33 + * pointer lock 1.34 + */ 1.35 + 1.36 + SimpleTest.waitForExplicitFinish(); 1.37 + 1.38 + var div = document.getElementById("div") 1.39 + , input = document.getElementById("input") 1.40 + , divPointerLock = false; 1.41 + 1.42 + function runTests () { 1.43 + ok(divPointerLock, "Pointer should be locked even if " + 1.44 + "the element being locked is not focused"); 1.45 + } 1.46 + 1.47 + input.addEventListener("focus", function() { 1.48 + div.mozRequestPointerLock(); 1.49 + }, false); 1.50 + 1.51 + document.addEventListener("mozpointerlockchange", function (e) { 1.52 + if (document.mozPointerLockElement === div) { 1.53 + divPointerLock = true; 1.54 + document.mozCancelFullScreen(); 1.55 + } 1.56 + }, false); 1.57 + 1.58 + document.addEventListener("mozfullscreenchange", function() { 1.59 + if (document.mozFullScreenElement === div) { 1.60 + input.focus(); 1.61 + } else { 1.62 + runTests(); 1.63 + SimpleTest.finish(); 1.64 + } 1.65 + }, false); 1.66 + 1.67 + function start() { 1.68 + div.mozRequestFullScreen(); 1.69 + } 1.70 + </script> 1.71 + </pre> 1.72 + </body> 1.73 +</html>