зеркало из https://github.com/mozilla/pjs.git
bug 419609: add hidden pref to disable site-specific zoom; r=gavin, a=beltzner
This commit is contained in:
Родитель
c7d042ef68
Коммит
621acfdbbc
|
@ -701,6 +701,9 @@ pref("browser.offline-apps.notify", true);
|
|||
// if true, use full page zoom instead of text zoom
|
||||
pref("browser.zoom.full", true);
|
||||
|
||||
// Whether or not to save and restore zoom levels on a per-site basis.
|
||||
pref("browser.zoom.siteSpecific", true);
|
||||
|
||||
// replace newlines with spaces when pasting into <input type="text"> fields
|
||||
pref("editor.singleLine.pasteNewlines", 2);
|
||||
|
||||
|
|
|
@ -79,13 +79,24 @@ var FullZoom = {
|
|||
getService(Ci.nsIContentPrefService);
|
||||
},
|
||||
|
||||
get _prefBranch FullZoom_get__prefBranch() {
|
||||
delete this._prefBranch;
|
||||
return this._prefBranch = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch2);
|
||||
},
|
||||
|
||||
// browser.zoom.siteSpecific preference cache
|
||||
siteSpecific: undefined,
|
||||
|
||||
|
||||
//**************************************************************************//
|
||||
// nsISupports
|
||||
|
||||
// We can't use the Ci shortcut here because it isn't defined yet.
|
||||
interfaces: [Components.interfaces.nsIDOMEventListener,
|
||||
Components.interfaces.nsIObserver,
|
||||
Components.interfaces.nsIContentPrefObserver,
|
||||
Components.interfaces.nsISupportsWeakReference,
|
||||
Components.interfaces.nsISupports],
|
||||
|
||||
QueryInterface: function FullZoom_QueryInterface(aIID) {
|
||||
|
@ -104,9 +115,16 @@ var FullZoom = {
|
|||
|
||||
// Register ourselves with the service so we know when our pref changes.
|
||||
this._cps.addObserver(this.name, this);
|
||||
|
||||
// Listen for changes to the browser.zoom.siteSpecific preference so we can
|
||||
// enable/disable per-site saving and restoring of zoom levels accordingly.
|
||||
this.siteSpecific =
|
||||
this._prefBranch.getBoolPref("browser.zoom.siteSpecific");
|
||||
this._prefBranch.addObserver("browser.zoom.siteSpecific", this, true);
|
||||
},
|
||||
|
||||
destroy: function FullZoom_destroy() {
|
||||
this._prefBranch.removeObserver("browser.zoom.siteSpecific", this);
|
||||
this._cps.removeObserver(this.name, this);
|
||||
window.removeEventListener("DOMMouseScroll", this, false);
|
||||
delete this._cps;
|
||||
|
@ -164,6 +182,21 @@ var FullZoom = {
|
|||
window.setTimeout(function (self) { self._applySettingToPref() }, 0, this);
|
||||
},
|
||||
|
||||
// nsIObserver
|
||||
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
switch(aTopic) {
|
||||
case "nsPref:changed":
|
||||
switch(aData) {
|
||||
case "browser.zoom.siteSpecific":
|
||||
this.siteSpecific =
|
||||
this._prefBranch.getBoolPref("browser.zoom.siteSpecific");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
// nsIContentPrefObserver
|
||||
|
||||
onContentPrefSet: function FullZoom_onContentPrefSet(aGroup, aName, aValue) {
|
||||
|
@ -257,7 +290,7 @@ var FullZoom = {
|
|||
* one.
|
||||
**/
|
||||
_applyPrefToSetting: function FullZoom__applyPrefToSetting(aValue) {
|
||||
if (gInPrintPreviewMode)
|
||||
if (!this.siteSpecific || gInPrintPreviewMode)
|
||||
return;
|
||||
|
||||
try {
|
||||
|
@ -272,7 +305,7 @@ var FullZoom = {
|
|||
},
|
||||
|
||||
_applySettingToPref: function FullZoom__applySettingToPref() {
|
||||
if (gInPrintPreviewMode)
|
||||
if (!this.siteSpecific || gInPrintPreviewMode)
|
||||
return;
|
||||
|
||||
var zoomLevel = ZoomManager.zoom;
|
||||
|
|
Загрузка…
Ссылка в новой задаче