Bug 430745 - Select dropdown popups will anchor on a selected element for Mac r=jaws, mconley draft
authorbeachjar <beachjar@msu.edu>
Wed, 02 Nov 2016 16:15:31 -0400
changeset 433456 2df7e4921834fa3d6b6b518e642ae43c15105030
parent 431855 37ab1d54a08e7e1431660b22377428b74dcd090a
child 434977 2ba179b66040509b1ebcfd2b7058593b14736b1a
push id34582
push userbmo:beachjar@msu.edu
push dateThu, 03 Nov 2016 18:30:01 +0000
reviewersjaws, mconley
bugs430745
milestone52.0a1
Bug 430745 - Select dropdown popups will anchor on a selected element for Mac r=jaws, mconley Select dropdown popups now anchor on the currently selected element in a <select> dropdown for Mac instead of above/below the <select> dropdown. MozReview-Commit-ID: JlgrZdArehq
toolkit/modules/SelectParentHelper.jsm
--- a/toolkit/modules/SelectParentHelper.jsm
+++ b/toolkit/modules/SelectParentHelper.jsm
@@ -3,16 +3,20 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 this.EXPORTED_SYMBOLS = [
   "SelectParentHelper"
 ];
 
+const {classes: Cc, utils: Cu, interfaces: Ci} = Components;
+const { devtools } = Cu.import("resource://devtools/shared/Loader.jsm", {});
+const { AppConstants } = devtools.require("resource://gre/modules/AppConstants.jsm");
+
 // Maximum number of rows to display in the select dropdown.
 const MAX_ROWS = 20;
 
 var currentBrowser = null;
 var currentMenulist = null;
 var currentZoom = 1;
 var closedWithEnter = false;
 
@@ -52,17 +56,17 @@ this.SelectParentHelper = {
 
     menupopup.classList.toggle("isOpenedViaTouch", isOpenedViaTouch);
 
     let constraintRect = browser.getBoundingClientRect();
     constraintRect = new win.DOMRect(constraintRect.left + win.mozInnerScreenX,
                                      constraintRect.top + win.mozInnerScreenY,
                                      constraintRect.width, constraintRect.height);
     menupopup.setConstraintRect(constraintRect);
-    menupopup.openPopupAtScreenRect("after_start", rect.left, rect.top, rect.width, rect.height, false, false);
+    menupopup.openPopupAtScreenRect((AppConstants.platform == "macosx") ? "selection" : "after_start", rect.left, rect.top, rect.width, rect.height, false, false);
   },
 
   hide: function(menulist, browser) {
     if (currentBrowser == browser) {
       menulist.menupopup.hidePopup();
     }
   },