DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (d1ed7de67f5a)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    screenX="200" screenY="200" width="300" height="300"
	onload="setTimeout(doTest, 0)">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script><![CDATA[
var is = window.opener.SimpleTest.is;

function doTest() {
  // from test_resizer.xul
  var expectX = 200;
  var expectY = 200;
  var expectXMost = 500;
  var expectYMost = 500;
  var screenScale = expectX/window.screenX;
  var root = document.documentElement;

  var oldScreenX = window.screenX;
  var oldScreenY = window.screenY;
  var oldWidth = window.outerWidth;
  var oldHeight = window.outerHeight;

  function testResizer(dx, dy) {
    var offset = 20;
    var scale = 5;
    // target the centre of the resizer
    var offsetX = window.innerWidth/2 + (window.innerWidth/3)*dx;
    var offsetY = window.innerHeight/2 + (window.innerHeight/3)*dy;

    for (var mouseX = -1; mouseX <= 1; ++mouseX) {
      for (var mouseY = -1; mouseY <= 1; ++mouseY) {
        var newExpectX = expectX;
        var newExpectXMost = expectXMost;
        var newExpectY = expectY;
        var newExpectYMost = expectYMost;
        if (dx < 0) {
          newExpectX += mouseX*scale;
        } else if (dx > 0) {
          newExpectXMost += mouseX*scale;
        }
        if (dy < 0) {
          newExpectY += mouseY*scale;
        } else if (dy > 0) {
          newExpectYMost += mouseY*scale;
        }

        synthesizeMouse(root, offsetX, offsetY, { type:"mousedown" });
        synthesizeMouse(root, offsetX + mouseX*scale, offsetY + mouseY*scale, { type:"mousemove" });
        is(window.screenX*screenScale, newExpectX,
           "Bad x for " + dx + "," + dy + " moving " + mouseX + "," + mouseY);
        is(window.screenY*screenScale, newExpectY,
           "Bad y for " + dx + "," + dy + " moving " + mouseX + "," + mouseY);
        is(window.outerWidth, newExpectXMost - newExpectX,
           "Bad width for " + dx + "," + dy + " moving " + mouseX + "," + mouseY);
        is(window.outerHeight, newExpectYMost - newExpectY,
           "Bad height for " + dx + "," + dy + " moving " + mouseX + "," + mouseY);

        // move it back before we release! Adjust for any window movement
        synthesizeMouse(root, offsetX - (newExpectX - expectX),
                              offsetY - (newExpectY - expectY), { type:"mousemove" });
        synthesizeMouse(root, offsetX, offsetY, { type:"mouseup" });
      }
    }
  }

  testResizer(-1, -1);
  testResizer(-1, 0);
  testResizer(-1, 1);
  testResizer(0, -1);
  testResizer(0, 1);
  testResizer(1, -1);
  testResizer(1, 0);
  testResizer(1, 1);

  var resizers = document.getElementsByTagName("resizer");
  Array.forEach(resizers, function (element) {
    is(getComputedStyle(element, "").cursor,
       element.getAttribute("expectedcursor"),
       "cursor for " + element.dir);
  });

  // now check the cursors in rtl. The bottomend resizer
  // should be reversed
  document.getElementById("bottomend").setAttribute("rtl", "true");
  Array.forEach(resizers, function (element) {
    is(getComputedStyle(element, "").cursor,
       element.dir == "bottomend" ? "sw-resize" :
         element.getAttribute("expectedcursor"),
       "cursor for " + element.dir);
  });

  window.close();
  window.opener.lastResizerTest();
}
]]></script>
	<hbox id="container" flex="1">
		<vbox flex="1">
			<resizer dir="topleft" expectedcursor="nw-resize" flex="1"/>
			<resizer dir="left" expectedcursor="ew-resize" flex="1"/>
			<resizer dir="bottomleft" expectedcursor="sw-resize" flex="1"/>
		</vbox>
		<vbox flex="1">
			<resizer dir="top" expectedcursor="ns-resize" flex="1"/>
			<resizer id="bottomend" dir="bottomend" expectedcursor="se-resize" flex="1"/>
			<resizer dir="bottom" expectedcursor="ns-resize" flex="1"/>
		</vbox>
		<vbox flex="1">
			<resizer dir="topright" expectedcursor="ne-resize" flex="1"/>
			<resizer dir="right" expectedcursor="ew-resize" flex="1"/>
			<resizer dir="bottomright" expectedcursor="se-resize" flex="1"/>
		</vbox>
	</hbox>
</window>