1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/base/tests/test_remote_passpointerevents.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,52 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 + <head> 1.7 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.8 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.9 + </head> 1.10 + <body> 1.11 + <script type="application/javascript;version=1.7"> 1.12 + "use strict"; 1.13 + 1.14 + SimpleTest.waitForExplicitFinish(); 1.15 + 1.16 + function checkPointerEvents() { 1.17 + let iframe = this; 1.18 + let fRect = iframe.getBoundingClientRect(); 1.19 + let e1 = document.elementFromPoint(fRect.left + 10, fRect.top + 10); 1.20 + let e2 = document.elementFromPoint(fRect.left + 110, fRect.top + 110); 1.21 + if (e1 === document.body && e2 === iframe) { 1.22 + is(e1, document.body, "check point in transparent region of the iframe"); 1.23 + is(e2, iframe, "check point in opaque region of the iframe"); 1.24 + SimpleTest.finish(); 1.25 + } 1.26 + else { 1.27 + SimpleTest.executeSoon(checkPointerEvents.bind(iframe)); 1.28 + } 1.29 + } 1.30 + 1.31 + function runTest() { 1.32 + let iframe = document.createElement("iframe"); 1.33 + SpecialPowers.wrap(iframe).setAttribute('mozbrowser', 'true'); 1.34 + SpecialPowers.wrap(iframe).setAttribute('mozpasspointerevents', 'true'); 1.35 + SpecialPowers.wrap(iframe).setAttribute('remote', 'true'); 1.36 + iframe.style = "border:none; width:400px; height:400px; pointer-events:none"; 1.37 + iframe.src = "data:text/html,<html style='pointer-events:none'><div style='margin:100px; width:100px; height:100px; background:yellow; pointer-events:auto'>"; 1.38 + 1.39 + document.body.appendChild(iframe); 1.40 + 1.41 + SimpleTest.executeSoon(checkPointerEvents.bind(iframe)); 1.42 + } 1.43 + addEventListener("load", function() { 1.44 + SpecialPowers.addPermission("browser", true, document); 1.45 + SpecialPowers.addPermission("embed-apps", true, document); 1.46 + SpecialPowers.pushPrefEnv({ 1.47 + "set": [ 1.48 + ["dom.ipc.browser_frames.oop_by_default", true], 1.49 + ["dom.mozBrowserFramesEnabled", true] 1.50 + ] 1.51 + }, runTest); 1.52 + }); 1.53 + </script> 1.54 + </body> 1.55 +</html>