Bug 850335 - Don't position Metro context menus past the edge of the screen [r=mbrubeck]
authorRodrigo Silveira <rsilveira@mozilla.com>
Tue, 12 Mar 2013 16:33:49 -0700
changeset 124619 6ea59ba4f9bee5cee22cb90decbf36f63313f2bc
parent 124618 8134a5a378159d7d9e26e485a0073cd2253f4d76
child 124620 a6e4fc1312bd47a8aa5e188304b5b4faa0e05f36
push id24427
push useremorley@mozilla.com
push dateWed, 13 Mar 2013 12:28:55 +0000
treeherdermozilla-central@072b936973fe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs850335
milestone22.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 850335 - Don't position Metro context menus past the edge of the screen [r=mbrubeck]
browser/metro/base/content/helperui/MenuUI.js
--- a/browser/metro/base/content/helperui/MenuUI.js
+++ b/browser/metro/base/content/helperui/MenuUI.js
@@ -449,18 +449,21 @@ MenuPopup.prototype = {
         dump('hCenter && vCenter\n');
         aX -= halfWidth;
         aY -= halfHeight;
       } else {
         dump('None, left hand: ' + leftHand + '!\n');
       }
     }
 
-    if (aX < 0)
+    if (aX < 0) {
       aX = 0;
+    } else if (aX + width + kPositionPadding > screenWidth){
+      aX = screenWidth - width - kPositionPadding;
+    }
 
     if (aY < 0 && aPositionOptions.moveBelowToFit) {
       // show context menu below when it doesn't fit.
       aY = aPositionOptions.yPos;
     } else if (aY < 0) {
       aY = 0;
     }