layout/base/tests/test_remote_passpointerevents.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 5 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 6 </head>
michael@0 7 <body>
michael@0 8 <script type="application/javascript;version=1.7">
michael@0 9 "use strict";
michael@0 10
michael@0 11 SimpleTest.waitForExplicitFinish();
michael@0 12
michael@0 13 function checkPointerEvents() {
michael@0 14 let iframe = this;
michael@0 15 let fRect = iframe.getBoundingClientRect();
michael@0 16 let e1 = document.elementFromPoint(fRect.left + 10, fRect.top + 10);
michael@0 17 let e2 = document.elementFromPoint(fRect.left + 110, fRect.top + 110);
michael@0 18 if (e1 === document.body && e2 === iframe) {
michael@0 19 is(e1, document.body, "check point in transparent region of the iframe");
michael@0 20 is(e2, iframe, "check point in opaque region of the iframe");
michael@0 21 SimpleTest.finish();
michael@0 22 }
michael@0 23 else {
michael@0 24 SimpleTest.executeSoon(checkPointerEvents.bind(iframe));
michael@0 25 }
michael@0 26 }
michael@0 27
michael@0 28 function runTest() {
michael@0 29 let iframe = document.createElement("iframe");
michael@0 30 SpecialPowers.wrap(iframe).setAttribute('mozbrowser', 'true');
michael@0 31 SpecialPowers.wrap(iframe).setAttribute('mozpasspointerevents', 'true');
michael@0 32 SpecialPowers.wrap(iframe).setAttribute('remote', 'true');
michael@0 33 iframe.style = "border:none; width:400px; height:400px; pointer-events:none";
michael@0 34 iframe.src = "data:text/html,<html style='pointer-events:none'><div style='margin:100px; width:100px; height:100px; background:yellow; pointer-events:auto'>";
michael@0 35
michael@0 36 document.body.appendChild(iframe);
michael@0 37
michael@0 38 SimpleTest.executeSoon(checkPointerEvents.bind(iframe));
michael@0 39 }
michael@0 40 addEventListener("load", function() {
michael@0 41 SpecialPowers.addPermission("browser", true, document);
michael@0 42 SpecialPowers.addPermission("embed-apps", true, document);
michael@0 43 SpecialPowers.pushPrefEnv({
michael@0 44 "set": [
michael@0 45 ["dom.ipc.browser_frames.oop_by_default", true],
michael@0 46 ["dom.mozBrowserFramesEnabled", true]
michael@0 47 ]
michael@0 48 }, runTest);
michael@0 49 });
michael@0 50 </script>
michael@0 51 </body>
michael@0 52 </html>

mercurial