diff --git a/browser/metro/base/content/contenthandlers/Content.js b/browser/metro/base/content/contenthandlers/Content.js index f2ddebed6f6f..a1924a4474e4 100644 --- a/browser/metro/base/content/contenthandlers/Content.js +++ b/browser/metro/base/content/contenthandlers/Content.js @@ -437,7 +437,7 @@ let Content = { // target element doesn't match the current focus element, clear // focus. This allows users to remove focus from form elements by // taping on white space content. - if (!this.formAssistant.open(element, aEvent.clientX, aEvent.clientY)) { + if (!this.formAssistant.open(element, aEvent)) { if (gFocusManager.focusedElement && gFocusManager.focusedElement != element) { gFocusManager.focusedElement.blur(); @@ -447,11 +447,6 @@ let Content = { sendAsyncMessage("FindAssist:Hide", { }); } - // Fire mouse events on everything but selects, see bug 685197 - if (element instanceof HTMLSelectElement) { - aEvent.preventDefault() - aEvent.stopPropagation() - } this._cancelTapHighlight(); this.formAssistant.focusSync = false; }, diff --git a/browser/metro/base/content/contenthandlers/FormHelper.js b/browser/metro/base/content/contenthandlers/FormHelper.js index 6ee0bacea6ad..b3a6fa017f9f 100644 --- a/browser/metro/base/content/contenthandlers/FormHelper.js +++ b/browser/metro/base/content/contenthandlers/FormHelper.js @@ -104,7 +104,7 @@ FormAssistant.prototype = { }, _open: false, - open: function formHelperOpen(aElement, aX, aY) { + open: function formHelperOpen(aElement, aEvent) { // If the click is on an option element we want to check if the parent // is a valid target. if (aElement instanceof HTMLOptionElement && @@ -113,6 +113,17 @@ FormAssistant.prototype = { aElement = aElement.parentNode; } + if (aElement instanceof HTMLSelectElement && aEvent) { + // Don't show the formhelper popup for multi-select boxes, except for touch. + if ((aElement.multiple || aElement.size > 1) && + aEvent.mozInputSource != Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH) { + return false; + } + // Don't fire mouse events on selects; see bug 685197. + aEvent.preventDefault() + aEvent.stopPropagation() + } + // The form assistant will close if a click happen: // * outside of the scope of the form helper // * hover a button of type=[image|submit] @@ -125,8 +136,8 @@ FormAssistant.prototype = { // Check for plugins element if (aElement instanceof Ci.nsIDOMHTMLEmbedElement) { - aX = aX || 0; - aY = aY || 0; + let x = (aEvent && aEvent.clientX) || 0; + let y = (aEvent && aEvent.clientY) || 0; this._executeDelayed(function(self) { let utils = Util.getWindowUtils(aElement.ownerDocument.defaultView); if (utils.IMEStatus == utils.IME_STATUS_PLUGIN) { @@ -143,7 +154,7 @@ FormAssistant.prototype = { validationMessage: null, list: null, rect: getBoundingContentRect(aElement), - caretRect: new Rect(aX, aY, 1, 10), + caretRect: new Rect(x, y, 1, 10), editable: true }, hasPrevious: false, diff --git a/browser/metro/base/content/cursor.css b/browser/metro/base/content/cursor.css index 4f976b2ca152..03a7795079bd 100644 --- a/browser/metro/base/content/cursor.css +++ b/browser/metro/base/content/cursor.css @@ -12,3 +12,8 @@ xul|*:-moz-system-metric(touch-enabled) { html|*:-moz-system-metric(touch-enabled) { cursor: none !important; } + +/* For touch input, *all* select boxes use the SelectHelper popup. */ +select option, select optgroup { + pointer-events: none; +} diff --git a/browser/metro/theme/content.css b/browser/metro/theme/content.css index 3de8529a0f2f..f48c6c6f3d46 100644 --- a/browser/metro/theme/content.css +++ b/browser/metro/theme/content.css @@ -123,8 +123,10 @@ select[size][multiple], /*background: white -moz-linear-gradient(top, rgba(115,115,115,0.5) 0, rgba(215,215,215,0.5) 3px, rgba(255,255,255,0.2) 16px);*/ } -/* Selects are handled by the form helper, see bug 685197 */ -select option, select optgroup { +/* For both mouse and touch, single-selects are handled by the SelectHelper popup. + * Suppress mouse events on the popup itself. See also ../base/content/cursor.css */ +select[size=1] :-moz-any(option, optgroup), +select:not([size]):not([multiple]) :-moz-any(option, optgroup) { pointer-events: none; }