forked from mirrors/gecko-dev
Bug 1626741 - Roll-up other panels when the Address Bar results panel opens. r=NeilDeakin,jteow
Differential Revision: https://phabricator.services.mozilla.com/D210711
This commit is contained in:
parent
333a268841
commit
e47137db7e
6 changed files with 70 additions and 0 deletions
|
|
@ -67,6 +67,11 @@ const PREF_URLBAR_DEFAULTS = new Map([
|
||||||
// Feature gate pref for clipboard suggestions in the urlbar.
|
// Feature gate pref for clipboard suggestions in the urlbar.
|
||||||
["clipboard.featureGate", false],
|
["clipboard.featureGate", false],
|
||||||
|
|
||||||
|
// Whether to close other panels when the urlbar panel opens.
|
||||||
|
// This feature gate exists just as an emergency rollback in case of
|
||||||
|
// unexpected issues in Release. We normally want this behavior.
|
||||||
|
["closeOtherPanelsOnOpen", true],
|
||||||
|
|
||||||
// Whether to show a link for using the search functionality provided by the
|
// Whether to show a link for using the search functionality provided by the
|
||||||
// active view if the the view utilizes OpenSearch.
|
// active view if the the view utilizes OpenSearch.
|
||||||
["contextualSearch.enabled", true],
|
["contextualSearch.enabled", true],
|
||||||
|
|
|
||||||
|
|
@ -1095,6 +1095,13 @@ export class UrlbarView {
|
||||||
this.window.addEventListener("blur", this);
|
this.window.addEventListener("blur", this);
|
||||||
|
|
||||||
this.controller.notify(this.controller.NOTIFICATIONS.VIEW_OPEN);
|
this.controller.notify(this.controller.NOTIFICATIONS.VIEW_OPEN);
|
||||||
|
|
||||||
|
if (lazy.UrlbarPrefs.get("closeOtherPanelsOnOpen")) {
|
||||||
|
this.window.docShell.treeOwner
|
||||||
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
.getInterface(Ci.nsIAppWindow)
|
||||||
|
.rollupAllPopups();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#shouldShowHeuristic(result) {
|
#shouldShowHeuristic(result) {
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,8 @@ support-files = [
|
||||||
|
|
||||||
["browser_closePanelOnClick.js"]
|
["browser_closePanelOnClick.js"]
|
||||||
|
|
||||||
|
["browser_close_other_panels.js"]
|
||||||
|
|
||||||
["browser_content_opener.js"]
|
["browser_content_opener.js"]
|
||||||
|
|
||||||
["browser_contextualsearch.js"]
|
["browser_contextualsearch.js"]
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
* https://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This tests that other panels close when the urlbar panel opens.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const { CustomizableUITestUtils } = ChromeUtils.importESModule(
|
||||||
|
"resource://testing-common/CustomizableUITestUtils.sys.mjs"
|
||||||
|
);
|
||||||
|
let gCUITestUtils = new CustomizableUITestUtils(window);
|
||||||
|
|
||||||
|
add_task(async function () {
|
||||||
|
for (let openFn of [
|
||||||
|
() => {
|
||||||
|
EventUtils.synthesizeMouseAtCenter(gURLBar.inputField, {});
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
EventUtils.synthesizeKey("l", { accelKey: true });
|
||||||
|
},
|
||||||
|
]) {
|
||||||
|
await gCUITestUtils.openMainMenu();
|
||||||
|
Assert.equal(
|
||||||
|
PanelUI.panel.state,
|
||||||
|
"open",
|
||||||
|
"Check that panel state is 'open'"
|
||||||
|
);
|
||||||
|
let promiseHidden = new Promise(resolve => {
|
||||||
|
PanelUI.panel.addEventListener("popuphidden", resolve, { once: true });
|
||||||
|
});
|
||||||
|
await UrlbarTestUtils.promisePopupOpen(window, openFn);
|
||||||
|
await promiseHidden;
|
||||||
|
Assert.equal(
|
||||||
|
PanelUI.panel.state,
|
||||||
|
"closed",
|
||||||
|
"Check that panel state is 'closed'"
|
||||||
|
);
|
||||||
|
await UrlbarTestUtils.promisePopupClose(window);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
@ -533,6 +533,13 @@ NS_IMETHODIMP AppWindow::ShowModal() {
|
||||||
return mModalStatus;
|
return mModalStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP AppWindow::RollupAllPopups() {
|
||||||
|
if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) {
|
||||||
|
pm->Rollup({});
|
||||||
|
}
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
// AppWindow::nsIBaseWindow
|
// AppWindow::nsIBaseWindow
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
|
||||||
|
|
@ -152,4 +152,11 @@ interface nsIAppWindow : nsISupports
|
||||||
* Since readback of Windows DirectComposition is very slow.
|
* Since readback of Windows DirectComposition is very slow.
|
||||||
*/
|
*/
|
||||||
void needFastSnaphot();
|
void needFastSnaphot();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ask the PopupManager to rollup all popups.
|
||||||
|
* Can be used by popup-like elements to close other popups when shown.
|
||||||
|
* Note that tooltips and noautohide popups won't be closed.
|
||||||
|
*/
|
||||||
|
void rollupAllPopups();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue