Bug 621823 Zoom levels in toolkit.zoomManager.zoomValues are always reset to 0.5,0.75,0.9,1,1.2,1.5,2
This commit is contained in:
Родитель
8fd35b6730
Коммит
4cfc8e9d66
|
@ -328,6 +328,9 @@ pref("browser.zoom.siteSpecific", true);
|
|||
// once they come to the foreground (i.e. get activated).
|
||||
pref("browser.zoom.updateBackgroundTabs", true);
|
||||
|
||||
// Zoom levels for View > Zoom and Ctrl +/- keyboard shortcuts
|
||||
pref("toolkit.zoomManager.zoomValues", "0.5,0.67,0.8,0.9,1,1.1,1.2,1.33,1.5,1.7,2,2.4");
|
||||
|
||||
pref("javascript.options.showInConsole", true);
|
||||
|
||||
pref("offline.startup_state", 0);
|
||||
|
|
|
@ -362,32 +362,47 @@ function registerZoomManager() {
|
|||
var parentMenu = zoomMenu.parentNode;
|
||||
parentMenu.addEventListener("popupshowing", updateViewMenu, false);
|
||||
|
||||
var accessKeys = zoomBundle.getString("accessKeys").split(",");
|
||||
var zoomFactors = zoomBundle.getString("values").split(",");
|
||||
|
||||
// Make sure the zoom manager has the same values as us
|
||||
Services.prefs.setCharPref("toolkit.zoomManager.zoomValues",
|
||||
zoomFactors.map(function(aVal) {return aVal/100;})
|
||||
.join(","));
|
||||
// initialize menu from toolkit.zoomManager.zoomValues and assign accesskeys
|
||||
var zoomFactors = ZoomManager.zoomValues;
|
||||
var freeKeys = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ];
|
||||
|
||||
var insertBefore = document.getElementById("menu_zoomInsertBefore");
|
||||
var popup = insertBefore.parentNode;
|
||||
for (var i = 0; i < zoomFactors.length; ++i) {
|
||||
var thisFactor = Math.round(zoomFactors[i] * 100);
|
||||
var menuItem = document.createElement("menuitem");
|
||||
menuItem.setAttribute("type", "radio");
|
||||
menuItem.setAttribute("name", "zoom");
|
||||
|
||||
var label;
|
||||
if (zoomFactors[i] == 100) {
|
||||
label = zoomBundle.getString("labelOriginal");
|
||||
var accessKey = "";
|
||||
if (thisFactor == 100) {
|
||||
label = zoomBundle.getString("zoom.100.label");
|
||||
accessKey = zoomBundle.getString("zoom.100.accesskey");
|
||||
menuItem.setAttribute("key", "key_zoomReset");
|
||||
}
|
||||
else
|
||||
label = zoomBundle.getString("label");
|
||||
else if (thisFactor == 200) {
|
||||
label = zoomBundle.getString("zoom.200.label");
|
||||
accessKey = zoomBundle.getString("zoom.200.accesskey");
|
||||
}
|
||||
else {
|
||||
label = zoomBundle.getString("zoom.value.label")
|
||||
.replace(/%zoom%/, thisFactor);
|
||||
for (var j = 0; j < label.length; ++j) {
|
||||
var testKey = label[j];
|
||||
var indexKey = freeKeys.indexOf(testKey);
|
||||
if (indexKey >= 0) {
|
||||
accessKey = testKey;
|
||||
freeKeys.splice(indexKey, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
menuItem.setAttribute("label", label.replace(/%zoom%/, zoomFactors[i]));
|
||||
menuItem.setAttribute("accesskey", accessKeys[i]);
|
||||
menuItem.setAttribute("value", zoomFactors[i]);
|
||||
menuItem.setAttribute("label", label);
|
||||
if (accessKey)
|
||||
menuItem.setAttribute("accesskey", accessKey);
|
||||
menuItem.setAttribute("value", thisFactor);
|
||||
popup.insertBefore(menuItem, insertBefore);
|
||||
}
|
||||
}
|
||||
|
@ -400,18 +415,22 @@ function updateViewMenu() {
|
|||
var zoomBundle = document.getElementById("bundle_viewZoom");
|
||||
var zoomMenu = document.getElementById("menu_zoom");
|
||||
var zoomType = ZoomManager.useFullZoom ? "fullZoom" : "textZoom";
|
||||
var menuLabel = zoomBundle.getString(zoomType)
|
||||
var menuLabel = zoomBundle.getString(zoomType + ".label")
|
||||
.replace(/%zoom%/, Math.round(ZoomManager.zoom * 100));
|
||||
var menuKey = zoomBundle.getString(zoomType + ".accesskey");
|
||||
zoomMenu.setAttribute("label", menuLabel);
|
||||
zoomMenu.setAttribute("accesskey", menuKey);
|
||||
}
|
||||
|
||||
function updateZoomMenu() {
|
||||
var zoomBundle = document.getElementById("bundle_viewZoom");
|
||||
var zoomOther = document.getElementById("menu_zoomOther");
|
||||
var label = zoomBundle.getString("labelOther");
|
||||
var label = zoomBundle.getString("zoom.other.label");
|
||||
var accesskey = zoomBundle.getString("zoom.other.accesskey");
|
||||
var factorOther = zoomOther.getAttribute("value") ||
|
||||
Math.round(ZoomManager.MAX * 100);
|
||||
zoomOther.setAttribute("label", label.replace(/%zoom%/, factorOther));
|
||||
zoomOther.setAttribute("accesskey", accesskey);
|
||||
zoomOther.setAttribute("value", factorOther);
|
||||
|
||||
var popup = document.getElementById("menu_zoomPopup");
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
<command id="cmd_fullZoomToggle" oncommand="ZoomManager.toggleZoom();"/>
|
||||
</commandset>
|
||||
|
||||
<menu id="menu_zoom" accesskey="&zoomMenu.accesskey;">
|
||||
<menu id="menu_zoom">
|
||||
<menupopup id="menu_zoomPopup" onpopupshowing="updateZoomMenu();" oncommand="FullZoom.zoom(event.target.value / 100);">
|
||||
<menuitem id="menu_zoomReduce"
|
||||
key="key_zoomReduce"
|
||||
|
@ -81,7 +81,6 @@
|
|||
<menuitem id="menu_zoomOther"
|
||||
type="radio"
|
||||
name="zoom"
|
||||
accesskey="&zoomOtherCmd.accesskey;"
|
||||
command="cmd_zoomOther"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<!-- LOCALIZATION NOTE: do not use digits "0"-"9" as accesskeys -->
|
||||
<!ENTITY zoomEnlargeCmd.label "Larger">
|
||||
<!ENTITY zoomEnlargeCmd.accesskey "L">
|
||||
<!ENTITY zoomEnlargeCmd.commandkey "+">
|
||||
|
@ -8,7 +9,3 @@
|
|||
<!ENTITY zoomReduceCmd.commandkey "-">
|
||||
|
||||
<!ENTITY zoomResetCmd.commandkey "0">
|
||||
|
||||
<!-- see zoomOtherLabel in viewZoomOverlay.properties -->
|
||||
<!ENTITY zoomMenu.accesskey "z">
|
||||
<!ENTITY zoomOtherCmd.accesskey "o">
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
# font size submenu
|
||||
# zoom submenu
|
||||
#
|
||||
# don't translate %zoom%
|
||||
# LOCALIZATION NOTE: don't translate %zoom% in any property
|
||||
# don't use digits "0"-"9" for accesskeys
|
||||
|
||||
fullZoom=Zoom (%zoom% %)
|
||||
textZoom=Text Zoom (%zoom% %)
|
||||
label=%zoom% %
|
||||
labelOriginal=%zoom% % (Original Size)
|
||||
labelOther=Other (%zoom% %) …
|
||||
# LOCALIZATION NOTE (fullZoom,textZoom): are never available at the same time
|
||||
fullZoom.label=Zoom (%zoom% %)
|
||||
fullZoom.accesskey=Z
|
||||
textZoom.label=Text Zoom (%zoom% %)
|
||||
textZoom.accesskey=Z
|
||||
|
||||
# {values} must be greater than 0, include 100 and be in natural order
|
||||
# {accessKeys} correspond to {values}, where "z" matches the z in
|
||||
# "Original size" in {labelOriginal}
|
||||
# labels and accesskeys to emphasize the 100 % and 200 % entries
|
||||
zoom.100.label=100 % (Original Size)
|
||||
zoom.100.accesskey=z
|
||||
zoom.200.label=200 % (Double Size)
|
||||
zoom.200.accesskey=D
|
||||
|
||||
values=50,75,90,100,120,150,200
|
||||
accessKeys=5,7,9,z,1,0,2
|
||||
# label pattern for remaining values, accesskeys are assigned dynamically
|
||||
zoom.value.label=%zoom% %
|
||||
|
||||
zoom.other.label=Other (%zoom% %) …
|
||||
zoom.other.accesskey=O
|
||||
|
|
Загрузка…
Ссылка в новой задаче