Bug 874792 - Remove the 3px offset between menus / panels and the screen edge. r=Enn
authorMarkus Stange <mstange@themasta.com>
Wed, 08 Jan 2014 10:32:30 +0100
changeset 162575 8b5fa5fb3a22add954b62d344034ee9e20c4c762
parent 162574 cb0f15374f4f8f1af27f73c9c92b8e17cf025649
child 162576 cb9c10bf3dd15c324587b07bf0cfbbf91d92d109
push id25960
push userryanvm@gmail.com
push dateWed, 08 Jan 2014 20:34:35 +0000
treeherdermozilla-central@0449f682dd31 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEnn
bugs874792
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 874792 - Remove the 3px offset between menus / panels and the screen edge. r=Enn
layout/xul/nsMenuPopupFrame.cpp
toolkit/content/tests/chrome/window_largemenu.xul
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -1412,19 +1412,16 @@ nsMenuPopupFrame::GetConstraintRect(cons
         screen->GetRect(&screenRectPixels.x, &screenRectPixels.y,
                         &screenRectPixels.width, &screenRectPixels.height);
       else
         screen->GetAvailRect(&screenRectPixels.x, &screenRectPixels.y,
                              &screenRectPixels.width, &screenRectPixels.height);
     }
   }
 
-  // keep a 3 pixel margin to the right and bottom of the screen for the WinXP dropshadow
-  screenRectPixels.SizeTo(screenRectPixels.width - 3, screenRectPixels.height - 3);
-
   nsRect screenRect = screenRectPixels.ToAppUnits(presContext->AppUnitsPerDevPixel());
   if (mInContentShell) {
     // for content shells, clip to the client area rather than the screen area
     screenRect.IntersectRect(screenRect, aRootScreenRect);
   }
 
   return screenRect;
 }
--- a/toolkit/content/tests/chrome/window_largemenu.xul
+++ b/toolkit/content/tests/chrome/window_largemenu.xul
@@ -106,17 +106,17 @@ function popupShown()
     ok(Math.round(rect.top) + gScreenY >= screen.top, gTests[gTestIndex] + " top");
     is(Math.round(rect.bottom) + gScreenY, screen.height - 100,
                                 gTests[gTestIndex] + " bottom");
     ok(!gOverflowed && !gUnderflowed, gTests[gTestIndex] + " overflow")
   }
   else if (gTestIndex == 2) {
     // the popup is too large so ensure that it is on screen
     ok(Math.round(rect.top) + gScreenY >= screen.top, gTests[gTestIndex] + " top");
-    ok(Math.round(rect.bottom) + gScreenY < screen.height, gTests[gTestIndex] + " bottom");
+    ok(Math.round(rect.bottom) + gScreenY <= screen.height, gTests[gTestIndex] + " bottom");
     ok(gOverflowed && !gUnderflowed, gTests[gTestIndex] + " overflow")
 
     sbo.scrollTo(0, 40);
     expectedScrollPos = 40;
   }
   else if (gTestIndex == 3) {
     expectedScrollPos = 40;
   }
@@ -209,20 +209,18 @@ function contextMenuPopupShown()
       break;
     case "context menu more space above":
       is(rect.top, labelrect.top - rect.height + 2, gTests[gTestIndex] + " top");
       break;
     case "context menu too big either side":
       [, gScreenY] = getScreenXY(document.documentElement);
       // compare against the available size as well as the total size, as some
       // platforms allow the menu to overlap os chrome and others do not
-      // the - 3 here is to account for 3 pixels that are subtracted from the
-      // screen size when sizing a popup for the popup shadow
-      var pos = (screen.availTop + screen.availHeight - 3 - rect.height) - gScreenY;
-      var availPos = (screen.top + screen.height - 3 - rect.height) - gScreenY;
+      var pos = (screen.availTop + screen.availHeight - rect.height) - gScreenY;
+      var availPos = (screen.top + screen.height - rect.height) - gScreenY;
       ok(rect.top == pos || rect.top == availPos,
          gTests[gTestIndex] + " top");
       break;
     case "context menu larger than screen":
       ok(rect.top == -(gScreenY - screen.availTop) || rect.top == -(gScreenY - screen.top), gTests[gTestIndex] + " top");
       break;
   }
 
@@ -283,31 +281,31 @@ function testPopupMovement()
   is(screenY, expectedy, gTests[gTestIndex] + " (1, 1) y");
 
   popup.moveTo(100, 8000);
   if (isPanelTest) {
     expectedy = 8000;
   }
   else {
     expectedy = (overlapOSChrome ? screen.height + screen.top : screen.availHeight + screen.availTop) -
-                Math.round(rect.height) - 3;
+                Math.round(rect.height);
   }
 
   [screenX, screenY] = getScreenXY(popup);
   is(screenX, 100, gTests[gTestIndex] + " (100, 8000) x");
   is(screenY, expectedy, gTests[gTestIndex] + " (100, 8000) y");
 
   popup.moveTo(6000, 100);
 
   if (isPanelTest) {
     expectedx = 6000;
   }
   else {
     expectedx = (overlapOSChrome ? screen.width + screen.left : screen.availWidth + screen.availLeft) -
-                Math.round(rect.width) - 3;
+                Math.round(rect.width);
   }
 
   [screenX, screenY] = getScreenXY(popup);
   is(screenX, expectedx, gTests[gTestIndex] + " (6000, 100) x");
   is(screenY, 100, gTests[gTestIndex] + " (6000, 100) y");
 
   is(popup.left, "", gTests[gTestIndex] + " left is empty after moving");
   is(popup.top, "", gTests[gTestIndex] + " top is empty after moving");