toolkit/content/tests/chrome/window_subframe_origin.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/content/tests/chrome/window_subframe_origin.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,42 @@
     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 +<window id="window" title="Subframe Origin Tests"
    1.11 +        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.12 +<script type="application/javascript"
    1.13 +        src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
    1.14 +
    1.15 +<iframe
    1.16 +  style="margin-left:20px; margin-top:20px; min-height:300px; max-width:300px; max-height:300px; border:solid 1px black;"
    1.17 +  src="frame_subframe_origin_subframe1.xul"></iframe>
    1.18 +<caption id="parentcap" label=""/>
    1.19 +
    1.20 +<script>
    1.21 +
    1.22 +// Fire a mouse move event aimed at this window, and check to be
    1.23 +// sure the client coords translate from widget to the dom correctly.
    1.24 +
    1.25 +function runTests()
    1.26 +{
    1.27 +  synthesizeMouse(document.getElementById("window"), 1, 2, { type: "mousemove" });
    1.28 +}
    1.29 +
    1.30 +window.opener.wrappedJSObject.SimpleTest.waitForFocus(runTests, window);
    1.31 +
    1.32 +function mouseMove(e) {
    1.33 +  var element = e.target;
    1.34 +  var el = document.getElementById("parentcap");
    1.35 +  el.label = "client: (" + e.clientX + "," + e.clientY + ")";
    1.36 +  window.opener.wrappedJSObject.SimpleTest.is(e.clientX, 1, "mouse event clientX");
    1.37 +  window.opener.wrappedJSObject.SimpleTest.is(e.clientY, 2, "mouse event clientY");
    1.38 +  // fire the next test on the sub frame
    1.39 +  frames[0].runTests();
    1.40 +}
    1.41 +
    1.42 +window.addEventListener("mousemove",mouseMove, false);
    1.43 +
    1.44 +</script>
    1.45 +</window>

mercurial