Bug 956162 - Tests - Implement @flip="none" for popups to allow them to appear off-screen without flipping or resizing. r=Enn
☠☠ backed out by 62adaec0470b ☠ ☠
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Wed, 22 Jan 2014 20:09:03 +0000
changeset 164643 026dc3ee065478bc854d5b04559be3b7d786ab84
parent 164642 0a7e5eeafed63bd065fa1154e83663e8601534d8
child 164644 42f136d90d85999c49065300a2acabd7f4b185bc
push id4506
push usermozilla@noorenberghe.ca
push dateWed, 22 Jan 2014 20:15:37 +0000
treeherderfx-team@42f136d90d85 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEnn
bugs956162
milestone29.0a1
Bug 956162 - Tests - Implement @flip="none" for popups to allow them to appear off-screen without flipping or resizing. r=Enn
toolkit/content/tests/chrome/window_panel.xul
--- a/toolkit/content/tests/chrome/window_panel.xul
+++ b/toolkit/content/tests/chrome/window_panel.xul
@@ -249,17 +249,60 @@ var tests = [
         synthesizeMouse(backdragspot, 5, 5, { type: "mousedown" });
         synthesizeMouse(backdragspot, 15, 20, { type: "mousemove" });
         synthesizeMouse(backdragspot, 15, 20, { type: "mouseup" });
 
         is(panel.getOuterScreenRect().left, 210, testname + "left");
         is(panel.getOuterScreenRect().top, 245, testname + "top");
       }
     }
-  }
+  },
+  {
+    // The panel should be allowed to appear and remain offscreen
+    testname: "normal panel with flip='none' off-screen",
+    attrs: { "flip": "none" },
+    test: function(panel) {
+      panel.openPopup(document.documentElement, "", -100 - mozInnerScreenX, -100 - mozInnerScreenY, false, false, null);
+    },
+    result: function(testname, panel) {
+      var panelrect = panel.getBoundingClientRect();
+      is(panelrect.left, -100 - mozInnerScreenX, testname + "left");
+      is(panelrect.top, -100 - mozInnerScreenY, testname + "top");
+      is(panelrect.width, 120, testname + "width");
+      is(panelrect.height, 40, testname + "height");
+
+      var screenRect = panel.getOuterScreenRect();
+      is(screenRect.left, -100, testname + " screen left");
+      is(screenRect.top, -100, testname + " screen top");
+      is(screenRect.width, 120, testname + " screen width");
+      is(screenRect.height, 40, testname + " screen height");
+    }
+  },
+  {
+    // The panel should be allowed to remain offscreen after moving and it should follow the anchor
+    testname: "normal panel with flip='none' moved off-screen",
+    attrs: { "flip": "none" },
+    test: function(panel) {
+      panel.openPopup(document.documentElement, "", -100 - mozInnerScreenX, -100 - mozInnerScreenY, false, false, null);
+      window.moveBy(-50, -50);
+    },
+    result: function(testname, panel) {
+      var panelrect = panel.getBoundingClientRect();
+      is(panelrect.left, -150 - mozInnerScreenX, testname + "left");
+      is(panelrect.top, -150 - mozInnerScreenY, testname + "top");
+      is(panelrect.width, 120, testname + "width");
+      is(panelrect.height, 40, testname + "height");
+
+      var screenRect = panel.getOuterScreenRect();
+      is(screenRect.left, -150, testname + " screen left");
+      is(screenRect.top, -150, testname + " screen top");
+      is(screenRect.width, 120, testname + " screen width");
+      is(screenRect.height, 40, testname + " screen height");
+    }
+  },
 ];
 
 window.opener.wrappedJSObject.SimpleTest.waitForFocus(test_panels, window);
 
 ]]>
 </script>
 
 </window>