Bug 1584218 - form autofill and HTML:select don't respect ui.popup.disable_autohide preference r=emilio,MattN

Differential Revision: https://phabricator.services.mozilla.com/D47322

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexander Surkov 2019-09-26 22:07:07 +00:00
Родитель b9773391b9
Коммит b56e085e0c
6 изменённых файлов: 18 добавлений и 14 удалений

Просмотреть файл

@ -47,6 +47,7 @@
#include "mozilla/MouseEvents.h"
#include "mozilla/PresShell.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPrefs_ui.h"
#include "mozilla/StaticPrefs_xul.h"
#include "mozilla/widget/nsAutoRollup.h"
@ -128,10 +129,6 @@ void nsMenuChainItem::CheckForAnchorChange() {
}
}
bool nsXULPopupManager::sDevtoolsDisableAutoHide = false;
const char kPrefDevtoolsDisableAutoHide[] = "ui.popup.disable_autohide";
NS_IMPL_ISUPPORTS(nsXULPopupManager, nsIDOMEventListener, nsIObserver)
nsXULPopupManager::nsXULPopupManager()
@ -145,8 +142,6 @@ nsXULPopupManager::nsXULPopupManager()
if (obs) {
obs->AddObserver(this, "xpcom-shutdown", false);
}
Preferences::AddBoolVarCache(&sDevtoolsDisableAutoHide,
kPrefDevtoolsDisableAutoHide, false);
}
nsXULPopupManager::~nsXULPopupManager() {
@ -198,7 +193,7 @@ bool nsXULPopupManager::Rollup(uint32_t aCount, bool aFlush,
}
// We can disable the autohide behavior via a pref to ease debugging.
if (nsXULPopupManager::sDevtoolsDisableAutoHide) {
if (StaticPrefs::ui_popup_disable_autohide()) {
// Required on linux to allow events to work on other targets.
if (mWidget) {
mWidget->CaptureRollupEvents(nullptr, false);

Просмотреть файл

@ -819,9 +819,6 @@ class nsXULPopupManager final : public nsIDOMEventListener,
// the popup that is currently being opened, stored only during the
// popupshowing event
nsCOMPtr<nsIContent> mOpeningPopup;
// If true, all popups won't hide automatically on blur
static bool sDevtoolsDisableAutoHide;
};
#endif

Просмотреть файл

@ -7111,6 +7111,12 @@
#endif
mirror: always
# If true, all popups won't hide automatically on blur
- name: ui.popup.disable_autohide
type: RelaxedAtomicBool
value: false
mirror: always
# Negate scroll, true will make the mouse scroll wheel move the screen the
# same direction as with most desktops or laptops.
- name: ui.scrolling.negate_wheel_scroll

Просмотреть файл

@ -314,8 +314,6 @@ pref("ui.android.mouse_as_touch", 1);
// Duration of timeout of incremental search in menus (ms). 0 means infinite.
pref("ui.menu.incremental_search.timeout", 1000);
// If true, all popups won't hide automatically on blur
pref("ui.popup.disable_autohide", false);
pref("browser.display.force_inline_alttext", false); // true = force ALT text for missing images to be layed out inline
// 0 = no external leading,

Просмотреть файл

@ -85,6 +85,13 @@ this.SelectContentHelper.prototype = {
subtree: true,
attributes: true,
});
XPCOMUtils.defineLazyPreferenceGetter(
this,
"disablePopupAutohide",
"ui.popup.disable_autohide",
false
);
},
uninit() {
@ -305,7 +312,7 @@ this.SelectContentHelper.prototype = {
}
break;
case "blur": {
if (this.element !== event.target) {
if (this.element !== event.target || this.disablePopupAutohide) {
break;
}
this._closeAfterBlur = true;

Просмотреть файл

@ -19,6 +19,7 @@
#include "mozilla/dom/PageTransitionEvent.h"
#include "mozilla/Logging.h"
#include "mozilla/PresShell.h"
#include "mozilla/StaticPrefs_ui.h"
#include "nsIFormAutoComplete.h"
#include "nsIInputListAutoComplete.h"
#include "nsIAutoCompleteSimpleResult.h"
@ -862,7 +863,7 @@ nsFormFillController::HandleEvent(Event* aEvent) {
return NS_OK;
}
case eBlur:
if (mFocusedInput) {
if (mFocusedInput && !StaticPrefs::ui_popup_disable_autohide()) {
StopControllingInput();
}
return NS_OK;