Bug 1473265 - Clean up print preview toolbar ids and classes. r=bgrins

MozReview-Commit-ID: ATM75qPMd0F

--HG--
extra : rebase_source : 6123537b12982c45c65e2002223d391f7326de79
This commit is contained in:
Dão Gottwald 2018-07-10 15:23:04 +02:00
Родитель ab2277aaa8
Коммит 814229b19e
3 изменённых файлов: 69 добавлений и 71 удалений

Просмотреть файл

@ -16,94 +16,88 @@ customElements.define("printpreview-toolbar", class PrintPreviewToolbar extends
connectedCallback() {
window.addEventListener("unload", this.disconnectedCallback, { once: true });
this.appendChild(MozXULElement.parseXULToFragment(`
<button label="&print.label;" accesskey="&print.accesskey;" oncommand="this.parentNode.print();" icon="print"></button>
<button anonid="pageSetup" label="&pageSetup.label;" accesskey="&pageSetup.accesskey;" oncommand="this.parentNode.doPageSetup();"></button>
<button id="print-preview-print" label="&print.label;" accesskey="&print.accesskey;" oncommand="this.parentNode.print();" icon="print"/>
<button id="print-preview-pageSetup" label="&pageSetup.label;" accesskey="&pageSetup.accesskey;" oncommand="this.parentNode.doPageSetup();"/>
<vbox align="center" pack="center">
<label value="&page.label;" accesskey="&page.accesskey;" control="pageNumber"></label>
<label value="&page.label;" accesskey="&page.accesskey;" control="print-preview-pageNumber"/>
</vbox>
<toolbarbutton anonid="navigateHome" class="navigate-button tabbable" oncommand="parentNode.navigate(0, 0, 'home');" tooltiptext="&homearrow.tooltip;"></toolbarbutton>
<toolbarbutton anonid="navigatePrevious" class="navigate-button tabbable" oncommand="parentNode.navigate(-1, 0, 0);" tooltiptext="&previousarrow.tooltip;"></toolbarbutton>
<toolbarbutton id="print-preview-navigateHome" class="print-preview-navigate-button tabbable" oncommand="parentNode.navigate(0, 0, 'home');" tooltiptext="&homearrow.tooltip;"/>
<toolbarbutton id="print-preview-navigatePrevious" class="print-preview-navigate-button tabbable" oncommand="parentNode.navigate(-1, 0, 0);" tooltiptext="&previousarrow.tooltip;"/>
<hbox align="center" pack="center">
<textbox id="pageNumber" value="1" min="1" type="number" hidespinbuttons="true" onchange="navigate(0, this.valueNumber, 0);"></textbox>
<label value="&of.label;"></label>
<label value="1"></label>
<textbox id="print-preview-pageNumber" value="1" min="1" type="number" hidespinbuttons="true" onchange="navigate(0, this.valueNumber, 0);"/>
<label value="&of.label;"/>
<label id="print-preview-totalPages" value="1"/>
</hbox>
<toolbarbutton anonid="navigateNext" class="navigate-button tabbable" oncommand="parentNode.navigate(1, 0, 0);" tooltiptext="&nextarrow.tooltip;"></toolbarbutton>
<toolbarbutton anonid="navigateEnd" class="navigate-button tabbable" oncommand="parentNode.navigate(0, 0, 'end');" tooltiptext="&endarrow.tooltip;"></toolbarbutton>
<toolbarseparator class="toolbarseparator-primary"></toolbarseparator>
<toolbarbutton id="print-preview-navigateNext" class="print-preview-navigate-button tabbable" oncommand="parentNode.navigate(1, 0, 0);" tooltiptext="&nextarrow.tooltip;"/>
<toolbarbutton id="print-preview-navigateEnd" class="print-preview-navigate-button tabbable" oncommand="parentNode.navigate(0, 0, 'end');" tooltiptext="&endarrow.tooltip;"/>
<toolbarseparator class="toolbarseparator-primary"/>
<vbox align="center" pack="center">
<label value="&scale.label;" accesskey="&scale.accesskey;" control="scale"></label>
<label id="print-preview-scale-label" value="&scale.label;" accesskey="&scale.accesskey;" control="print-preview-scale"/>
</vbox>
<hbox align="center" pack="center">
<menulist id="scale" crop="none" oncommand="parentNode.parentNode.scale(this.selectedItem.value);">
<menulist id="print-preview-scale" crop="none" oncommand="parentNode.parentNode.scale(this.selectedItem.value);">
<menupopup>
<menuitem value="0.3" label="&p30.label;"></menuitem>
<menuitem value="0.4" label="&p40.label;"></menuitem>
<menuitem value="0.5" label="&p50.label;"></menuitem>
<menuitem value="0.6" label="&p60.label;"></menuitem>
<menuitem value="0.7" label="&p70.label;"></menuitem>
<menuitem value="0.8" label="&p80.label;"></menuitem>
<menuitem value="0.9" label="&p90.label;"></menuitem>
<menuitem value="1" label="&p100.label;"></menuitem>
<menuitem value="1.25" label="&p125.label;"></menuitem>
<menuitem value="1.5" label="&p150.label;"></menuitem>
<menuitem value="1.75" label="&p175.label;"></menuitem>
<menuitem value="2" label="&p200.label;"></menuitem>
<menuseparator></menuseparator>
<menuitem flex="1" value="ShrinkToFit" label="&ShrinkToFit.label;"></menuitem>
<menuitem value="Custom" label="&Custom.label;"></menuitem>
<menuitem value="0.3" label="&p30.label;"/>
<menuitem value="0.4" label="&p40.label;"/>
<menuitem value="0.5" label="&p50.label;"/>
<menuitem value="0.6" label="&p60.label;"/>
<menuitem value="0.7" label="&p70.label;"/>
<menuitem value="0.8" label="&p80.label;"/>
<menuitem value="0.9" label="&p90.label;"/>
<menuitem value="1" label="&p100.label;"/>
<menuitem value="1.25" label="&p125.label;"/>
<menuitem value="1.5" label="&p150.label;"/>
<menuitem value="1.75" label="&p175.label;"/>
<menuitem value="2" label="&p200.label;"/>
<menuseparator/>
<menuitem flex="1" value="ShrinkToFit" label="&ShrinkToFit.label;"/>
<menuitem value="Custom" label="&Custom.label;"/>
</menupopup>
</menulist>
</hbox>
<toolbarseparator class="toolbarseparator-primary"></toolbarseparator>
<toolbarseparator class="toolbarseparator-primary"/>
<hbox align="center" pack="center">
<toolbarbutton label="&portrait.label;" checked="true" accesskey="&portrait.accesskey;" type="radio" group="orient" class="toolbar-portrait-page tabbable" oncommand="parentNode.parentNode.orient('portrait');"></toolbarbutton>
<toolbarbutton label="&landscape.label;" accesskey="&landscape.accesskey;" type="radio" group="orient" class="toolbar-landscape-page tabbable" oncommand="parentNode.parentNode.orient('landscape');"></toolbarbutton>
<toolbarbutton id="print-preview-portrait-button" label="&portrait.label;" checked="true" accesskey="&portrait.accesskey;" type="radio" group="orient" class="tabbable" oncommand="parentNode.parentNode.orient('portrait');"/>
<toolbarbutton id="print-preview-landscape-button" label="&landscape.label;" accesskey="&landscape.accesskey;" type="radio" group="orient" class="tabbable" oncommand="parentNode.parentNode.orient('landscape');"/>
</hbox>
<toolbarseparator class="toolbarseparator-primary"></toolbarseparator>
<checkbox label="&simplifyPage.label;" checked="false" disabled="true" accesskey="&simplifyPage.accesskey;" tooltiptext-disabled="&simplifyPage.disabled.tooltip;" tooltiptext-enabled="&simplifyPage.enabled.tooltip;" oncommand="this.parentNode.simplify();"></checkbox>
<toolbarseparator class="toolbarseparator-primary"></toolbarseparator>
<button label="&close.label;" accesskey="&close.accesskey;" oncommand="PrintUtils.exitPrintPreview();" icon="close"></button>
<data value="&customPrompt.title;"></data>
<toolbarseparator class="toolbarseparator-primary"/>
<checkbox id="print-preview-simplify" label="&simplifyPage.label;" checked="false" disabled="true" accesskey="&simplifyPage.accesskey;" tooltiptext-disabled="&simplifyPage.disabled.tooltip;" tooltiptext-enabled="&simplifyPage.enabled.tooltip;" oncommand="this.parentNode.simplify();"/>
<toolbarseparator class="toolbarseparator-primary"/>
<button label="&close.label;" accesskey="&close.accesskey;" oncommand="PrintUtils.exitPrintPreview();" icon="close"/>
<data id="print-preview-prompt-title" value="&customPrompt.title;"/>
`, `
<!DOCTYPE bindings [
<!ENTITY % printPreviewDTD SYSTEM "chrome://global/locale/printPreview.dtd" >
%printPreviewDTD;
]>`));
this.mPrintButton = this.childNodes[0];
this.mPrintButton = document.getElementById("print-preview-print");
this.mPageSetupButton = this.querySelector("[anonid=pageSetup]");
this.mPageSetupButton = document.getElementById("print-preview-pageSetup");
this.mNavigateHomeButton = this.querySelector("[anonid=navigateHome]");
this.mNavigateHomeButton = document.getElementById("print-preview-navigateHome");
this.mNavigatePreviousButton = this.querySelector("[anonid=navigatePrevious]");
this.mNavigatePreviousButton = document.getElementById("print-preview-navigatePrevious");
this.mPageTextBox = this.childNodes[5].childNodes[0];
this.mPageTextBox = document.getElementById("print-preview-pageNumber");
this.mNavigateNextButton = this.querySelector("[anonid=navigateNext]");
this.mNavigateNextButton = document.getElementById("print-preview-navigateNext");
this.mNavigateEndButton = this.querySelector("[anonid=navigateEnd]");
this.mNavigateEndButton = document.getElementById("print-preview-navigateEnd");
this.mTotalPages = this.childNodes[5].childNodes[2];
this.mTotalPages = document.getElementById("print-preview-totalPages");
this.mScaleLabel = this.childNodes[9].firstChild;
this.mScaleCombobox = document.getElementById("print-preview-scale-label");
this.mScaleCombobox = this.childNodes[10].firstChild;
this.mPortaitButton = document.getElementById("print-preview-portrait-button");
this.mOrientButtonsBox = this.childNodes[12];
this.mLandscapeButton = document.getElementById("print-preview-landscape-button");
this.mPortaitButton = this.mOrientButtonsBox.childNodes[0];
this.mLandscapeButton = this.mOrientButtonsBox.childNodes[1];
this.mSimplifyPageCheckbox = this.childNodes[14];
this.mSimplifyPageCheckbox = document.getElementById("print-preview-simplify");
this.mSimplifyPageNotAllowed = this.mSimplifyPageCheckbox.disabled;
this.mSimplifyPageToolbarSeparator = this.childNodes[15];
this.mCustomTitle = this.childNodes[17].firstChild;
this.mSimplifyPageToolbarSeparator = this.mSimplifyPageCheckbox.nextSibling;
this.mPrintPreviewObs = "";
@ -132,10 +126,10 @@ customElements.define("printpreview-toolbar", class PrintPreviewToolbar extends
let useCompatCharacters = AppConstants.isPlatformAndVersionAtMost("win", "6.1");
let leftEnd = useCompatCharacters ? "\u23EA" : "\u23EE";
let rightEnd = useCompatCharacters ? "\u23E9" : "\u23ED";
this.querySelector("[anonid=navigateHome]").label = ltr ? leftEnd : rightEnd;
this.querySelector("[anonid=navigatePrevious]").label = ltr ? "\u25C2" : "\u25B8";
this.querySelector("[anonid=navigateNext]").label = ltr ? "\u25B8" : "\u25C2";
this.querySelector("[anonid=navigateEnd]").label = ltr ? rightEnd : leftEnd;
this.mNavigateHomeButton.label = ltr ? leftEnd : rightEnd;
this.mNavigatePreviousButton.label = ltr ? "\u25C2" : "\u25B8";
this.mNavigateNextButton.label = ltr ? "\u25B8" : "\u25C2";
this.mNavigateEndButton.label = ltr ? rightEnd : leftEnd;
}
destroy() {
@ -217,8 +211,8 @@ customElements.define("printpreview-toolbar", class PrintPreviewToolbar extends
promptForScaleValue(aValue) {
var value = Math.round(aValue);
var promptStr = this.mScaleLabel.value;
var renameTitle = this.mCustomTitle;
var promptStr = document.getElementById("print-preview-scale-label").value;
var renameTitle = document.getElementById("print-preview-prompt-title");
var result = { value };
let { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm", {});
var confirmed = Services.prompt.prompt(window, renameTitle, promptStr, result, null, { value });

Просмотреть файл

@ -121,23 +121,25 @@ toolbar[mode="text"] .toolbarbutton-text {
margin: 3px 5px !important;
}
toolbar[is="printpreview-toolbar"] .navigate-button {
/* ::::: print preview ::::: */
.print-preview-navigate-button {
min-width: 1.9em;
}
toolbar[is="printpreview-toolbar"] .navigate-button > .toolbarbutton-icon {
.print-preview-navigate-button > .toolbarbutton-icon {
display: none;
}
toolbar[is="printpreview-toolbar"] .toolbar-portrait-page {
#print-preview-portrait-button {
list-style-image: url("moz-icon://stock/gtk-orientation-portrait?size=button");
}
toolbar[is="printpreview-toolbar"] .toolbar-landscape-page {
#print-preview-landscape-button {
list-style-image: url("moz-icon://stock/gtk-orientation-landscape?size=button");
}
toolbar[is="printpreview-toolbar"] #pageNumber {
#print-preview-pageNumber {
/* 3 chars + 4px padding left + 2px padding right + 2*6px border */
width: calc(18px + 3ch);
}

Просмотреть файл

@ -131,25 +131,27 @@ toolbar[mode="text"] .toolbarbutton-text {
margin: 3px 5px !important;
}
toolbar[is="printpreview-toolbar"] .navigate-button {
/* ::::: print preview ::::: */
.print-preview-navigate-button {
min-width: 1.9em;
}
toolbar[is="printpreview-toolbar"] .navigate-button > .toolbarbutton-icon {
.print-preview-navigate-button > .toolbarbutton-icon {
display: none;
}
toolbar[is="printpreview-toolbar"] .toolbar-portrait-page {
#print-preview-portrait-button {
list-style-image: url("chrome://global/skin/icons/Print-preview.png");
-moz-image-region: rect(0px 16px 16px 0px);
}
toolbar[is="printpreview-toolbar"] .toolbar-landscape-page {
#print-preview-landscape-button {
list-style-image: url("chrome://global/skin/icons/Print-preview.png");
-moz-image-region: rect(0px 32px 16px 16px);
}
toolbar[is="printpreview-toolbar"] #pageNumber {
#print-preview-pageNumber {
width: 3ch;
}