зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1694415 - Show dialog titles on Windows/Linux for window-modal dialogs. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D106332
This commit is contained in:
Родитель
252ef583b9
Коммит
722fdbc00b
|
@ -24,6 +24,10 @@ add_task(async function test_check_window_modal_prompt_service() {
|
|||
"Some title",
|
||||
"Title should be correct."
|
||||
);
|
||||
ok(
|
||||
!dialogWin.document.getElementById("infoTitle").hidden,
|
||||
"Title should be shown."
|
||||
);
|
||||
is(
|
||||
dialogWin.document.getElementById("infoBody").textContent,
|
||||
"some message",
|
||||
|
|
|
@ -119,19 +119,31 @@ CommonDialog.prototype = {
|
|||
let infoTitle = this.ui.infoTitle;
|
||||
infoTitle.appendChild(infoTitle.ownerDocument.createTextNode(title));
|
||||
|
||||
// Hide it, unless we're displaying a content modal, or are on macOS (where there is no titlebar):
|
||||
// Specific check to prevent showing the title on the old content prompts for macOS.
|
||||
// This should be removed when the old content prompts are removed.
|
||||
let contentSubDialogPromptEnabled = Services.prefs.getBoolPref(
|
||||
"prompts.contentPromptSubDialog"
|
||||
);
|
||||
// For prompts opened with TabModalPrompt, hide it.
|
||||
let hideForTabPromptModal =
|
||||
let isOldContentPrompt =
|
||||
!contentSubDialogPromptEnabled &&
|
||||
this.args.modalType == Ci.nsIPrompt.MODAL_TYPE_CONTENT;
|
||||
// Specific check to prevent showing the title on the tab-level on Windows and
|
||||
// Linux.
|
||||
let isOpenedWithTabDialog =
|
||||
this.args.openedWithTabDialog &&
|
||||
this.args.modalType == Ci.nsIPrompt.MODAL_TYPE_TAB &&
|
||||
AppConstants.platform != "macosx";
|
||||
|
||||
// After making these preventative checks, we can determine to show it if we're on
|
||||
// macOS (where there is no titlebar) or if the prompt is a common dialog document
|
||||
// and has been embedded (has a chromeEventHandler).
|
||||
infoTitle.hidden =
|
||||
hideForTabPromptModal ||
|
||||
(this.args.modalType != Ci.nsIPrompt.MODAL_TYPE_CONTENT &&
|
||||
AppConstants.platform != "macosx");
|
||||
isOldContentPrompt ||
|
||||
isOpenedWithTabDialog ||
|
||||
!(
|
||||
AppConstants.platform == "macosx" ||
|
||||
commonDialogEl?.ownerGlobal.docShell.chromeEventHandler
|
||||
);
|
||||
|
||||
if (commonDialogEl) {
|
||||
commonDialogEl.ownerDocument.title = title;
|
||||
|
|
Загрузка…
Ссылка в новой задаче