Bug 1750395 - Use mozshowdropdown events to show select dropdown. r=agi
After bug 1744009 Gecko will consistently fire these events. This allows activating stuff via keyboard on Android like in every other OS (if you have a keyboard attached of course) and is generally more consistent. We remove MOZ_USE_NATIVE_POPUP_WINDOWS since it's unused. Differential Revision: https://phabricator.services.mozilla.com/D136073
This commit is contained in:
@@ -27,6 +27,10 @@ class PromptFactory {
|
||||
|
||||
handleEvent(aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case "mozshowdropdown":
|
||||
case "mozshowdropdown-sourcetouch":
|
||||
this._handleSelect(aEvent);
|
||||
break;
|
||||
case "click":
|
||||
this._handleClick(aEvent);
|
||||
break;
|
||||
@@ -39,8 +43,14 @@ class PromptFactory {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(emilio): We should listen to MozOpenDateTimePicker instead, except
|
||||
// the Gecko widget isn't supported for stuff like <input type=week>
|
||||
_handleClick(aEvent) {
|
||||
const target = aEvent.composedTarget;
|
||||
if (ChromeUtils.getClassName(target) !== "HTMLInputElement") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
target.isContentEditable ||
|
||||
target.disabled ||
|
||||
@@ -52,22 +62,16 @@ class PromptFactory {
|
||||
return;
|
||||
}
|
||||
|
||||
const win = target.ownerGlobal;
|
||||
if (target instanceof win.HTMLSelectElement) {
|
||||
this._handleSelect(target);
|
||||
const type = target.type;
|
||||
if (
|
||||
type === "date" ||
|
||||
type === "month" ||
|
||||
type === "week" ||
|
||||
type === "time" ||
|
||||
type === "datetime-local"
|
||||
) {
|
||||
this._handleDateTime(target, type);
|
||||
aEvent.preventDefault();
|
||||
} else if (target instanceof win.HTMLInputElement) {
|
||||
const type = target.type;
|
||||
if (
|
||||
type === "date" ||
|
||||
type === "month" ||
|
||||
type === "week" ||
|
||||
type === "time" ||
|
||||
type === "datetime-local"
|
||||
) {
|
||||
this._handleDateTime(target, type);
|
||||
aEvent.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ const JSWINDOWACTORS = {
|
||||
events: {
|
||||
click: { capture: false, mozSystemGroup: true },
|
||||
contextmenu: { capture: false, mozSystemGroup: true },
|
||||
mozshowdropdown: {},
|
||||
"mozshowdropdown-sourcetouch": {},
|
||||
DOMPopupBlocked: { capture: false, mozSystemGroup: true },
|
||||
},
|
||||
},
|
||||
|
||||
@@ -2578,14 +2578,6 @@ set_config("ANDROID_PACKAGE_NAME", android_package_name)
|
||||
option(env="MOZ_WINCONSOLE", nargs="?", help="Whether we can create a console window.")
|
||||
set_define("MOZ_WINCONSOLE", True, when=depends("MOZ_WINCONSOLE")(lambda x: x))
|
||||
|
||||
option(
|
||||
env="MOZ_USE_NATIVE_POPUP_WINDOWS",
|
||||
default=target_is_android,
|
||||
help="Whether to use native popup windows",
|
||||
)
|
||||
|
||||
set_define("MOZ_USE_NATIVE_POPUP_WINDOWS", True, when="MOZ_USE_NATIVE_POPUP_WINDOWS")
|
||||
|
||||
|
||||
# Alternative Crashreporter setting
|
||||
option(
|
||||
|
||||
Reference in New Issue
Block a user