Bug 950936 - Introduce ui.popup.disable_autohide pref to ease debugging popups. r=neil

This commit is contained in:
Alexandre Poirot 2016-01-18 03:10:42 -08:00
parent deb051dc45
commit 12dd69825b
3 changed files with 22 additions and 0 deletions

View File

@ -109,6 +109,11 @@ void nsMenuChainItem::Detach(nsMenuChainItem** aRoot)
}
}
bool nsXULPopupManager::sDevtoolsDisableAutoHide = false;
const char* kPrefDevtoolsDisableAutoHide =
"ui.popup.disable_autohide";
NS_IMPL_ISUPPORTS(nsXULPopupManager,
nsIDOMEventListener,
nsITimerCallback,
@ -127,6 +132,8 @@ nsXULPopupManager::nsXULPopupManager() :
if (obs) {
obs->AddObserver(this, "xpcom-shutdown", false);
}
Preferences::AddBoolVarCache(&sDevtoolsDisableAutoHide,
kPrefDevtoolsDisableAutoHide, false);
}
nsXULPopupManager::~nsXULPopupManager()
@ -183,6 +190,15 @@ bool
nsXULPopupManager::Rollup(uint32_t aCount, bool aFlush,
const nsIntPoint* pos, nsIContent** aLastRolledUp)
{
// We can disable the autohide behavior via a pref to ease debugging.
if (nsXULPopupManager::sDevtoolsDisableAutoHide) {
// Required on linux to allow events to work on other targets.
if (mWidget) {
mWidget->CaptureRollupEvents(nullptr, false);
}
return false;
}
bool consume = false;
nsMenuChainItem* item = GetTopVisibleMenu();

View File

@ -778,6 +778,9 @@ protected:
// 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

View File

@ -217,6 +217,9 @@ pref("ui.use_native_colors", true);
pref("ui.click_hold_context_menus", false);
// 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.use_document_fonts", 1); // 0 = never, 1 = quick, 2 = always
// 0 = default: always, except in high contrast mode
// 1 = always