Bug 1332280 - Disable flipping of the select dropdown if the dropdown has a search field. r?mconley
MozReview-Commit-ID: JWXoSf5CSXt
--- a/toolkit/modules/SelectParentHelper.jsm
+++ b/toolkit/modules/SelectParentHelper.jsm
@@ -41,30 +41,38 @@ this.SelectParentHelper = {
selectRect = rect;
this._registerListeners(browser, menulist.menupopup);
let win = browser.ownerGlobal;
// Set the maximum height to show exactly MAX_ROWS items.
let menupopup = menulist.menupopup;
let firstItem = menupopup.firstChild;
- while (firstItem && firstItem.hidden) {
+ while (firstItem && firstItem.hidden &&
+ firstItem.localName != "textbox") {
firstItem = firstItem.nextSibling;
}
if (firstItem) {
let itemHeight = firstItem.getBoundingClientRect().height;
// Include the padding and border on the popup.
let cs = win.getComputedStyle(menupopup);
let bpHeight = parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth) +
parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom);
menupopup.style.maxHeight = (itemHeight * MAX_ROWS + bpHeight) + "px";
}
+ if (menupopup.firstChild &&
+ menupopup.firstChild.localName == "textbox") {
+ menupopup.setAttribute("flip", "none");
+ } else {
+ menupopup.removeAttribute("flip");
+ }
+
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(AppConstants.platform == "macosx" ? "selection" : "after_start", rect.left, rect.top, rect.width, rect.height, false, false);