forked from mirrors/gecko-dev
Bug 1702501 - Remove print.tab_modal.enabled pref and old frontend print preview code. r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D134699
This commit is contained in:
parent
c5150cf5bd
commit
2a9a0b264a
24 changed files with 41 additions and 1478 deletions
|
|
@ -88,11 +88,7 @@
|
||||||
class="subviewbutton"
|
class="subviewbutton"
|
||||||
data-l10n-id="appmenuitem-print"
|
data-l10n-id="appmenuitem-print"
|
||||||
key="printKb"
|
key="printKb"
|
||||||
#ifdef XP_MACOSX
|
|
||||||
command="cmd_print"
|
command="cmd_print"
|
||||||
#else
|
|
||||||
command="cmd_printPreview"
|
|
||||||
#endif
|
|
||||||
/>
|
/>
|
||||||
<toolbarbutton id="appMenu-save-file-button2"
|
<toolbarbutton id="appMenu-save-file-button2"
|
||||||
class="subviewbutton"
|
class="subviewbutton"
|
||||||
|
|
|
||||||
|
|
@ -472,11 +472,6 @@ var FullZoom = {
|
||||||
aBrowser,
|
aBrowser,
|
||||||
aCallback
|
aCallback
|
||||||
) {
|
) {
|
||||||
if (gInPrintPreviewMode) {
|
|
||||||
this._executeSoon(aCallback);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The browser is sometimes half-destroyed because this method is called
|
// The browser is sometimes half-destroyed because this method is called
|
||||||
// by content pref service callbacks, which themselves can be called at any
|
// by content pref service callbacks, which themselves can be called at any
|
||||||
// time, even after browsers are closed.
|
// time, even after browsers are closed.
|
||||||
|
|
@ -516,11 +511,7 @@ var FullZoom = {
|
||||||
* @param browser The zoom of this browser will be saved. Required.
|
* @param browser The zoom of this browser will be saved. Required.
|
||||||
*/
|
*/
|
||||||
_applyZoomToPref: function FullZoom__applyZoomToPref(browser) {
|
_applyZoomToPref: function FullZoom__applyZoomToPref(browser) {
|
||||||
if (
|
if (!this.siteSpecific || browser.isSyntheticDocument) {
|
||||||
!this.siteSpecific ||
|
|
||||||
gInPrintPreviewMode ||
|
|
||||||
browser.isSyntheticDocument
|
|
||||||
) {
|
|
||||||
// If site-specific zoom is disabled, we have called this function
|
// If site-specific zoom is disabled, we have called this function
|
||||||
// to adjust our tab's zoom level. It is now considered "custom"
|
// to adjust our tab's zoom level. It is now considered "custom"
|
||||||
// and we mark that here.
|
// and we mark that here.
|
||||||
|
|
|
||||||
|
|
@ -56,10 +56,6 @@
|
||||||
#if !defined(MOZ_WIDGET_GTK)
|
#if !defined(MOZ_WIDGET_GTK)
|
||||||
<menuitem id="menu_printSetup"
|
<menuitem id="menu_printSetup"
|
||||||
command="cmd_pageSetup" data-l10n-id="menu-file-print-setup" hidden="true"/>
|
command="cmd_pageSetup" data-l10n-id="menu-file-print-setup" hidden="true"/>
|
||||||
#endif
|
|
||||||
#ifndef XP_MACOSX
|
|
||||||
<menuitem id="menu_printPreview"
|
|
||||||
command="cmd_printPreview" data-l10n-id="menu-file-print-preview" hidden="true"/>
|
|
||||||
#endif
|
#endif
|
||||||
<menuitem id="menu_print"
|
<menuitem id="menu_print"
|
||||||
key="printKb"
|
key="printKb"
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
<command id="cmd_pageSetup" oncommand="PrintUtils.showPageSetup();"/>
|
<command id="cmd_pageSetup" oncommand="PrintUtils.showPageSetup();"/>
|
||||||
<command id="cmd_print" oncommand="PrintUtils.startPrintWindow(gBrowser.selectedBrowser.browsingContext);"/>
|
<command id="cmd_print" oncommand="PrintUtils.startPrintWindow(gBrowser.selectedBrowser.browsingContext);"/>
|
||||||
<command id="cmd_printPreview" oncommand="PrintUtils.printPreview(PrintPreviewListener).catch(() => {});"/>
|
<command id="cmd_printPreviewToggle" oncommand="PrintUtils.togglePrintPreview(gBrowser.selectedBrowser.browsingContext);"/>
|
||||||
<command id="cmd_file_importFromAnotherBrowser" oncommand="MigrationUtils.showMigrationWizard(window, [MigrationUtils.MIGRATION_ENTRYPOINT_FILE_MENU]);"/>
|
<command id="cmd_file_importFromAnotherBrowser" oncommand="MigrationUtils.showMigrationWizard(window, [MigrationUtils.MIGRATION_ENTRYPOINT_FILE_MENU]);"/>
|
||||||
<command id="cmd_help_importFromAnotherBrowser" oncommand="MigrationUtils.showMigrationWizard(window, [MigrationUtils.MIGRATION_ENTRYPOINT_HELP_MENU]);"/>
|
<command id="cmd_help_importFromAnotherBrowser" oncommand="MigrationUtils.showMigrationWizard(window, [MigrationUtils.MIGRATION_ENTRYPOINT_HELP_MENU]);"/>
|
||||||
<command id="cmd_close" oncommand="BrowserCloseTabOrWindow(event);"/>
|
<command id="cmd_close" oncommand="BrowserCloseTabOrWindow(event);"/>
|
||||||
|
|
|
||||||
|
|
@ -559,7 +559,6 @@ customElements.setElementCreationCallback("screenshots-buttons", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
var gBrowser;
|
var gBrowser;
|
||||||
var gInPrintPreviewMode = false;
|
|
||||||
var gContextMenu = null; // nsContextMenu instance
|
var gContextMenu = null; // nsContextMenu instance
|
||||||
var gMultiProcessBrowser = window.docShell.QueryInterface(Ci.nsILoadContext)
|
var gMultiProcessBrowser = window.docShell.QueryInterface(Ci.nsILoadContext)
|
||||||
.useRemoteTabs;
|
.useRemoteTabs;
|
||||||
|
|
@ -3534,144 +3533,6 @@ function getPEMString(cert) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
var PrintPreviewListener = {
|
|
||||||
_printPreviewTab: null,
|
|
||||||
_simplifiedPrintPreviewTab: null,
|
|
||||||
_tabBeforePrintPreview: null,
|
|
||||||
_simplifyPageTab: null,
|
|
||||||
_lastRequestedPrintPreviewTab: null,
|
|
||||||
|
|
||||||
_createPPBrowser() {
|
|
||||||
let browser = this.getSourceBrowser();
|
|
||||||
let preferredRemoteType = browser.remoteType;
|
|
||||||
let initialBrowsingContextGroupId = browser.browsingContext.group.id;
|
|
||||||
let userContextId = browser.browsingContext.originAttributes.userContextId;
|
|
||||||
return gBrowser.loadOneTab("about:printpreview", {
|
|
||||||
inBackground: true,
|
|
||||||
preferredRemoteType,
|
|
||||||
initialBrowsingContextGroupId,
|
|
||||||
userContextId,
|
|
||||||
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getPrintPreviewBrowser() {
|
|
||||||
if (!this._printPreviewTab) {
|
|
||||||
this._printPreviewTab = this._createPPBrowser();
|
|
||||||
}
|
|
||||||
gBrowser._allowTabChange = true;
|
|
||||||
this._lastRequestedPrintPreviewTab = gBrowser.selectedTab = this._printPreviewTab;
|
|
||||||
gBrowser._allowTabChange = false;
|
|
||||||
return gBrowser.getBrowserForTab(this._printPreviewTab);
|
|
||||||
},
|
|
||||||
getSimplifiedPrintPreviewBrowser() {
|
|
||||||
if (!this._simplifiedPrintPreviewTab) {
|
|
||||||
this._simplifiedPrintPreviewTab = this._createPPBrowser();
|
|
||||||
}
|
|
||||||
gBrowser._allowTabChange = true;
|
|
||||||
this._lastRequestedPrintPreviewTab = gBrowser.selectedTab = this._simplifiedPrintPreviewTab;
|
|
||||||
gBrowser._allowTabChange = false;
|
|
||||||
return gBrowser.getBrowserForTab(this._simplifiedPrintPreviewTab);
|
|
||||||
},
|
|
||||||
createSimplifiedBrowser() {
|
|
||||||
let browser = this.getSourceBrowser();
|
|
||||||
let preferredRemoteType = browser.remoteType;
|
|
||||||
let initialBrowsingContextGroupId = browser.browsingContext.group.id;
|
|
||||||
this._simplifyPageTab = gBrowser.loadOneTab("about:printpreview", {
|
|
||||||
inBackground: true,
|
|
||||||
preferredRemoteType,
|
|
||||||
initialBrowsingContextGroupId,
|
|
||||||
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
|
|
||||||
});
|
|
||||||
return this.getSimplifiedSourceBrowser();
|
|
||||||
},
|
|
||||||
getSourceBrowser() {
|
|
||||||
if (!this._tabBeforePrintPreview) {
|
|
||||||
this._tabBeforePrintPreview = gBrowser.selectedTab;
|
|
||||||
}
|
|
||||||
return this._tabBeforePrintPreview.linkedBrowser;
|
|
||||||
},
|
|
||||||
getSimplifiedSourceBrowser() {
|
|
||||||
return this._simplifyPageTab
|
|
||||||
? gBrowser.getBrowserForTab(this._simplifyPageTab)
|
|
||||||
: null;
|
|
||||||
},
|
|
||||||
getNavToolbox() {
|
|
||||||
return gNavToolbox;
|
|
||||||
},
|
|
||||||
onEnter() {
|
|
||||||
// We might have accidentally switched tabs since the user invoked print
|
|
||||||
// preview
|
|
||||||
if (gBrowser.selectedTab != this._lastRequestedPrintPreviewTab) {
|
|
||||||
gBrowser.selectedTab = this._lastRequestedPrintPreviewTab;
|
|
||||||
}
|
|
||||||
gInPrintPreviewMode = true;
|
|
||||||
this._toggleAffectedChrome();
|
|
||||||
},
|
|
||||||
onExit() {
|
|
||||||
gBrowser._allowTabChange = true;
|
|
||||||
gBrowser.selectedTab = this._tabBeforePrintPreview;
|
|
||||||
gBrowser._allowTabChange = false;
|
|
||||||
this._tabBeforePrintPreview = null;
|
|
||||||
gInPrintPreviewMode = false;
|
|
||||||
this._toggleAffectedChrome();
|
|
||||||
let tabsToRemove = [
|
|
||||||
"_simplifyPageTab",
|
|
||||||
"_printPreviewTab",
|
|
||||||
"_simplifiedPrintPreviewTab",
|
|
||||||
];
|
|
||||||
for (let tabProp of tabsToRemove) {
|
|
||||||
if (this[tabProp]) {
|
|
||||||
gBrowser.removeTab(this[tabProp]);
|
|
||||||
this[tabProp] = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gBrowser.deactivatePrintPreviewBrowsers();
|
|
||||||
this._lastRequestedPrintPreviewTab = null;
|
|
||||||
},
|
|
||||||
_toggleAffectedChrome() {
|
|
||||||
gNavToolbox.collapsed = gInPrintPreviewMode;
|
|
||||||
|
|
||||||
if (gInPrintPreviewMode) {
|
|
||||||
this._hideChrome();
|
|
||||||
} else {
|
|
||||||
this._showChrome();
|
|
||||||
}
|
|
||||||
|
|
||||||
TabsInTitlebar.allowedBy("print-preview", !gInPrintPreviewMode);
|
|
||||||
},
|
|
||||||
_hideChrome() {
|
|
||||||
this._chromeState = {};
|
|
||||||
|
|
||||||
this._chromeState.sidebarOpen = SidebarUI.isOpen;
|
|
||||||
this._sidebarCommand = SidebarUI.currentID;
|
|
||||||
SidebarUI.hide();
|
|
||||||
|
|
||||||
this._chromeState.findOpen = gFindBarInitialized && !gFindBar.hidden;
|
|
||||||
if (gFindBarInitialized) {
|
|
||||||
gFindBar.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
gBrowser.getNotificationBox().stack.hidden = true;
|
|
||||||
gNotificationBox.stack.hidden = true;
|
|
||||||
},
|
|
||||||
_showChrome() {
|
|
||||||
gNotificationBox.stack.hidden = false;
|
|
||||||
gBrowser.getNotificationBox().stack.hidden = false;
|
|
||||||
|
|
||||||
if (this._chromeState.findOpen) {
|
|
||||||
gLazyFindCommand("open");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this._chromeState.sidebarOpen) {
|
|
||||||
SidebarUI.show(this._sidebarCommand);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
activateBrowser(browser) {
|
|
||||||
gBrowser.activateBrowserForPrintPreview(browser);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
var browserDragAndDrop = {
|
var browserDragAndDrop = {
|
||||||
canDropLink: aEvent => Services.droppedLinkHandler.canDropLink(aEvent, true),
|
canDropLink: aEvent => Services.droppedLinkHandler.canDropLink(aEvent, true),
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ async function testClosePrintPreviewWithEscKey() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openPrintPreview() {
|
async function openPrintPreview() {
|
||||||
document.getElementById("cmd_printPreview").doCommand();
|
document.getElementById("cmd_print").doCommand();
|
||||||
await BrowserTestUtils.waitForCondition(() => {
|
await BrowserTestUtils.waitForCondition(() => {
|
||||||
let preview = document.querySelector(".printPreviewBrowser");
|
let preview = document.querySelector(".printPreviewBrowser");
|
||||||
return preview && BrowserTestUtils.is_visible(preview);
|
return preview && BrowserTestUtils.is_visible(preview);
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ add_task(async function test() {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Enter print preview
|
// Enter print preview
|
||||||
document.getElementById("cmd_printPreview").doCommand();
|
document.getElementById("cmd_print").doCommand();
|
||||||
await BrowserTestUtils.waitForCondition(() => {
|
await BrowserTestUtils.waitForCondition(() => {
|
||||||
let preview = document.querySelector(".printPreviewBrowser");
|
let preview = document.querySelector(".printPreviewBrowser");
|
||||||
return preview && BrowserTestUtils.is_visible(preview);
|
return preview && BrowserTestUtils.is_visible(preview);
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,7 @@ const CustomizableWidgets = [
|
||||||
shortcutId: "printKb",
|
shortcutId: "printKb",
|
||||||
keepBroadcastAttributesWhenCustomizing: true,
|
keepBroadcastAttributesWhenCustomizing: true,
|
||||||
onCreated(aNode) {
|
onCreated(aNode) {
|
||||||
aNode.setAttribute("command", "cmd_print");
|
aNode.setAttribute("command", "cmd_printPreviewToggle");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1283,14 +1283,9 @@ this.tabs = class extends ExtensionAPI {
|
||||||
PrintUtils.startPrintWindow(activeTab.linkedBrowser.browsingContext);
|
PrintUtils.startPrintWindow(activeTab.linkedBrowser.browsingContext);
|
||||||
},
|
},
|
||||||
|
|
||||||
async printPreview() {
|
// Legacy API
|
||||||
let activeTab = getTabOrActive(null);
|
printPreview() {
|
||||||
let { PrintUtils, PrintPreviewListener } = activeTab.ownerGlobal;
|
return Promise.resolve(this.print());
|
||||||
try {
|
|
||||||
await PrintUtils.printPreview(PrintPreviewListener);
|
|
||||||
} catch (ex) {
|
|
||||||
return Promise.reject({ message: "Print preview failed" });
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
saveAsPDF(pageSettings) {
|
saveAsPDF(pageSettings) {
|
||||||
|
|
|
||||||
|
|
@ -94,9 +94,6 @@ menu-file-share-url =
|
||||||
menu-file-print-setup =
|
menu-file-print-setup =
|
||||||
.label = Page Setup…
|
.label = Page Setup…
|
||||||
.accesskey = u
|
.accesskey = u
|
||||||
menu-file-print-preview =
|
|
||||||
.label = Print Preview
|
|
||||||
.accesskey = v
|
|
||||||
menu-file-print =
|
menu-file-print =
|
||||||
.label = Print…
|
.label = Print…
|
||||||
.accesskey = P
|
.accesskey = P
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ add_task(async function() {
|
||||||
await addTab(`data:text/html,<div id="test-div">PRINT PREVIEW TEST</div>`);
|
await addTab(`data:text/html,<div id="test-div">PRINT PREVIEW TEST</div>`);
|
||||||
|
|
||||||
info("Start the print preview for the current tab");
|
info("Start the print preview for the current tab");
|
||||||
document.getElementById("cmd_printPreview").doCommand();
|
document.getElementById("cmd_print").doCommand();
|
||||||
|
|
||||||
const ToolboxTask = await initBrowserToolboxTask({
|
const ToolboxTask = await initBrowserToolboxTask({
|
||||||
enableBrowserToolboxFission: true,
|
enableBrowserToolboxFission: true,
|
||||||
|
|
|
||||||
|
|
@ -5201,7 +5201,8 @@ void nsGlobalWindowOuter::PrintOuter(ErrorResult& aError) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!StaticPrefs::print_tab_modal_enabled() && ShouldPromptToBlockDialogs() &&
|
bool print_tab_modal_enabled = true;
|
||||||
|
if (!print_tab_modal_enabled && ShouldPromptToBlockDialogs() &&
|
||||||
!ConfirmDialogIfNeeded()) {
|
!ConfirmDialogIfNeeded()) {
|
||||||
return aError.ThrowNotAllowedError("Prompt was canceled by the user");
|
return aError.ThrowNotAllowedError("Prompt was canceled by the user");
|
||||||
}
|
}
|
||||||
|
|
@ -5232,8 +5233,8 @@ void nsGlobalWindowOuter::PrintOuter(ErrorResult& aError) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const bool isPreview = StaticPrefs::print_tab_modal_enabled() &&
|
const bool isPreview =
|
||||||
!StaticPrefs::print_always_print_silent();
|
print_tab_modal_enabled && !StaticPrefs::print_always_print_silent();
|
||||||
Print(nullptr, nullptr, nullptr, IsPreview(isPreview),
|
Print(nullptr, nullptr, nullptr, IsPreview(isPreview),
|
||||||
IsForWindowDotPrint::Yes, nullptr, aError);
|
IsForWindowDotPrint::Yes, nullptr, aError);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -5292,9 +5293,9 @@ Nullable<WindowProxyHolder> nsGlobalWindowOuter::Print(
|
||||||
nsCOMPtr<nsIContentViewer> cv;
|
nsCOMPtr<nsIContentViewer> cv;
|
||||||
RefPtr<BrowsingContext> bc;
|
RefPtr<BrowsingContext> bc;
|
||||||
bool hasPrintCallbacks = false;
|
bool hasPrintCallbacks = false;
|
||||||
|
bool print_tab_modal_enabled = true;
|
||||||
if (docToPrint->IsStaticDocument() &&
|
if (docToPrint->IsStaticDocument() &&
|
||||||
(aIsPreview == IsPreview::Yes ||
|
(aIsPreview == IsPreview::Yes || print_tab_modal_enabled)) {
|
||||||
StaticPrefs::print_tab_modal_enabled())) {
|
|
||||||
if (aForWindowDotPrint == IsForWindowDotPrint::Yes) {
|
if (aForWindowDotPrint == IsForWindowDotPrint::Yes) {
|
||||||
aError.ThrowNotSupportedError(
|
aError.ThrowNotSupportedError(
|
||||||
"Calling print() from a print preview is unsupported, did you intend "
|
"Calling print() from a print preview is unsupported, did you intend "
|
||||||
|
|
|
||||||
|
|
@ -2983,7 +2983,8 @@ nsDocumentViewer::PrintPreview(nsIPrintSettings* aPrintSettings,
|
||||||
}
|
}
|
||||||
mPrintJob = printJob;
|
mPrintJob = printJob;
|
||||||
|
|
||||||
if (!hadPrintJob && !StaticPrefs::print_tab_modal_enabled()) {
|
bool print_tab_modal_enabled = true;
|
||||||
|
if (!hadPrintJob && !print_tab_modal_enabled) {
|
||||||
Telemetry::ScalarAdd(Telemetry::ScalarID::PRINTING_PREVIEW_OPENED, 1);
|
Telemetry::ScalarAdd(Telemetry::ScalarID::PRINTING_PREVIEW_OPENED, 1);
|
||||||
}
|
}
|
||||||
rv = printJob->PrintPreview(doc, aPrintSettings, aWebProgressListener,
|
rv = printJob->PrintPreview(doc, aPrintSettings, aWebProgressListener,
|
||||||
|
|
@ -3110,7 +3111,8 @@ nsDocumentViewer::PrintPreviewScrollToPage(int16_t aType, int32_t aPageNum) {
|
||||||
if (!GetIsPrintPreview() || mPrintJob->GetIsCreatingPrintPreview())
|
if (!GetIsPrintPreview() || mPrintJob->GetIsCreatingPrintPreview())
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
if (!StaticPrefs::print_tab_modal_enabled()) {
|
bool print_tab_modal_enabled = true;
|
||||||
|
if (!print_tab_modal_enabled) {
|
||||||
return PrintPreviewScrollToPageForOldUI(aType, aPageNum);
|
return PrintPreviewScrollToPageForOldUI(aType, aPageNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3315,7 +3317,8 @@ nsDocumentViewer::ExitPrintPreview() {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mPrintJob->HasEverPrinted() && !StaticPrefs::print_tab_modal_enabled()) {
|
bool print_tab_modal_enabled = true;
|
||||||
|
if (!mPrintJob->HasEverPrinted() && !print_tab_modal_enabled) {
|
||||||
Telemetry::ScalarAdd(Telemetry::ScalarID::PRINTING_PREVIEW_CANCELLED, 1);
|
Telemetry::ScalarAdd(Telemetry::ScalarID::PRINTING_PREVIEW_CANCELLED, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -640,8 +640,8 @@ nsresult nsPrintJob::DoCommonPrint(bool aIsPrintPreview,
|
||||||
// and get a remote print job, but the parent won't display a prompt.
|
// and get a remote print job, but the parent won't display a prompt.
|
||||||
// Note: The new print UI does not need to enter ShowPrintDialog below to
|
// Note: The new print UI does not need to enter ShowPrintDialog below to
|
||||||
// spin the event loop and fetch real printer settings from the parent.
|
// spin the event loop and fetch real printer settings from the parent.
|
||||||
if (!StaticPrefs::print_tab_modal_enabled() &&
|
bool print_tab_modal_enabled = true;
|
||||||
(!printSilently || printingViaParent)) {
|
if (!print_tab_modal_enabled && (!printSilently || printingViaParent)) {
|
||||||
nsCOMPtr<nsIPrintingPromptService> printPromptService(
|
nsCOMPtr<nsIPrintingPromptService> printPromptService(
|
||||||
do_GetService(kPrintingPromptService));
|
do_GetService(kPrintingPromptService));
|
||||||
if (printPromptService) {
|
if (printPromptService) {
|
||||||
|
|
@ -746,7 +746,8 @@ nsresult nsPrintJob::DoCommonPrint(bool aIsPrintPreview,
|
||||||
[self](nsresult aResult) { self->PageDone(aResult); });
|
[self](nsresult aResult) { self->PageDone(aResult); });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!StaticPrefs::print_tab_modal_enabled() && mIsCreatingPrintPreview) {
|
bool print_tab_modal_enabled = true;
|
||||||
|
if (!print_tab_modal_enabled && mIsCreatingPrintPreview) {
|
||||||
// In legacy print-preview mode, override any UI that wants to PrintPreview
|
// In legacy print-preview mode, override any UI that wants to PrintPreview
|
||||||
// any selection or page range. The legacy print-preview intends to view
|
// any selection or page range. The legacy print-preview intends to view
|
||||||
// every page in PrintPreview each time.
|
// every page in PrintPreview each time.
|
||||||
|
|
|
||||||
|
|
@ -10631,14 +10631,6 @@
|
||||||
value: false
|
value: false
|
||||||
mirror: always
|
mirror: always
|
||||||
|
|
||||||
# Whether tab_modal print UI is enabled.
|
|
||||||
#
|
|
||||||
# The tab modal print dialog is currently only for early beta or nightly.
|
|
||||||
- name: print.tab_modal.enabled
|
|
||||||
type: RelaxedAtomicBool
|
|
||||||
value: true
|
|
||||||
mirror: always
|
|
||||||
|
|
||||||
# Whether the pages per sheet print setting is enabled.
|
# Whether the pages per sheet print setting is enabled.
|
||||||
- name: print.pages_per_sheet.enabled
|
- name: print.pages_per_sheet.enabled
|
||||||
type: RelaxedAtomicBool
|
type: RelaxedAtomicBool
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,6 @@ ChromeUtils.defineModuleGetter(
|
||||||
"resource://gre/modules/DeferredTask.jsm"
|
"resource://gre/modules/DeferredTask.jsm"
|
||||||
);
|
);
|
||||||
|
|
||||||
let gPrintPreviewInitializingInfo = null;
|
|
||||||
|
|
||||||
let gPendingPreviewsMap = new Map();
|
let gPendingPreviewsMap = new Map();
|
||||||
|
|
||||||
class PrintingChild extends JSWindowActorChild {
|
class PrintingChild extends JSWindowActorChild {
|
||||||
|
|
@ -46,13 +44,6 @@ class PrintingChild extends JSWindowActorChild {
|
||||||
this.contentWindow?.removeEventListener("scroll", this);
|
this.contentWindow?.removeEventListener("scroll", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bug 1088061: nsPrintJob's DoCommonPrint currently expects the
|
|
||||||
// progress listener passed to it to QI to an nsIPrintingPromptService
|
|
||||||
// in order to know that a printing progress dialog has been shown. That's
|
|
||||||
// really all the interface is used for, hence the fact that I don't actually
|
|
||||||
// implement the interface here. Bug 1088061 has been filed to remove
|
|
||||||
// this hackery.
|
|
||||||
|
|
||||||
handleEvent(event) {
|
handleEvent(event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case "PrintingError": {
|
case "PrintingError": {
|
||||||
|
|
@ -66,36 +57,6 @@ class PrintingChild extends JSWindowActorChild {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "printPreviewUpdate": {
|
|
||||||
let info = gPrintPreviewInitializingInfo;
|
|
||||||
if (!info) {
|
|
||||||
// If there is no gPrintPreviewInitializingInfo then we did not
|
|
||||||
// initiate the preview so ignore this event.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only send Printing:Preview:Entered message on first update, indicated
|
|
||||||
// by gPrintPreviewInitializingInfo.entered not being set.
|
|
||||||
if (!info.entered) {
|
|
||||||
gPendingPreviewsMap.delete(this.browsingContext.id);
|
|
||||||
|
|
||||||
info.entered = true;
|
|
||||||
this.sendAsyncMessage("Printing:Preview:Entered", {
|
|
||||||
failed: false,
|
|
||||||
changingBrowsers: info.changingBrowsers,
|
|
||||||
});
|
|
||||||
|
|
||||||
// If we have another request waiting, dispatch it now.
|
|
||||||
if (info.nextRequest) {
|
|
||||||
Services.tm.dispatchToMainThread(info.nextRequest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Always send page count update.
|
|
||||||
this.updatePageCount();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "scroll":
|
case "scroll":
|
||||||
if (!this._scrollTask) {
|
if (!this._scrollTask) {
|
||||||
this._scrollTask = new DeferredTask(
|
this._scrollTask = new DeferredTask(
|
||||||
|
|
@ -112,21 +73,6 @@ class PrintingChild extends JSWindowActorChild {
|
||||||
receiveMessage(message) {
|
receiveMessage(message) {
|
||||||
let data = message.data;
|
let data = message.data;
|
||||||
switch (message.name) {
|
switch (message.name) {
|
||||||
case "Printing:Preview:Enter": {
|
|
||||||
this.enterPrintPreview(
|
|
||||||
BrowsingContext.get(data.browsingContextId),
|
|
||||||
data.simplifiedMode,
|
|
||||||
data.changingBrowsers,
|
|
||||||
data.lastUsedPrinterName
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "Printing:Preview:Exit": {
|
|
||||||
this.exitPrintPreview();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "Printing:Preview:Navigate": {
|
case "Printing:Preview:Navigate": {
|
||||||
this.navigate(data.navType, data.pageNum);
|
this.navigate(data.navType, data.pageNum);
|
||||||
break;
|
break;
|
||||||
|
|
@ -143,36 +89,6 @@ class PrintingChild extends JSWindowActorChild {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPrintSettings(lastUsedPrinterName) {
|
|
||||||
try {
|
|
||||||
let PSSVC = Cc["@mozilla.org/gfx/printsettings-service;1"].getService(
|
|
||||||
Ci.nsIPrintSettingsService
|
|
||||||
);
|
|
||||||
|
|
||||||
let printSettings = PSSVC.newPrintSettings;
|
|
||||||
if (!printSettings.printerName) {
|
|
||||||
printSettings.printerName = lastUsedPrinterName;
|
|
||||||
}
|
|
||||||
// First get any defaults from the printer
|
|
||||||
PSSVC.initPrintSettingsFromPrinter(
|
|
||||||
printSettings.printerName,
|
|
||||||
printSettings
|
|
||||||
);
|
|
||||||
// now augment them with any values from last time
|
|
||||||
PSSVC.initPrintSettingsFromPrefs(
|
|
||||||
printSettings,
|
|
||||||
true,
|
|
||||||
printSettings.kInitSaveAll
|
|
||||||
);
|
|
||||||
|
|
||||||
return printSettings;
|
|
||||||
} catch (e) {
|
|
||||||
Cu.reportError(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
async parseDocument(URL, contentWindow) {
|
async parseDocument(URL, contentWindow) {
|
||||||
// The document in 'contentWindow' will be simplified and the resulting nodes
|
// The document in 'contentWindow' will be simplified and the resulting nodes
|
||||||
// will be inserted into this.contentWindow.
|
// will be inserted into this.contentWindow.
|
||||||
|
|
@ -348,96 +264,6 @@ class PrintingChild extends JSWindowActorChild {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
enterPrintPreview(
|
|
||||||
browsingContext,
|
|
||||||
simplifiedMode,
|
|
||||||
changingBrowsers,
|
|
||||||
lastUsedPrinterName
|
|
||||||
) {
|
|
||||||
const { docShell } = this;
|
|
||||||
|
|
||||||
try {
|
|
||||||
let contentWindow = browsingContext.window;
|
|
||||||
let printSettings = this.getPrintSettings(lastUsedPrinterName);
|
|
||||||
|
|
||||||
// If we happen to be on simplified mode, we need to set docURL in order
|
|
||||||
// to generate header/footer content correctly, since simplified tab has
|
|
||||||
// "about:blank" as its URI.
|
|
||||||
if (printSettings && simplifiedMode) {
|
|
||||||
printSettings.docURL = contentWindow.document.baseURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get this early in case the actor goes away during print preview.
|
|
||||||
let browserContextId = this.browsingContext.id;
|
|
||||||
|
|
||||||
// The print preview docshell will be in a different TabGroup, so
|
|
||||||
// printPreviewInitialize must be run in a separate runnable to avoid
|
|
||||||
// touching a different TabGroup in our own runnable.
|
|
||||||
let printPreviewInitialize = () => {
|
|
||||||
// During dispatching this function to the main-thread, the docshell
|
|
||||||
// might be destroyed, for example the print preview window gets closed
|
|
||||||
// soon after it's opened, in such case we should just simply bail out.
|
|
||||||
if (docShell.isBeingDestroyed()) {
|
|
||||||
this.sendAsyncMessage("Printing:Preview:Entered", {
|
|
||||||
failed: true,
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
let listener = new PrintingListener(this);
|
|
||||||
gPendingPreviewsMap.set(browserContextId, listener);
|
|
||||||
|
|
||||||
gPrintPreviewInitializingInfo = { changingBrowsers };
|
|
||||||
|
|
||||||
contentWindow.printPreview(printSettings, listener, docShell);
|
|
||||||
} catch (error) {
|
|
||||||
// This might fail if we, for example, attempt to print a XUL document.
|
|
||||||
// In that case, we inform the parent to bail out of print preview.
|
|
||||||
Cu.reportError(error);
|
|
||||||
gPrintPreviewInitializingInfo = null;
|
|
||||||
this.sendAsyncMessage("Printing:Preview:Entered", {
|
|
||||||
failed: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// If gPrintPreviewInitializingInfo.entered is not set we are still in the
|
|
||||||
// initial setup of a previous preview request. We delay this one until
|
|
||||||
// that has finished because running them at the same time will almost
|
|
||||||
// certainly cause failures.
|
|
||||||
if (
|
|
||||||
gPrintPreviewInitializingInfo &&
|
|
||||||
!gPrintPreviewInitializingInfo.entered
|
|
||||||
) {
|
|
||||||
gPrintPreviewInitializingInfo.nextRequest = printPreviewInitialize;
|
|
||||||
} else {
|
|
||||||
Services.tm.dispatchToMainThread(printPreviewInitialize);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
// This might fail if we, for example, attempt to print a XUL document.
|
|
||||||
// In that case, we inform the parent to bail out of print preview.
|
|
||||||
Cu.reportError(error);
|
|
||||||
this.sendAsyncMessage("Printing:Preview:Entered", {
|
|
||||||
failed: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exitPrintPreview() {
|
|
||||||
gPrintPreviewInitializingInfo = null;
|
|
||||||
this.docShell.exitPrintPreview();
|
|
||||||
}
|
|
||||||
|
|
||||||
updatePageCount() {
|
|
||||||
let cv = this.docShell.contentViewer;
|
|
||||||
cv.QueryInterface(Ci.nsIWebBrowserPrint);
|
|
||||||
this.sendAsyncMessage("Printing:Preview:UpdatePageCount", {
|
|
||||||
numPages: cv.printPreviewNumPages,
|
|
||||||
totalPages: cv.rawNumPages,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
updateCurrentPage() {
|
updateCurrentPage() {
|
||||||
let cv = this.docShell.contentViewer;
|
let cv = this.docShell.contentViewer;
|
||||||
cv.QueryInterface(Ci.nsIWebBrowserPrint);
|
cv.QueryInterface(Ci.nsIWebBrowserPrint);
|
||||||
|
|
@ -452,42 +278,3 @@ class PrintingChild extends JSWindowActorChild {
|
||||||
cv.printPreviewScrollToPage(navType, pageNum);
|
cv.printPreviewScrollToPage(navType, pageNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintingChild.prototype.QueryInterface = ChromeUtils.generateQI([
|
|
||||||
"nsIPrintingPromptService",
|
|
||||||
]);
|
|
||||||
|
|
||||||
function PrintingListener(actor) {
|
|
||||||
this.actor = actor;
|
|
||||||
}
|
|
||||||
PrintingListener.prototype = {
|
|
||||||
QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener"]),
|
|
||||||
|
|
||||||
onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
|
|
||||||
this.actor.sendAsyncMessage("Printing:Preview:StateChange", {
|
|
||||||
stateFlags: aStateFlags,
|
|
||||||
status: aStatus,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
onProgressChange(
|
|
||||||
aWebProgress,
|
|
||||||
aRequest,
|
|
||||||
aCurSelfProgress,
|
|
||||||
aMaxSelfProgress,
|
|
||||||
aCurTotalProgress,
|
|
||||||
aMaxTotalProgress
|
|
||||||
) {
|
|
||||||
this.actor.sendAsyncMessage("Printing:Preview:ProgressChange", {
|
|
||||||
curSelfProgress: aCurSelfProgress,
|
|
||||||
maxSelfProgress: aMaxSelfProgress,
|
|
||||||
curTotalProgress: aCurTotalProgress,
|
|
||||||
maxTotalProgress: aMaxTotalProgress,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {},
|
|
||||||
onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {},
|
|
||||||
onSecurityChange(aWebProgress, aRequest, aState) {},
|
|
||||||
onContentBlockingEvent(aWebProgress, aRequest, aEvent) {},
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -6,88 +6,17 @@
|
||||||
|
|
||||||
var EXPORTED_SYMBOLS = ["PrintingParent"];
|
var EXPORTED_SYMBOLS = ["PrintingParent"];
|
||||||
|
|
||||||
let gTestListener = null;
|
|
||||||
|
|
||||||
class PrintingParent extends JSWindowActorParent {
|
class PrintingParent extends JSWindowActorParent {
|
||||||
static setTestListener(listener) {
|
|
||||||
gTestListener = listener;
|
|
||||||
}
|
|
||||||
|
|
||||||
getPrintPreviewToolbar(browser) {
|
|
||||||
return browser.ownerDocument.getElementById("print-preview-toolbar");
|
|
||||||
}
|
|
||||||
|
|
||||||
receiveMessage(message) {
|
receiveMessage(message) {
|
||||||
let browser = this.browsingContext.top.embedderElement;
|
let browser = this.browsingContext.top.embedderElement;
|
||||||
let PrintUtils = browser.ownerGlobal.PrintUtils;
|
|
||||||
|
|
||||||
if (message.name == "Printing:Error") {
|
if (message.name == "Printing:Error") {
|
||||||
PrintUtils._displayPrintingError(
|
browser.ownerGlobal.PrintUtils._displayPrintingError(
|
||||||
message.data.nsresult,
|
message.data.nsresult,
|
||||||
message.data.isPrinting
|
message.data.isPrinting
|
||||||
);
|
);
|
||||||
return undefined;
|
} else if (message.name == "Printing:Preview:CurrentPage") {
|
||||||
}
|
browser.setAttribute("current-page", message.data.currentPage);
|
||||||
|
|
||||||
if (this.ignoreListeners) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
let data = message.data;
|
|
||||||
|
|
||||||
switch (message.name) {
|
|
||||||
case "Printing:Preview:CurrentPage": {
|
|
||||||
browser.setAttribute("current-page", message.data.currentPage);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "Printing:Preview:Entered": {
|
|
||||||
// This message is sent by the content process once it has completed
|
|
||||||
// putting the content into print preview mode. We must wait for that to
|
|
||||||
// to complete before switching the chrome UI to print preview mode,
|
|
||||||
// otherwise we have layout issues.
|
|
||||||
|
|
||||||
if (gTestListener) {
|
|
||||||
gTestListener(browser);
|
|
||||||
}
|
|
||||||
|
|
||||||
PrintUtils.printPreviewEntered(browser, message.data);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "Printing:Preview:ReaderModeReady": {
|
|
||||||
PrintUtils.readerModeReady(browser);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "Printing:Preview:UpdatePageCount": {
|
|
||||||
let toolbar = this.getPrintPreviewToolbar(browser);
|
|
||||||
toolbar.updatePageCount(message.data.totalPages);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "Printing:Preview:ProgressChange": {
|
|
||||||
// nothing to do now we don't implement a print progress dialog
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "Printing:Preview:StateChange": {
|
|
||||||
if (data.stateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
|
|
||||||
// Strangely, the printing engine sends 2 STATE_STOP messages when
|
|
||||||
// print preview is finishing. One has the STATE_IS_DOCUMENT flag,
|
|
||||||
// the other has the STATE_IS_NETWORK flag. However, the webProgressPP
|
|
||||||
// listener stops listening once the first STATE_STOP is sent.
|
|
||||||
// Any subsequent messages result in NS_ERROR_FAILURE errors getting
|
|
||||||
// thrown. This should all get torn out once bug 1088061 is fixed.
|
|
||||||
|
|
||||||
// Enable toobar elements that we disabled during update.
|
|
||||||
let printPreviewTB = this.getPrintPreviewToolbar(browser);
|
|
||||||
printPreviewTB.disableUpdateTriggers(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// nothing else to do now we don't implement a print progress dialog
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|
|
||||||
|
|
@ -1,444 +0,0 @@
|
||||||
// This file is loaded into the browser window scope.
|
|
||||||
/* eslint-env mozilla/browser-window */
|
|
||||||
|
|
||||||
// -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*-
|
|
||||||
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
customElements.define(
|
|
||||||
"printpreview-toolbar",
|
|
||||||
class PrintPreviewToolbar extends MozXULElement {
|
|
||||||
static get markup() {
|
|
||||||
return `
|
|
||||||
<button id="print-preview-print" oncommand="this.parentNode.print();" data-l10n-id="printpreview-print"/>
|
|
||||||
<button id="print-preview-pageSetup" oncommand="this.parentNode.doPageSetup();" data-l10n-id="printpreview-page-setup"/>
|
|
||||||
<vbox align="center" pack="center">
|
|
||||||
<label control="print-preview-pageNumber" data-l10n-id="printpreview-page"/>
|
|
||||||
</vbox>
|
|
||||||
<toolbarbutton id="print-preview-navigateHome" class="print-preview-navigate-button tabbable" oncommand="parentNode.navigate(0, 0, 'home');" data-l10n-id="printpreview-homearrow"/>
|
|
||||||
<toolbarbutton id="print-preview-navigatePrevious" class="print-preview-navigate-button tabbable" oncommand="parentNode.navigate(-1, 0, 0);" data-l10n-id="printpreview-previousarrow"/>
|
|
||||||
<hbox align="center" pack="center">
|
|
||||||
<html:input id="print-preview-pageNumber" hidespinbuttons="true" type="number" value="1" min="1"/>
|
|
||||||
<label data-l10n-id="printpreview-of"/>
|
|
||||||
<label id="print-preview-totalPages" value="1"/>
|
|
||||||
</hbox>
|
|
||||||
<toolbarbutton id="print-preview-navigateNext" class="print-preview-navigate-button tabbable" oncommand="parentNode.navigate(1, 0, 0);" data-l10n-id="printpreview-nextarrow"/>
|
|
||||||
<toolbarbutton id="print-preview-navigateEnd" class="print-preview-navigate-button tabbable" oncommand="parentNode.navigate(0, 0, 'end');" data-l10n-id="printpreview-endarrow"/>
|
|
||||||
<toolbarseparator class="toolbarseparator-primary"/>
|
|
||||||
<vbox align="center" pack="center">
|
|
||||||
<label id="print-preview-scale-label" control="print-preview-scale" data-l10n-id="printpreview-scale"/>
|
|
||||||
</vbox>
|
|
||||||
<hbox align="center" pack="center">
|
|
||||||
<menulist id="print-preview-scale" crop="none" oncommand="parentNode.parentNode.scale(this.selectedItem.value);">
|
|
||||||
<menupopup>
|
|
||||||
<menuitem value="0.3" />
|
|
||||||
<menuitem value="0.4" />
|
|
||||||
<menuitem value="0.5" />
|
|
||||||
<menuitem value="0.6" />
|
|
||||||
<menuitem value="0.7" />
|
|
||||||
<menuitem value="0.8" />
|
|
||||||
<menuitem value="0.9" />
|
|
||||||
<menuitem value="1" />
|
|
||||||
<menuitem value="1.25" />
|
|
||||||
<menuitem value="1.5" />
|
|
||||||
<menuitem value="1.75" />
|
|
||||||
<menuitem value="2" />
|
|
||||||
<menuseparator/>
|
|
||||||
<menuitem flex="1" value="ShrinkToFit" data-l10n-id="printpreview-shrink-to-fit"/>
|
|
||||||
<menuitem value="Custom" data-l10n-id="printpreview-custom"/>
|
|
||||||
</menupopup>
|
|
||||||
</menulist>
|
|
||||||
</hbox>
|
|
||||||
<toolbarseparator class="toolbarseparator-primary"/>
|
|
||||||
<hbox align="center" pack="center">
|
|
||||||
<toolbarbutton id="print-preview-portrait-button" checked="true" type="radio" group="orient" class="tabbable" oncommand="parentNode.parentNode.orient('portrait');" data-l10n-id="printpreview-portrait"/>
|
|
||||||
<toolbarbutton id="print-preview-landscape-button" type="radio" group="orient" class="tabbable" oncommand="parentNode.parentNode.orient('landscape');" data-l10n-id="printpreview-landscape"/>
|
|
||||||
</hbox>
|
|
||||||
<toolbarseparator class="toolbarseparator-primary"/>
|
|
||||||
<checkbox id="print-preview-simplify" checked="false" disabled="true" oncommand="this.parentNode.simplify();" data-l10n-id="printpreview-simplify-page-checkbox"/>
|
|
||||||
<toolbarseparator class="toolbarseparator-primary"/>
|
|
||||||
<button id="print-preview-toolbar-close-button" oncommand="PrintUtils.exitPrintPreview();" data-l10n-id="printpreview-close"/>
|
|
||||||
<data id="print-preview-custom-scale-prompt-title" data-l10n-id="printpreview-custom-scale-prompt-title"/>
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.disconnectedCallback = this.disconnectedCallback.bind(this);
|
|
||||||
}
|
|
||||||
connectedCallback() {
|
|
||||||
window.addEventListener("unload", this.disconnectedCallback, {
|
|
||||||
once: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
MozXULElement.insertFTLIfNeeded("toolkit/printing/printPreview.ftl");
|
|
||||||
this.appendChild(this.constructor.fragment);
|
|
||||||
|
|
||||||
this.mPrintButton = document.getElementById("print-preview-print");
|
|
||||||
|
|
||||||
this.mPageSetupButton = document.getElementById(
|
|
||||||
"print-preview-pageSetup"
|
|
||||||
);
|
|
||||||
|
|
||||||
this.mNavigateHomeButton = document.getElementById(
|
|
||||||
"print-preview-navigateHome"
|
|
||||||
);
|
|
||||||
|
|
||||||
this.mNavigatePreviousButton = document.getElementById(
|
|
||||||
"print-preview-navigatePrevious"
|
|
||||||
);
|
|
||||||
|
|
||||||
this.mPageTextBox = document.getElementById("print-preview-pageNumber");
|
|
||||||
|
|
||||||
this.mNavigateNextButton = document.getElementById(
|
|
||||||
"print-preview-navigateNext"
|
|
||||||
);
|
|
||||||
|
|
||||||
this.mNavigateEndButton = document.getElementById(
|
|
||||||
"print-preview-navigateEnd"
|
|
||||||
);
|
|
||||||
|
|
||||||
this.mTotalPages = document.getElementById("print-preview-totalPages");
|
|
||||||
|
|
||||||
this.mScaleCombobox = document.getElementById("print-preview-scale");
|
|
||||||
|
|
||||||
this.mPortaitButton = document.getElementById(
|
|
||||||
"print-preview-portrait-button"
|
|
||||||
);
|
|
||||||
|
|
||||||
this.mLandscapeButton = document.getElementById(
|
|
||||||
"print-preview-landscape-button"
|
|
||||||
);
|
|
||||||
|
|
||||||
this.mSimplifyPageCheckbox = document.getElementById(
|
|
||||||
"print-preview-simplify"
|
|
||||||
);
|
|
||||||
|
|
||||||
this.mSimplifyPageNotAllowed = this.mSimplifyPageCheckbox.disabled;
|
|
||||||
|
|
||||||
this.mSimplifyPageToolbarSeparator = this.mSimplifyPageCheckbox.nextElementSibling;
|
|
||||||
|
|
||||||
this.mPrintPreviewObs = "";
|
|
||||||
|
|
||||||
this.mWebProgress = "";
|
|
||||||
|
|
||||||
this.mPPBrowser = null;
|
|
||||||
|
|
||||||
this.mOnPageTextBoxChange = () => {
|
|
||||||
this.navigate(0, Number(this.mPageTextBox.value), 0);
|
|
||||||
};
|
|
||||||
this.mPageTextBox.addEventListener("change", this.mOnPageTextBoxChange);
|
|
||||||
|
|
||||||
let dropdown = document.getElementById("print-preview-scale").menupopup;
|
|
||||||
for (let menuitem of dropdown.children) {
|
|
||||||
let value = menuitem.getAttribute("value");
|
|
||||||
if (!isNaN(parseFloat(value))) {
|
|
||||||
document.l10n.setAttributes(
|
|
||||||
menuitem,
|
|
||||||
"printpreview-percentage-value",
|
|
||||||
{ percent: Math.round(parseFloat(value) * 100) }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
initialize(aPPBrowser) {
|
|
||||||
let { Services } = ChromeUtils.import(
|
|
||||||
"resource://gre/modules/Services.jsm"
|
|
||||||
);
|
|
||||||
if (!Services.prefs.getBoolPref("print.use_simplify_page")) {
|
|
||||||
this.mSimplifyPageCheckbox.hidden = true;
|
|
||||||
this.mSimplifyPageToolbarSeparator.hidden = true;
|
|
||||||
}
|
|
||||||
this.mPPBrowser = aPPBrowser;
|
|
||||||
this.updateToolbar();
|
|
||||||
|
|
||||||
let ltr = document.documentElement.matches(":root:-moz-locale-dir(ltr)");
|
|
||||||
// Windows 7 doesn't support ⏮ and ⏭ by default, and fallback doesn't
|
|
||||||
// always work (bug 1343330).
|
|
||||||
let { AppConstants } = ChromeUtils.import(
|
|
||||||
"resource://gre/modules/AppConstants.jsm"
|
|
||||||
);
|
|
||||||
let useCompatCharacters = AppConstants.isPlatformAndVersionAtMost(
|
|
||||||
"win",
|
|
||||||
"6.1"
|
|
||||||
);
|
|
||||||
let leftEnd = useCompatCharacters ? "\u23EA" : "\u23EE";
|
|
||||||
let rightEnd = useCompatCharacters ? "\u23E9" : "\u23ED";
|
|
||||||
document.l10n.setAttributes(
|
|
||||||
this.mNavigateHomeButton,
|
|
||||||
"printpreview-homearrow",
|
|
||||||
{ arrow: ltr ? leftEnd : rightEnd }
|
|
||||||
);
|
|
||||||
document.l10n.setAttributes(
|
|
||||||
this.mNavigatePreviousButton,
|
|
||||||
"printpreview-previousarrow",
|
|
||||||
{ arrow: ltr ? "\u25C2" : "\u25B8" }
|
|
||||||
);
|
|
||||||
document.l10n.setAttributes(
|
|
||||||
this.mNavigateNextButton,
|
|
||||||
"printpreview-nextarrow",
|
|
||||||
{ arrow: ltr ? "\u25B8" : "\u25C2" }
|
|
||||||
);
|
|
||||||
document.l10n.setAttributes(
|
|
||||||
this.mNavigateEndButton,
|
|
||||||
"printpreview-endarrow",
|
|
||||||
{ arrow: ltr ? rightEnd : leftEnd }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
destroy() {
|
|
||||||
delete this.mPPBrowser;
|
|
||||||
}
|
|
||||||
|
|
||||||
disconnectedCallback() {
|
|
||||||
window.removeEventListener("unload", this.disconnectedCallback);
|
|
||||||
this.mPageTextBox.removeEventListener(
|
|
||||||
"change",
|
|
||||||
this.mOnPageTextBoxChange
|
|
||||||
);
|
|
||||||
this.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
disableUpdateTriggers(aDisabled) {
|
|
||||||
this.mPrintButton.disabled = aDisabled;
|
|
||||||
this.mPageSetupButton.disabled = aDisabled;
|
|
||||||
this.mNavigateHomeButton.disabled = aDisabled;
|
|
||||||
this.mNavigatePreviousButton.disabled = aDisabled;
|
|
||||||
this.mPageTextBox.disabled = aDisabled;
|
|
||||||
this.mNavigateNextButton.disabled = aDisabled;
|
|
||||||
this.mNavigateEndButton.disabled = aDisabled;
|
|
||||||
this.mScaleCombobox.disabled = aDisabled;
|
|
||||||
this.mPortaitButton.disabled = aDisabled;
|
|
||||||
this.mLandscapeButton.disabled = aDisabled;
|
|
||||||
this.mSimplifyPageCheckbox.disabled =
|
|
||||||
this.mSimplifyPageNotAllowed || aDisabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
doPageSetup() {
|
|
||||||
/* import-globals-from printUtils.js */
|
|
||||||
var didOK = PrintUtils.showPageSetup();
|
|
||||||
if (didOK) {
|
|
||||||
// the changes that effect the UI
|
|
||||||
this.updateToolbar();
|
|
||||||
|
|
||||||
// Now do PrintPreview
|
|
||||||
PrintUtils.printPreview();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
navigate(aDirection, aPageNum, aHomeOrEnd) {
|
|
||||||
const nsIWebBrowserPrint = Ci.nsIWebBrowserPrint;
|
|
||||||
let navType, pageNum;
|
|
||||||
|
|
||||||
let { min: lowerLimit, max: upperLimit } = this.mPageTextBox;
|
|
||||||
|
|
||||||
// we use only one of aHomeOrEnd, aDirection, or aPageNum
|
|
||||||
if (aHomeOrEnd) {
|
|
||||||
// We're going to either the very first page ("home"), or the
|
|
||||||
// very last page ("end").
|
|
||||||
if (aHomeOrEnd == "home") {
|
|
||||||
navType = nsIWebBrowserPrint.PRINTPREVIEW_HOME;
|
|
||||||
this.mPageTextBox.value = 1;
|
|
||||||
} else {
|
|
||||||
navType = nsIWebBrowserPrint.PRINTPREVIEW_END;
|
|
||||||
this.mPageTextBox.value = upperLimit;
|
|
||||||
}
|
|
||||||
pageNum = 0;
|
|
||||||
} else if (aDirection) {
|
|
||||||
// aDirection is either +1 or -1, and allows us to increment
|
|
||||||
// or decrement our currently viewed page.
|
|
||||||
pageNum = Number(this.mPageTextBox.value) + aDirection;
|
|
||||||
pageNum = Math.min(upperLimit, Math.max(lowerLimit, pageNum));
|
|
||||||
this.mPageTextBox.value = pageNum;
|
|
||||||
navType = nsIWebBrowserPrint.PRINTPREVIEW_GOTO_PAGENUM;
|
|
||||||
} else {
|
|
||||||
// We're going to a specific page (aPageNum)
|
|
||||||
navType = nsIWebBrowserPrint.PRINTPREVIEW_GOTO_PAGENUM;
|
|
||||||
pageNum = Math.min(upperLimit, Math.max(lowerLimit, aPageNum));
|
|
||||||
if (pageNum != aPageNum) {
|
|
||||||
this.mPageTextBox.value = pageNum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.mPPBrowser.sendMessageToActor(
|
|
||||||
"Printing:Preview:Navigate",
|
|
||||||
{
|
|
||||||
navType,
|
|
||||||
pageNum,
|
|
||||||
},
|
|
||||||
"Printing"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
print() {
|
|
||||||
PrintUtils.printWindow(this.mPPBrowser.browsingContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
promptForScaleValue(aValue) {
|
|
||||||
var value = Math.round(aValue);
|
|
||||||
var promptStr = document.getElementById("print-preview-scale-label")
|
|
||||||
.value;
|
|
||||||
var renameTitle = document.getElementById(
|
|
||||||
"print-preview-custom-scale-prompt-title"
|
|
||||||
).textContent;
|
|
||||||
var result = { value };
|
|
||||||
let { Services } = ChromeUtils.import(
|
|
||||||
"resource://gre/modules/Services.jsm"
|
|
||||||
);
|
|
||||||
var confirmed = Services.prompt.prompt(
|
|
||||||
window,
|
|
||||||
renameTitle,
|
|
||||||
promptStr,
|
|
||||||
result,
|
|
||||||
null,
|
|
||||||
{ value }
|
|
||||||
);
|
|
||||||
if (!confirmed || !result.value || result.value == "") {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return result.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
setScaleCombobox(aValue) {
|
|
||||||
var scaleValues = [
|
|
||||||
0.3,
|
|
||||||
0.4,
|
|
||||||
0.5,
|
|
||||||
0.6,
|
|
||||||
0.7,
|
|
||||||
0.8,
|
|
||||||
0.9,
|
|
||||||
1,
|
|
||||||
1.25,
|
|
||||||
1.5,
|
|
||||||
1.75,
|
|
||||||
2,
|
|
||||||
];
|
|
||||||
|
|
||||||
aValue = Number(aValue);
|
|
||||||
|
|
||||||
for (var i = 0; i < scaleValues.length; i++) {
|
|
||||||
if (aValue == scaleValues[i]) {
|
|
||||||
this.mScaleCombobox.selectedIndex = i;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.mScaleCombobox.value = "Custom";
|
|
||||||
}
|
|
||||||
|
|
||||||
scale(aValue) {
|
|
||||||
var settings = PrintUtils.getPrintSettings();
|
|
||||||
if (aValue == "ShrinkToFit") {
|
|
||||||
if (!settings.shrinkToFit) {
|
|
||||||
settings.shrinkToFit = true;
|
|
||||||
this.savePrintSettings(
|
|
||||||
settings,
|
|
||||||
settings.kInitSaveShrinkToFit | settings.kInitSaveScaling
|
|
||||||
);
|
|
||||||
PrintUtils.printPreview();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aValue == "Custom") {
|
|
||||||
aValue = this.promptForScaleValue(settings.scaling * 100.0);
|
|
||||||
if (aValue >= 10) {
|
|
||||||
aValue /= 100.0;
|
|
||||||
} else {
|
|
||||||
if (this.mScaleCombobox.hasAttribute("lastValidInx")) {
|
|
||||||
this.mScaleCombobox.selectedIndex = this.mScaleCombobox.getAttribute(
|
|
||||||
"lastValidInx"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setScaleCombobox(aValue);
|
|
||||||
this.mScaleCombobox.setAttribute(
|
|
||||||
"lastValidInx",
|
|
||||||
this.mScaleCombobox.selectedIndex
|
|
||||||
);
|
|
||||||
|
|
||||||
if (settings.scaling != aValue || settings.shrinkToFit) {
|
|
||||||
settings.shrinkToFit = false;
|
|
||||||
settings.scaling = aValue;
|
|
||||||
this.savePrintSettings(
|
|
||||||
settings,
|
|
||||||
settings.kInitSaveShrinkToFit | settings.kInitSaveScaling
|
|
||||||
);
|
|
||||||
PrintUtils.printPreview();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
orient(aOrientation) {
|
|
||||||
const kIPrintSettings = Ci.nsIPrintSettings;
|
|
||||||
var orientValue =
|
|
||||||
aOrientation == "portrait"
|
|
||||||
? kIPrintSettings.kPortraitOrientation
|
|
||||||
: kIPrintSettings.kLandscapeOrientation;
|
|
||||||
var settings = PrintUtils.getPrintSettings();
|
|
||||||
if (settings.orientation != orientValue) {
|
|
||||||
settings.orientation = orientValue;
|
|
||||||
this.savePrintSettings(settings, settings.kInitSaveOrientation);
|
|
||||||
PrintUtils.printPreview();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
simplify() {
|
|
||||||
PrintUtils.setSimplifiedMode(this.mSimplifyPageCheckbox.checked);
|
|
||||||
PrintUtils.printPreview();
|
|
||||||
}
|
|
||||||
|
|
||||||
enableSimplifyPage() {
|
|
||||||
this.mSimplifyPageNotAllowed = false;
|
|
||||||
this.mSimplifyPageCheckbox.disabled = false;
|
|
||||||
document.l10n.setAttributes(
|
|
||||||
this.mSimplifyPageCheckbox,
|
|
||||||
"printpreview-simplify-page-checkbox-enabled"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
disableSimplifyPage() {
|
|
||||||
this.mSimplifyPageNotAllowed = true;
|
|
||||||
this.mSimplifyPageCheckbox.disabled = true;
|
|
||||||
document.l10n.setAttributes(
|
|
||||||
this.mSimplifyPageCheckbox,
|
|
||||||
"printpreview-simplify-page-checkbox"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateToolbar() {
|
|
||||||
var settings = PrintUtils.getPrintSettings();
|
|
||||||
|
|
||||||
var isPortrait =
|
|
||||||
settings.orientation == Ci.nsIPrintSettings.kPortraitOrientation;
|
|
||||||
|
|
||||||
this.mPortaitButton.checked = isPortrait;
|
|
||||||
this.mLandscapeButton.checked = !isPortrait;
|
|
||||||
|
|
||||||
if (settings.shrinkToFit) {
|
|
||||||
this.mScaleCombobox.value = "ShrinkToFit";
|
|
||||||
} else {
|
|
||||||
this.setScaleCombobox(settings.scaling);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.mPageTextBox.value = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
savePrintSettings(settings, flags) {
|
|
||||||
var PSSVC = Cc["@mozilla.org/gfx/printsettings-service;1"].getService(
|
|
||||||
Ci.nsIPrintSettingsService
|
|
||||||
);
|
|
||||||
PSSVC.savePrintSettingsToPrefs(settings, true, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
updatePageCount(totalPages) {
|
|
||||||
this.mTotalPages.value = totalPages;
|
|
||||||
this.mPageTextBox.max = totalPages;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ extends: "toolbar" }
|
|
||||||
);
|
|
||||||
|
|
@ -35,13 +35,6 @@
|
||||||
* This message is sent to take content out of print preview mode.
|
* This message is sent to take content out of print preview mode.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
XPCOMUtils.defineLazyPreferenceGetter(
|
|
||||||
this,
|
|
||||||
"PRINT_TAB_MODAL",
|
|
||||||
"print.tab_modal.enabled",
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyPreferenceGetter(
|
XPCOMUtils.defineLazyPreferenceGetter(
|
||||||
this,
|
this,
|
||||||
"SHOW_PAGE_SETUP_MENU",
|
"SHOW_PAGE_SETUP_MENU",
|
||||||
|
|
@ -62,16 +55,6 @@ ChromeUtils.defineModuleGetter(
|
||||||
"resource://gre/modules/SharedPromptUtils.jsm"
|
"resource://gre/modules/SharedPromptUtils.jsm"
|
||||||
);
|
);
|
||||||
|
|
||||||
ChromeUtils.defineModuleGetter(
|
|
||||||
this,
|
|
||||||
"PrintingParent",
|
|
||||||
"resource://gre/actors/PrintingParent.jsm"
|
|
||||||
);
|
|
||||||
|
|
||||||
var gFocusedElement = null;
|
|
||||||
|
|
||||||
var gPendingPrintPreviews = new Map();
|
|
||||||
|
|
||||||
var PrintUtils = {
|
var PrintUtils = {
|
||||||
SAVE_TO_PDF_PRINTER: "Mozilla Save to PDF",
|
SAVE_TO_PDF_PRINTER: "Mozilla Save to PDF",
|
||||||
|
|
||||||
|
|
@ -150,26 +133,12 @@ var PrintUtils = {
|
||||||
* The print preview menu item is not available on mac.
|
* The print preview menu item is not available on mac.
|
||||||
*/
|
*/
|
||||||
updatePrintPreviewMenuHiddenState() {
|
updatePrintPreviewMenuHiddenState() {
|
||||||
let printPreviewMenuItem = document.getElementById("menu_printPreview");
|
|
||||||
if (printPreviewMenuItem) {
|
|
||||||
printPreviewMenuItem.hidden = PRINT_TAB_MODAL;
|
|
||||||
}
|
|
||||||
let pageSetupMenuItem = document.getElementById("menu_printSetup");
|
let pageSetupMenuItem = document.getElementById("menu_printSetup");
|
||||||
if (pageSetupMenuItem) {
|
if (pageSetupMenuItem) {
|
||||||
pageSetupMenuItem.hidden = PRINT_TAB_MODAL && !SHOW_PAGE_SETUP_MENU;
|
pageSetupMenuItem.hidden = !SHOW_PAGE_SETUP_MENU;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* This call exists in a separate method so it can be easily overridden where
|
|
||||||
* `gBrowser` doesn't exist (e.g. Thunderbird).
|
|
||||||
*
|
|
||||||
* @see createBrowser in tabbrowser.js
|
|
||||||
*/
|
|
||||||
createBrowser(params) {
|
|
||||||
return gBrowser.createBrowser(params);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the tab modal version of the print UI for the current tab.
|
* Opens the tab modal version of the print UI for the current tab.
|
||||||
*
|
*
|
||||||
|
|
@ -272,7 +241,6 @@ var PrintUtils = {
|
||||||
// print.
|
// print.
|
||||||
|
|
||||||
if (
|
if (
|
||||||
PRINT_TAB_MODAL &&
|
|
||||||
!PRINT_ALWAYS_SILENT &&
|
!PRINT_ALWAYS_SILENT &&
|
||||||
(!openWindowInfo || openWindowInfo.isForWindowDotPrint)
|
(!openWindowInfo || openWindowInfo.isForWindowDotPrint)
|
||||||
) {
|
) {
|
||||||
|
|
@ -345,182 +313,28 @@ var PrintUtils = {
|
||||||
|
|
||||||
makePrintSettingsMaybeEnsuringToFileName().then(settings => {
|
makePrintSettingsMaybeEnsuringToFileName().then(settings => {
|
||||||
settings.printSelectionOnly = printSelectionOnly;
|
settings.printSelectionOnly = printSelectionOnly;
|
||||||
PrintUtils.printWindow(aBrowsingContext, settings);
|
// At some point we should handle the Promise that this returns (at
|
||||||
|
// least report rejection to telemetry).
|
||||||
|
aBrowsingContext.print(settings);
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
togglePrintPreview(aBrowsingContext) {
|
||||||
* Starts the process of printing the contents of a window.
|
let dialogBox = this.getTabDialogBox(aBrowsingContext.top.embedderElement);
|
||||||
*
|
let dialogs = dialogBox.getTabDialogManager().dialogs;
|
||||||
* @param aBrowsingContext
|
let previewDialog = dialogs.find(d =>
|
||||||
* The BrowsingContext of the window to print.
|
d._box.querySelector(".printSettingsBrowser")
|
||||||
* @param {Object?} aPrintSettings
|
|
||||||
* Optional print settings for the print operation
|
|
||||||
*/
|
|
||||||
printWindow(aBrowsingContext, aPrintSettings) {
|
|
||||||
let wg = aBrowsingContext.currentWindowGlobal;
|
|
||||||
|
|
||||||
const printPreviewIsOpen = !!document.getElementById(
|
|
||||||
"print-preview-toolbar"
|
|
||||||
);
|
);
|
||||||
|
if (previewDialog) {
|
||||||
if (printPreviewIsOpen) {
|
previewDialog.close();
|
||||||
this._logKeyedTelemetry("PRINT_DIALOG_OPENED_COUNT", "FROM_PREVIEW");
|
return;
|
||||||
} else {
|
|
||||||
this._logKeyedTelemetry("PRINT_DIALOG_OPENED_COUNT", "FROM_PAGE");
|
|
||||||
}
|
}
|
||||||
|
this.startPrintWindow(aBrowsingContext);
|
||||||
// Use the passed in settings if provided, otherwise pull the saved ones.
|
|
||||||
let printSettings = aPrintSettings || this.getPrintSettings();
|
|
||||||
|
|
||||||
// Set the title so that the print dialog can pick it up and
|
|
||||||
// use it to generate the filename for save-to-PDF.
|
|
||||||
printSettings.title = this._originalTitle || wg.documentTitle;
|
|
||||||
|
|
||||||
if (this._shouldSimplify) {
|
|
||||||
// The generated document for simplified print preview has "about:blank"
|
|
||||||
// as its URL. We need to set docURL here so that the print header/footer
|
|
||||||
// can be given the original document's URL.
|
|
||||||
printSettings.docURL = this._originalURL || wg.documentURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At some point we should handle the Promise that this returns (report
|
|
||||||
// rejection to telemetry?)
|
|
||||||
let promise = aBrowsingContext.print(printSettings);
|
|
||||||
|
|
||||||
if (printPreviewIsOpen) {
|
|
||||||
if (this._shouldSimplify) {
|
|
||||||
this._logKeyedTelemetry("PRINT_COUNT", "SIMPLIFIED");
|
|
||||||
} else {
|
|
||||||
this._logKeyedTelemetry("PRINT_COUNT", "WITH_PREVIEW");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this._logKeyedTelemetry("PRINT_COUNT", "WITHOUT_PREVIEW");
|
|
||||||
}
|
|
||||||
|
|
||||||
return promise;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes print preview.
|
|
||||||
*
|
|
||||||
* @param aListenerObj
|
|
||||||
* An object that defines the following functions:
|
|
||||||
*
|
|
||||||
* getPrintPreviewBrowser:
|
|
||||||
* Returns the <xul:browser> to display the print preview in. This
|
|
||||||
* <xul:browser> must have its type attribute set to "content".
|
|
||||||
*
|
|
||||||
* getSimplifiedPrintPreviewBrowser:
|
|
||||||
* Returns the <xul:browser> to display the simplified print preview
|
|
||||||
* in. This <xul:browser> must have its type attribute set to
|
|
||||||
* "content".
|
|
||||||
*
|
|
||||||
* getSourceBrowser:
|
|
||||||
* Returns the <xul:browser> that contains the document being
|
|
||||||
* printed. This <xul:browser> must have its type attribute set to
|
|
||||||
* "content".
|
|
||||||
*
|
|
||||||
* getSimplifiedSourceBrowser:
|
|
||||||
* Returns the <xul:browser> that contains the simplified version
|
|
||||||
* of the document being printed. This <xul:browser> must have its
|
|
||||||
* type attribute set to "content".
|
|
||||||
*
|
|
||||||
* getNavToolbox:
|
|
||||||
* Returns the primary toolbox for this window.
|
|
||||||
*
|
|
||||||
* onEnter:
|
|
||||||
* Called upon entering print preview.
|
|
||||||
*
|
|
||||||
* onExit:
|
|
||||||
* Called upon exiting print preview.
|
|
||||||
*
|
|
||||||
* These methods must be defined. printPreview can be called
|
|
||||||
* with aListenerObj as null iff this window is already displaying
|
|
||||||
* print preview (in which case, the previous aListenerObj passed
|
|
||||||
* to it will be used).
|
|
||||||
*
|
|
||||||
* Due to a timing issue resulting in a main-process crash, we have to
|
|
||||||
* manually open the progress dialog for print preview. The progress
|
|
||||||
* dialog is opened here in PrintUtils, and then we listen for update
|
|
||||||
* messages from the child. Bug 1558588 is about removing this.
|
|
||||||
*/
|
|
||||||
printPreview(aListenerObj) {
|
|
||||||
if (PRINT_TAB_MODAL) {
|
|
||||||
let currentDialogBox = gBrowser.selectedBrowser.tabDialogBox;
|
|
||||||
if (currentDialogBox) {
|
|
||||||
let manager = currentDialogBox.getTabDialogManager();
|
|
||||||
let dialogs = manager.hasDialogs && manager.dialogs;
|
|
||||||
if (dialogs) {
|
|
||||||
for (let dialog of dialogs) {
|
|
||||||
if (dialog._openedURL.includes("print.html")) {
|
|
||||||
dialog.close();
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let browsingContext = gBrowser.selectedBrowser.browsingContext;
|
|
||||||
let focusedBc = Services.focus.focusedContentBrowsingContext;
|
|
||||||
if (
|
|
||||||
focusedBc &&
|
|
||||||
focusedBc.top.embedderElement == browsingContext.top.embedderElement
|
|
||||||
) {
|
|
||||||
browsingContext = focusedBc;
|
|
||||||
}
|
|
||||||
return this._openTabModalPrint(
|
|
||||||
browsingContext,
|
|
||||||
/* aExistingPreviewBrowser = */ undefined,
|
|
||||||
Date.now()
|
|
||||||
).promise;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we already have a toolbar someone is calling printPreview() to get us
|
|
||||||
// to refresh the display and aListenerObj won't be passed.
|
|
||||||
let printPreviewTB = document.getElementById("print-preview-toolbar");
|
|
||||||
if (!printPreviewTB) {
|
|
||||||
this._listener = aListenerObj;
|
|
||||||
this._sourceBrowser = aListenerObj.getSourceBrowser();
|
|
||||||
this._originalTitle = this._sourceBrowser.contentTitle;
|
|
||||||
this._originalURL = this._sourceBrowser.currentURI.spec;
|
|
||||||
|
|
||||||
// Here we log telemetry data for when the user enters print preview.
|
|
||||||
this.logTelemetry("PRINT_PREVIEW_OPENED_COUNT");
|
|
||||||
} else {
|
|
||||||
// Disable toolbar elements that can cause another update to be triggered
|
|
||||||
// during this update.
|
|
||||||
printPreviewTB.disableUpdateTriggers(true);
|
|
||||||
|
|
||||||
// collapse the browser here -- it will be shown in
|
|
||||||
// _enterPrintPreview; this forces a reflow which fixes display
|
|
||||||
// issues in bug 267422.
|
|
||||||
// We use the print preview browser as the source browser to avoid
|
|
||||||
// re-initializing print preview with a document that might now have changed.
|
|
||||||
this._sourceBrowser = this._shouldSimplify
|
|
||||||
? this._listener.getSimplifiedPrintPreviewBrowser()
|
|
||||||
: this._listener.getPrintPreviewBrowser();
|
|
||||||
this._sourceBrowser.collapsed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
let promise = new Promise((resolve, reject) => {
|
|
||||||
this._onEntered.push({ resolve, reject });
|
|
||||||
});
|
|
||||||
|
|
||||||
this._enterPrintPreview();
|
|
||||||
|
|
||||||
return promise;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// "private" methods and members. Don't use them.
|
// "private" methods and members. Don't use them.
|
||||||
|
|
||||||
_listener: null,
|
|
||||||
_closeHandlerPP: null,
|
|
||||||
_sourceBrowser: null,
|
|
||||||
_originalTitle: "",
|
|
||||||
_originalURL: "",
|
|
||||||
_shouldSimplify: false,
|
|
||||||
|
|
||||||
_getErrorCodeForNSResult(nsresult) {
|
_getErrorCodeForNSResult(nsresult) {
|
||||||
const MSG_CODES = [
|
const MSG_CODES = [
|
||||||
"GFX_PRINTER_NO_PRINTER_AVAILABLE",
|
"GFX_PRINTER_NO_PRINTER_AVAILABLE",
|
||||||
|
|
@ -657,211 +471,6 @@ var PrintUtils = {
|
||||||
this._shouldSimplify = shouldSimplify;
|
this._shouldSimplify = shouldSimplify;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEntered: [],
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Currently, we create a new print preview browser to host the simplified
|
|
||||||
* cloned-document when Simplify Page option is used on preview. To accomplish
|
|
||||||
* this, we need to keep track of what browser should be presented, based on
|
|
||||||
* whether the 'Simplify page' checkbox is checked.
|
|
||||||
*
|
|
||||||
* _ppBrowsers
|
|
||||||
* Set of print preview browsers.
|
|
||||||
* _currentPPBrowser
|
|
||||||
* References the current print preview browser that is being presented.
|
|
||||||
*/
|
|
||||||
_ppBrowsers: new Set(),
|
|
||||||
_currentPPBrowser: null,
|
|
||||||
|
|
||||||
_enterPrintPreview() {
|
|
||||||
// Send a message to the print preview browser to initialize
|
|
||||||
// print preview.
|
|
||||||
let ppBrowser = this._shouldSimplify
|
|
||||||
? this._listener.getSimplifiedPrintPreviewBrowser()
|
|
||||||
: this._listener.getPrintPreviewBrowser();
|
|
||||||
this._ppBrowsers.add(ppBrowser);
|
|
||||||
|
|
||||||
// If we're switching from 'normal' print preview to 'simplified' print
|
|
||||||
// preview, we will want to run reader mode against the 'normal' print
|
|
||||||
// preview browser's content:
|
|
||||||
let oldPPBrowser = null;
|
|
||||||
let changingPrintPreviewBrowsers = false;
|
|
||||||
if (this._currentPPBrowser && ppBrowser != this._currentPPBrowser) {
|
|
||||||
changingPrintPreviewBrowsers = true;
|
|
||||||
oldPPBrowser = this._currentPPBrowser;
|
|
||||||
}
|
|
||||||
this._currentPPBrowser = ppBrowser;
|
|
||||||
|
|
||||||
gPendingPrintPreviews.set(ppBrowser, false);
|
|
||||||
|
|
||||||
// If we happen to have gotten simplify page checked, we will lazily
|
|
||||||
// instantiate a new tab that parses the original page using ReaderMode
|
|
||||||
// primitives. When it's ready, and in order to enter on preview, we send
|
|
||||||
// over a message to print preview browser passing up the simplified tab as
|
|
||||||
// reference. If not, we pass the original tab instead as content source.
|
|
||||||
if (this._shouldSimplify) {
|
|
||||||
let simplifiedBrowser = this._listener.getSimplifiedSourceBrowser();
|
|
||||||
if (!simplifiedBrowser) {
|
|
||||||
simplifiedBrowser = this._listener.createSimplifiedBrowser();
|
|
||||||
|
|
||||||
// Here, we send down a message to simplified browser in order to parse
|
|
||||||
// the original page. After we have parsed it, content will tell parent
|
|
||||||
// that the document is ready for print previewing.
|
|
||||||
simplifiedBrowser.sendMessageToActor(
|
|
||||||
"Printing:Preview:ParseDocument",
|
|
||||||
{
|
|
||||||
URL: this._originalURL,
|
|
||||||
windowID: oldPPBrowser.outerWindowID,
|
|
||||||
},
|
|
||||||
"Printing"
|
|
||||||
);
|
|
||||||
|
|
||||||
// Here we log telemetry data for when the user enters simplify mode.
|
|
||||||
this.logTelemetry("PRINT_PREVIEW_SIMPLIFY_PAGE_OPENED_COUNT");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.sendEnterPrintPreviewToChild(
|
|
||||||
ppBrowser,
|
|
||||||
this._sourceBrowser,
|
|
||||||
this._shouldSimplify,
|
|
||||||
changingPrintPreviewBrowsers
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
sendEnterPrintPreviewToChild(
|
|
||||||
ppBrowser,
|
|
||||||
sourceBrowser,
|
|
||||||
simplifiedMode,
|
|
||||||
changingBrowsers
|
|
||||||
) {
|
|
||||||
ppBrowser.sendMessageToActor(
|
|
||||||
"Printing:Preview:Enter",
|
|
||||||
{
|
|
||||||
browsingContextId: sourceBrowser.browsingContext.id,
|
|
||||||
simplifiedMode,
|
|
||||||
changingBrowsers,
|
|
||||||
lastUsedPrinterName: this.getLastUsedPrinterName(),
|
|
||||||
},
|
|
||||||
"Printing"
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
printPreviewEntered(ppBrowser, previewResult) {
|
|
||||||
let waitForPrintProgressToEnableToolbar = gPendingPrintPreviews.get(
|
|
||||||
ppBrowser
|
|
||||||
);
|
|
||||||
gPendingPrintPreviews.delete(ppBrowser);
|
|
||||||
|
|
||||||
for (let { resolve, reject } of this._onEntered) {
|
|
||||||
if (previewResult.failed) {
|
|
||||||
reject();
|
|
||||||
} else {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this._onEntered = [];
|
|
||||||
if (previewResult.failed) {
|
|
||||||
// Something went wrong while putting the document into print preview
|
|
||||||
// mode. Bail out.
|
|
||||||
this._ppBrowsers.clear();
|
|
||||||
this._listener.onEnter();
|
|
||||||
this._listener.onExit();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stash the focused element so that we can return to it after exiting
|
|
||||||
// print preview.
|
|
||||||
gFocusedElement = document.commandDispatcher.focusedElement;
|
|
||||||
|
|
||||||
let printPreviewTB = document.getElementById("print-preview-toolbar");
|
|
||||||
if (printPreviewTB) {
|
|
||||||
if (previewResult.changingBrowsers) {
|
|
||||||
printPreviewTB.destroy();
|
|
||||||
printPreviewTB.initialize(ppBrowser);
|
|
||||||
} else {
|
|
||||||
// printPreviewTB.initialize above already calls updateToolbar.
|
|
||||||
printPreviewTB.updateToolbar();
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we don't have a progress listener to enable the toolbar do it now.
|
|
||||||
if (!waitForPrintProgressToEnableToolbar) {
|
|
||||||
printPreviewTB.disableUpdateTriggers(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
ppBrowser.collapsed = false;
|
|
||||||
ppBrowser.focus();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the original window as an active window so any mozPrintCallbacks can
|
|
||||||
// run without delayed setTimeouts.
|
|
||||||
if (this._listener.activateBrowser) {
|
|
||||||
this._listener.activateBrowser(this._sourceBrowser);
|
|
||||||
} else {
|
|
||||||
this._sourceBrowser.docShellIsActive = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// show the toolbar after we go into print preview mode so
|
|
||||||
// that we can initialize the toolbar with total num pages
|
|
||||||
printPreviewTB = document.createXULElement("toolbar", {
|
|
||||||
is: "printpreview-toolbar",
|
|
||||||
});
|
|
||||||
printPreviewTB.setAttribute("fullscreentoolbar", true);
|
|
||||||
printPreviewTB.setAttribute("flex", "1");
|
|
||||||
printPreviewTB.id = "print-preview-toolbar";
|
|
||||||
|
|
||||||
let navToolbox = this._listener.getNavToolbox();
|
|
||||||
navToolbox.parentNode.insertBefore(printPreviewTB, navToolbox);
|
|
||||||
printPreviewTB.initialize(ppBrowser);
|
|
||||||
|
|
||||||
// The print preview processing may not have fully completed, so if we
|
|
||||||
// have a progress listener, disable the toolbar elements that can trigger
|
|
||||||
// updates and it will enable them when completed.
|
|
||||||
if (waitForPrintProgressToEnableToolbar) {
|
|
||||||
printPreviewTB.disableUpdateTriggers(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enable simplify page checkbox when the page is an article
|
|
||||||
if (this._sourceBrowser.isArticle) {
|
|
||||||
printPreviewTB.enableSimplifyPage();
|
|
||||||
} else {
|
|
||||||
this.logTelemetry("PRINT_PREVIEW_SIMPLIFY_PAGE_UNAVAILABLE_COUNT");
|
|
||||||
printPreviewTB.disableSimplifyPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy the window close handler
|
|
||||||
if (window.onclose) {
|
|
||||||
this._closeHandlerPP = window.onclose;
|
|
||||||
} else {
|
|
||||||
this._closeHandlerPP = null;
|
|
||||||
}
|
|
||||||
window.onclose = function() {
|
|
||||||
PrintUtils.exitPrintPreview();
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
// disable chrome shortcuts...
|
|
||||||
window.addEventListener("keydown", this.onKeyDownPP, true);
|
|
||||||
window.addEventListener("keypress", this.onKeyPressPP, true);
|
|
||||||
|
|
||||||
ppBrowser.collapsed = false;
|
|
||||||
ppBrowser.focus();
|
|
||||||
// on Enter PP Call back
|
|
||||||
this._listener.onEnter();
|
|
||||||
},
|
|
||||||
|
|
||||||
readerModeReady(sourceBrowser) {
|
|
||||||
if (PRINT_TAB_MODAL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let ppBrowser = this._listener.getSimplifiedPrintPreviewBrowser();
|
|
||||||
this.sendEnterPrintPreviewToChild(ppBrowser, sourceBrowser, true, true);
|
|
||||||
},
|
|
||||||
|
|
||||||
getLastUsedPrinterName() {
|
getLastUsedPrinterName() {
|
||||||
let PSSVC = Cc["@mozilla.org/gfx/printsettings-service;1"].getService(
|
let PSSVC = Cc["@mozilla.org/gfx/printsettings-service;1"].getService(
|
||||||
Ci.nsIPrintSettingsService
|
Ci.nsIPrintSettingsService
|
||||||
|
|
@ -893,91 +502,6 @@ var PrintUtils = {
|
||||||
|
|
||||||
return lastUsedPrinterName;
|
return lastUsedPrinterName;
|
||||||
},
|
},
|
||||||
|
|
||||||
exitPrintPreview() {
|
|
||||||
for (let browser of this._ppBrowsers) {
|
|
||||||
browser.sendMessageToActor("Printing:Preview:Exit", {}, "Printing");
|
|
||||||
}
|
|
||||||
this._ppBrowsers.clear();
|
|
||||||
this._currentPPBrowser = null;
|
|
||||||
window.removeEventListener("keydown", this.onKeyDownPP, true);
|
|
||||||
window.removeEventListener("keypress", this.onKeyPressPP, true);
|
|
||||||
|
|
||||||
// restore the old close handler
|
|
||||||
if (this._closeHandlerPP) {
|
|
||||||
window.onclose = this._closeHandlerPP;
|
|
||||||
} else {
|
|
||||||
window.onclose = null;
|
|
||||||
}
|
|
||||||
this._closeHandlerPP = null;
|
|
||||||
|
|
||||||
// remove the print preview toolbar
|
|
||||||
let printPreviewTB = document.getElementById("print-preview-toolbar");
|
|
||||||
printPreviewTB.destroy();
|
|
||||||
printPreviewTB.remove();
|
|
||||||
|
|
||||||
if (gFocusedElement) {
|
|
||||||
Services.focus.setFocus(gFocusedElement, Services.focus.FLAG_NOSCROLL);
|
|
||||||
} else {
|
|
||||||
this._sourceBrowser.focus();
|
|
||||||
}
|
|
||||||
gFocusedElement = null;
|
|
||||||
|
|
||||||
this.setSimplifiedMode(false);
|
|
||||||
|
|
||||||
this._listener.onExit();
|
|
||||||
|
|
||||||
this._originalTitle = "";
|
|
||||||
this._originalURL = "";
|
|
||||||
},
|
|
||||||
|
|
||||||
logTelemetry(ID) {
|
|
||||||
let histogram = Services.telemetry.getHistogramById(ID);
|
|
||||||
histogram.add(true);
|
|
||||||
},
|
|
||||||
|
|
||||||
_logKeyedTelemetry(id, key) {
|
|
||||||
let histogram = Services.telemetry.getKeyedHistogramById(id);
|
|
||||||
histogram.add(key);
|
|
||||||
},
|
|
||||||
|
|
||||||
onKeyDownPP(aEvent) {
|
|
||||||
// Esc exits the PP
|
|
||||||
if (aEvent.keyCode == aEvent.DOM_VK_ESCAPE) {
|
|
||||||
PrintUtils.exitPrintPreview();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
onKeyPressPP(aEvent) {
|
|
||||||
var closeKey;
|
|
||||||
try {
|
|
||||||
closeKey = document.getElementById("key_close").getAttribute("key");
|
|
||||||
closeKey = aEvent["DOM_VK_" + closeKey];
|
|
||||||
} catch (e) {}
|
|
||||||
var isModif = aEvent.ctrlKey || aEvent.metaKey;
|
|
||||||
// Ctrl-W exits the PP
|
|
||||||
if (
|
|
||||||
isModif &&
|
|
||||||
(aEvent.charCode == closeKey || aEvent.charCode == closeKey + 32)
|
|
||||||
) {
|
|
||||||
PrintUtils.exitPrintPreview();
|
|
||||||
} else if (isModif) {
|
|
||||||
var printPreviewTB = document.getElementById("print-preview-toolbar");
|
|
||||||
var printKey = document
|
|
||||||
.getElementById("printKb")
|
|
||||||
.getAttribute("key")
|
|
||||||
.toUpperCase();
|
|
||||||
var pressedKey = String.fromCharCode(aEvent.charCode).toUpperCase();
|
|
||||||
if (printKey == pressedKey) {
|
|
||||||
printPreviewTB.print();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// cancel shortkeys
|
|
||||||
if (isModif) {
|
|
||||||
aEvent.preventDefault();
|
|
||||||
aEvent.stopPropagation();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PrintPreview extends MozElements.BaseControl {
|
class PrintPreview extends MozElements.BaseControl {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ toolkit.jar:
|
||||||
content/global/printPageSetup.xhtml (content/printPageSetup.xhtml)
|
content/global/printPageSetup.xhtml (content/printPageSetup.xhtml)
|
||||||
#endif
|
#endif
|
||||||
content/global/printPreviewPagination.js (content/printPreviewPagination.js)
|
content/global/printPreviewPagination.js (content/printPreviewPagination.js)
|
||||||
content/global/printPreviewToolbar.js (content/printPreviewToolbar.js)
|
|
||||||
content/global/printUtils.js (content/printUtils.js)
|
content/global/printUtils.js (content/printUtils.js)
|
||||||
content/global/print.js (content/print.js)
|
content/global/print.js (content/print.js)
|
||||||
content/global/print.html (content/print.html)
|
content/global/print.html (content/print.html)
|
||||||
|
|
|
||||||
|
|
@ -10496,58 +10496,6 @@
|
||||||
"n_buckets": 50,
|
"n_buckets": 50,
|
||||||
"description": "(Bug 1207089) Time in ms between displaying a popup notification and dismissing it without an action the first time, keyed by ID"
|
"description": "(Bug 1207089) Time in ms between displaying a popup notification and dismissing it without an action the first time, keyed by ID"
|
||||||
},
|
},
|
||||||
"PRINT_PREVIEW_OPENED_COUNT": {
|
|
||||||
"record_in_processes": ["main", "content"],
|
|
||||||
"products": ["firefox", "fennec"],
|
|
||||||
"alert_emails": ["carnold@mozilla.org"],
|
|
||||||
"bug_numbers": [1275570, 1568968],
|
|
||||||
"expires_in_version": "never",
|
|
||||||
"kind": "count",
|
|
||||||
"releaseChannelCollection": "opt-out",
|
|
||||||
"description": "A counter incremented every time the browser enters print preview."
|
|
||||||
},
|
|
||||||
"PRINT_PREVIEW_SIMPLIFY_PAGE_OPENED_COUNT": {
|
|
||||||
"record_in_processes": ["main", "content"],
|
|
||||||
"products": ["firefox", "fennec"],
|
|
||||||
"alert_emails": ["carnold@mozilla.org"],
|
|
||||||
"bug_numbers": [1275570, 1568968],
|
|
||||||
"expires_in_version": "never",
|
|
||||||
"kind": "count",
|
|
||||||
"releaseChannelCollection": "opt-out",
|
|
||||||
"description": "A counter incremented every time the browser enters simplified mode on print preview."
|
|
||||||
},
|
|
||||||
"PRINT_PREVIEW_SIMPLIFY_PAGE_UNAVAILABLE_COUNT": {
|
|
||||||
"record_in_processes": ["main", "content"],
|
|
||||||
"products": ["firefox", "fennec"],
|
|
||||||
"alert_emails": ["carnold@mozilla.org"],
|
|
||||||
"bug_numbers": [1287587, 1568968],
|
|
||||||
"expires_in_version": "never",
|
|
||||||
"kind": "count",
|
|
||||||
"releaseChannelCollection": "opt-out",
|
|
||||||
"description": "A counter incremented every time the simplified mode is unavailable on print preview."
|
|
||||||
},
|
|
||||||
"PRINT_DIALOG_OPENED_COUNT": {
|
|
||||||
"record_in_processes": ["main"],
|
|
||||||
"products": ["firefox", "fennec"],
|
|
||||||
"alert_emails": ["jwatt@jwatt.org"],
|
|
||||||
"bug_numbers": [1306624, 1568968, 1594391],
|
|
||||||
"expires_in_version": "never",
|
|
||||||
"kind": "count",
|
|
||||||
"keyed": true,
|
|
||||||
"releaseChannelCollection": "opt-out",
|
|
||||||
"description": "A counter incremented every time the user opens print dialog."
|
|
||||||
},
|
|
||||||
"PRINT_COUNT": {
|
|
||||||
"record_in_processes": ["main"],
|
|
||||||
"products": ["firefox", "fennec"],
|
|
||||||
"alert_emails": ["jwatt@jwatt.org"],
|
|
||||||
"bug_numbers": [1287587, 1568968, 1594391],
|
|
||||||
"expires_in_version": "never",
|
|
||||||
"kind": "count",
|
|
||||||
"keyed": true,
|
|
||||||
"releaseChannelCollection": "opt-out",
|
|
||||||
"description": "A counter incremented every time the user prints a document."
|
|
||||||
},
|
|
||||||
"PRINT_BACKGROUND_TASK_TIME_MS" : {
|
"PRINT_BACKGROUND_TASK_TIME_MS" : {
|
||||||
"record_in_processes": ["main"],
|
"record_in_processes": ["main"],
|
||||||
"products": ["firefox"],
|
"products": ["firefox"],
|
||||||
|
|
|
||||||
|
|
@ -1148,11 +1148,6 @@
|
||||||
"NETWORK_CONNECTION_COUNT",
|
"NETWORK_CONNECTION_COUNT",
|
||||||
"OPENGL_COMPOSITING_FAILURE_ID",
|
"OPENGL_COMPOSITING_FAILURE_ID",
|
||||||
"PERMISSIONS_SQL_CORRUPTED",
|
"PERMISSIONS_SQL_CORRUPTED",
|
||||||
"PRINT_COUNT",
|
|
||||||
"PRINT_DIALOG_OPENED_COUNT",
|
|
||||||
"PRINT_PREVIEW_OPENED_COUNT",
|
|
||||||
"PRINT_PREVIEW_SIMPLIFY_PAGE_OPENED_COUNT",
|
|
||||||
"PRINT_PREVIEW_SIMPLIFY_PAGE_UNAVAILABLE_COUNT",
|
|
||||||
"PROCESS_CRASH_SUBMIT_ATTEMPT",
|
"PROCESS_CRASH_SUBMIT_ATTEMPT",
|
||||||
"PUSH_API_NOTIFY",
|
"PUSH_API_NOTIFY",
|
||||||
"REQUESTS_OF_ORIGINAL_CONTENT",
|
"REQUESTS_OF_ORIGINAL_CONTENT",
|
||||||
|
|
|
||||||
|
|
@ -843,10 +843,6 @@
|
||||||
["named-deck-button", "chrome://global/content/elements/named-deck.js"],
|
["named-deck-button", "chrome://global/content/elements/named-deck.js"],
|
||||||
["search-textbox", "chrome://global/content/elements/search-textbox.js"],
|
["search-textbox", "chrome://global/content/elements/search-textbox.js"],
|
||||||
["stringbundle", "chrome://global/content/elements/stringbundle.js"],
|
["stringbundle", "chrome://global/content/elements/stringbundle.js"],
|
||||||
[
|
|
||||||
"printpreview-toolbar",
|
|
||||||
"chrome://global/content/printPreviewToolbar.js",
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"printpreview-pagination",
|
"printpreview-pagination",
|
||||||
"chrome://global/content/printPreviewPagination.js",
|
"chrome://global/content/printPreviewPagination.js",
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,6 @@
|
||||||
list-style-image: url("moz-icon://stock/gtk-save-as?size=menu");
|
list-style-image: url("moz-icon://stock/gtk-save-as?size=menu");
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu_printPreview {
|
|
||||||
list-style-image: url("moz-icon://stock/gtk-print-preview?size=menu");
|
|
||||||
}
|
|
||||||
|
|
||||||
#menu_print {
|
#menu_print {
|
||||||
list-style-image: url("moz-icon://stock/gtk-print?size=menu");
|
list-style-image: url("moz-icon://stock/gtk-print?size=menu");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue