toolkit/content/tests/chrome/frame_subframe_origin_subframe1.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/content/tests/chrome/frame_subframe_origin_subframe1.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,43 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<!-- This Source Code Form is subject to the terms of the Mozilla Public
     1.6 +   - License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 +   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
     1.8 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.9 +
    1.10 +<page id="frame1"
    1.11 +      style="background-color:green;" 
    1.12 +      xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.13 +<script type="application/javascript"
    1.14 +        src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
    1.15 +
    1.16 +<spacer height="10px"/>
    1.17 +<iframe
    1.18 +  style="margin:10px; min-height:170px; max-width:200px; max-height:200px; border:solid 1px white;"
    1.19 +  src="frame_subframe_origin_subframe2.xul"></iframe>
    1.20 +<spacer height="3px"/>
    1.21 +<caption id="cap1" style="min-width:200px; max-width:200px; background-color:white;" label=""/>
    1.22 +<script class="testbody" type="application/javascript">
    1.23 +
    1.24 +// Fire a mouse move event aimed at this window, and check to be
    1.25 +// sure the client coords translate from widget to the dom correctly.
    1.26 +
    1.27 +function runTests()
    1.28 +{
    1.29 +  synthesizeMouse(document.getElementById("frame1"), 3, 4, { type: "mousemove" });
    1.30 +}
    1.31 +
    1.32 +function mouseMove(e) {
    1.33 +  e.stopPropagation();
    1.34 +  var element = e.target;
    1.35 +  var el = document.getElementById("cap1");
    1.36 +  el.label = "client: (" + e.clientX + "," + e.clientY + ")";
    1.37 +  parent.opener.wrappedJSObject.SimpleTest.is(e.clientX, 3, "mouse event clientX on sub frame 1");
    1.38 +  parent.opener.wrappedJSObject.SimpleTest.is(e.clientY, 4, "mouse event clientY on sub frame 1");
    1.39 +  // fire the next test on the sub frame
    1.40 +  frames[0].runTests();
    1.41 +}
    1.42 +
    1.43 +window.addEventListener("mousemove", mouseMove, false);
    1.44 +
    1.45 +</script>
    1.46 +</page>

mercurial