layout/base/tests/test_remote_passpointerevents.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial