author | Emma Malysz <emalysz@mozilla.com> |
Wed, 12 Aug 2020 01:24:37 +0000 | |
changeset 544349 | 4909c8ec371cc4f3d2a8024dbbf4c5a251bdf958 |
parent 544348 | bf0c6945edbe201fbc701fb994e859beb0a9aba0 |
child 544350 | d95ae26b4a96388190aba96aaffc8e09eea86ff8 |
push id | 123984 |
push user | cbrindusan@mozilla.com |
push date | Wed, 12 Aug 2020 01:55:02 +0000 |
treeherder | autoland@d95ae26b4a96 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mstriemer |
bugs | 1658074 |
milestone | 81.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/toolkit/components/printing/content/print.js +++ b/toolkit/components/printing/content/print.js @@ -590,25 +590,38 @@ class TwistySummary extends PrintUIContr open ? this.getAttribute("data-open-l10n-id") : this.getAttribute("data-closed-l10n-id") ); } } customElements.define("twisty-summary", TwistySummary); -class PageCount extends HTMLParagraphElement { - constructor() { - super(); +class PageCount extends PrintUIControlMixin(HTMLElement) { + initialize() { + super.initialize(); document.addEventListener("page-count", this); } - handleEvent(e) { - let { numPages } = e.detail; + update(settings) { + this.numCopies = settings.numCopies; + this.render(); + } + + render() { + if (!this.numCopies || !this.numPages) { + return; + } document.l10n.setAttributes(this, "printui-sheets-count", { - sheetCount: numPages, + sheetCount: this.numPages * this.numCopies, }); if (this.hidden) { document.l10n.translateElements([this]).then(() => (this.hidden = false)); } } + + handleEvent(e) { + let { numPages } = e.detail; + this.numPages = numPages; + this.render(); + } } -customElements.define("page-count", PageCount, { extends: "p" }); +customElements.define("page-count", PageCount);