2007-06-19 11:58:14 -07:00
|
|
|
/*
|
|
|
|
#ifdef 0
|
2012-05-21 04:12:37 -07:00
|
|
|
* 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/.
|
2007-06-19 11:58:14 -07:00
|
|
|
#endif
|
|
|
|
*/
|
|
|
|
|
2007-10-25 16:02:20 -07:00
|
|
|
// One of the possible values for the mousewheel.* preferences.
|
|
|
|
// From nsEventStateManager.cpp.
|
2008-02-13 03:00:45 -08:00
|
|
|
const MOUSE_SCROLL_ZOOM = 3;
|
2007-06-19 11:58:14 -07:00
|
|
|
|
2012-06-30 07:50:07 -07:00
|
|
|
Cu.import('resource://gre/modules/ContentPrefInstance.jsm');
|
|
|
|
|
|
|
|
function getContentPrefs(aWindow) {
|
|
|
|
let context = aWindow ? aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
|
|
.getInterface(Ci.nsIWebNavigation)
|
|
|
|
.QueryInterface(Ci.nsILoadContext) : null;
|
|
|
|
return new ContentPrefInstance(context);
|
|
|
|
}
|
|
|
|
|
2007-06-19 11:58:14 -07:00
|
|
|
/**
|
2007-10-25 16:02:20 -07:00
|
|
|
* Controls the "full zoom" setting and its site-specific preferences.
|
2007-06-19 11:58:14 -07:00
|
|
|
*/
|
2007-10-25 16:02:20 -07:00
|
|
|
var FullZoom = {
|
2010-07-24 01:57:04 -07:00
|
|
|
// Identifies the setting in the content prefs database.
|
2007-10-25 16:02:20 -07:00
|
|
|
name: "browser.content.full-zoom",
|
2007-06-19 11:58:14 -07:00
|
|
|
|
2007-11-26 00:35:22 -08:00
|
|
|
// The global value (if any) for the setting. Lazily loaded from the service
|
|
|
|
// when first requested, then updated by the pref change listener as it changes.
|
2007-06-19 11:58:14 -07:00
|
|
|
// If there is no global value, then this should be undefined.
|
2010-04-17 03:19:33 -07:00
|
|
|
get globalValue() {
|
2012-06-30 07:50:07 -07:00
|
|
|
var globalValue = getContentPrefs(gBrowser.contentDocument.defaultView).getPref(null, this.name);
|
2007-11-26 00:35:22 -08:00
|
|
|
if (typeof globalValue != "undefined")
|
|
|
|
globalValue = this._ensureValid(globalValue);
|
|
|
|
delete this.globalValue;
|
|
|
|
return this.globalValue = globalValue;
|
|
|
|
},
|
2007-06-19 11:58:14 -07:00
|
|
|
|
2008-02-26 15:05:53 -08:00
|
|
|
// browser.zoom.siteSpecific preference cache
|
2009-01-23 01:12:51 -08:00
|
|
|
_siteSpecificPref: undefined,
|
2008-02-26 15:05:53 -08:00
|
|
|
|
2009-03-01 03:22:44 -08:00
|
|
|
// browser.zoom.updateBackgroundTabs preference cache
|
|
|
|
updateBackgroundTabs: undefined,
|
|
|
|
|
2010-04-17 03:19:33 -07:00
|
|
|
get siteSpecific() {
|
bug 679784: let nsIContentPrefService handle private browsing mode; r=ehsan
Manage private browsing mode in content pref service. CPS should be available
in private browsing mode, but should not store informations on disk, and should
clear all informations once the private session ends.
When setting a pref in private mode, it is stored in an in-memory hash table.
When getting a pref, it is retrieved from that hash table if available.
Otherwise, it is retrieved using the standard mechanism. When removing a pref,
it is retrieved from the hash table. The rationale is that in private mode,
it's ok to read a pref from normal database, but not ok to set it.
The in-memory hash table is cleared when leaving the private browsing mode.
When removing a set of preferences (with removeGroupedPrefs or
removePrefsByName), preferences are removed from the in-memory hashtable, *and*
from normal mode database. The rationale is that visiting a website may trigger
setting/getting/removing for a specific preference only. But removing many
prefs at once is the result of an action not associated with a website. For
example, user may wish to delete all its informations. In that case, user
probably expects to not have those informations restored once it leaves private
browsing mode.
2011-09-01 11:13:03 -07:00
|
|
|
return this._siteSpecificPref;
|
2009-01-23 01:12:51 -08:00
|
|
|
},
|
2007-06-19 11:58:14 -07:00
|
|
|
|
|
|
|
//**************************************************************************//
|
|
|
|
// nsISupports
|
|
|
|
|
2010-07-24 01:57:04 -07:00
|
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMEventListener,
|
|
|
|
Ci.nsIObserver,
|
|
|
|
Ci.nsIContentPrefObserver,
|
|
|
|
Ci.nsISupportsWeakReference,
|
|
|
|
Ci.nsISupports]),
|
2007-06-19 11:58:14 -07:00
|
|
|
|
|
|
|
//**************************************************************************//
|
|
|
|
// Initialization & Destruction
|
|
|
|
|
2007-11-26 00:35:22 -08:00
|
|
|
init: function FullZoom_init() {
|
2007-06-19 11:58:14 -07:00
|
|
|
// Listen for scrollwheel events so we can save scrollwheel-based changes.
|
|
|
|
window.addEventListener("DOMMouseScroll", this, false);
|
|
|
|
|
|
|
|
// Register ourselves with the service so we know when our pref changes.
|
2012-06-30 07:50:07 -07:00
|
|
|
getContentPrefs().addObserver(this.name, this);
|
2008-02-26 15:05:53 -08:00
|
|
|
|
2009-01-23 01:12:51 -08:00
|
|
|
this._siteSpecificPref =
|
2010-03-08 23:49:46 -08:00
|
|
|
gPrefService.getBoolPref("browser.zoom.siteSpecific");
|
2010-05-10 21:28:19 -07:00
|
|
|
this.updateBackgroundTabs =
|
2010-03-08 23:49:46 -08:00
|
|
|
gPrefService.getBoolPref("browser.zoom.updateBackgroundTabs");
|
2009-03-01 03:22:44 -08:00
|
|
|
// Listen for changes to the browser.zoom branch so we can enable/disable
|
|
|
|
// updating background tabs and per-site saving and restoring of zoom levels.
|
2010-03-08 23:49:46 -08:00
|
|
|
gPrefService.addObserver("browser.zoom.", this, true);
|
2007-06-19 11:58:14 -07:00
|
|
|
},
|
|
|
|
|
2007-11-26 00:35:22 -08:00
|
|
|
destroy: function FullZoom_destroy() {
|
2010-03-08 23:49:46 -08:00
|
|
|
gPrefService.removeObserver("browser.zoom.", this);
|
2012-06-30 07:50:07 -07:00
|
|
|
getContentPrefs().removeObserver(this.name, this);
|
2007-06-19 11:58:14 -07:00
|
|
|
window.removeEventListener("DOMMouseScroll", this, false);
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//**************************************************************************//
|
|
|
|
// Event Handlers
|
|
|
|
|
|
|
|
// nsIDOMEventListener
|
|
|
|
|
2007-11-26 00:35:22 -08:00
|
|
|
handleEvent: function FullZoom_handleEvent(event) {
|
2007-10-25 16:02:20 -07:00
|
|
|
switch (event.type) {
|
|
|
|
case "DOMMouseScroll":
|
|
|
|
this._handleMouseScrolled(event);
|
|
|
|
break;
|
|
|
|
}
|
2007-06-19 11:58:14 -07:00
|
|
|
},
|
|
|
|
|
2007-11-26 00:35:22 -08:00
|
|
|
_handleMouseScrolled: function FullZoom__handleMouseScrolled(event) {
|
2007-06-19 11:58:14 -07:00
|
|
|
// Construct the "mousewheel action" pref key corresponding to this event.
|
2012-08-15 08:51:13 -07:00
|
|
|
// Based on nsEventStateManager::WheelPrefs::GetBasePrefName().
|
|
|
|
var pref = "mousewheel.";
|
|
|
|
|
|
|
|
var pressedModifierCount = event.shiftKey + event.ctrlKey + event.altKey +
|
|
|
|
event.metaKey + event.getModifierState("OS");
|
|
|
|
if (pressedModifierCount != 1) {
|
|
|
|
pref += "default.";
|
|
|
|
} else if (event.shiftKey) {
|
|
|
|
pref += "with_shift.";
|
|
|
|
} else if (event.ctrlKey) {
|
|
|
|
pref += "with_control.";
|
|
|
|
} else if (event.altKey) {
|
|
|
|
pref += "with_alt.";
|
|
|
|
} else if (event.metaKey) {
|
|
|
|
pref += "with_meta.";
|
|
|
|
} else {
|
|
|
|
pref += "with_win.";
|
|
|
|
}
|
|
|
|
|
|
|
|
pref += "action";
|
2007-06-19 11:58:14 -07:00
|
|
|
|
2007-10-25 16:02:20 -07:00
|
|
|
// Don't do anything if this isn't a "zoom" scroll event.
|
|
|
|
var isZoomEvent = false;
|
|
|
|
try {
|
2008-02-13 03:00:45 -08:00
|
|
|
isZoomEvent = (gPrefService.getIntPref(pref) == MOUSE_SCROLL_ZOOM);
|
2007-10-25 16:02:20 -07:00
|
|
|
} catch (e) {}
|
|
|
|
if (!isZoomEvent)
|
2007-06-19 11:58:14 -07:00
|
|
|
return;
|
|
|
|
|
|
|
|
// XXX Lazily cache all the possible action prefs so we don't have to get
|
|
|
|
// them anew from the pref service for every scroll event? We'd have to
|
|
|
|
// make sure to observe them so we can update the cache when they change.
|
|
|
|
|
|
|
|
// We have to call _applySettingToPref in a timeout because we handle
|
|
|
|
// the event before the event state manager has a chance to apply the zoom
|
|
|
|
// during nsEventStateManager::PostHandleEvent.
|
2007-10-25 16:02:20 -07:00
|
|
|
window.setTimeout(function (self) { self._applySettingToPref() }, 0, this);
|
2007-06-19 11:58:14 -07:00
|
|
|
},
|
|
|
|
|
2008-02-26 15:05:53 -08:00
|
|
|
// nsIObserver
|
|
|
|
|
|
|
|
observe: function (aSubject, aTopic, aData) {
|
2010-02-06 02:40:06 -08:00
|
|
|
switch (aTopic) {
|
2008-02-26 15:05:53 -08:00
|
|
|
case "nsPref:changed":
|
2010-02-06 02:40:06 -08:00
|
|
|
switch (aData) {
|
2008-02-26 15:05:53 -08:00
|
|
|
case "browser.zoom.siteSpecific":
|
2009-01-23 01:12:51 -08:00
|
|
|
this._siteSpecificPref =
|
2010-03-08 23:49:46 -08:00
|
|
|
gPrefService.getBoolPref("browser.zoom.siteSpecific");
|
2008-02-26 15:05:53 -08:00
|
|
|
break;
|
2009-03-01 03:22:44 -08:00
|
|
|
case "browser.zoom.updateBackgroundTabs":
|
|
|
|
this.updateBackgroundTabs =
|
2010-03-08 23:49:46 -08:00
|
|
|
gPrefService.getBoolPref("browser.zoom.updateBackgroundTabs");
|
2009-03-01 03:22:44 -08:00
|
|
|
break;
|
2008-02-26 15:05:53 -08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2007-06-19 11:58:14 -07:00
|
|
|
// nsIContentPrefObserver
|
|
|
|
|
2007-11-26 00:35:22 -08:00
|
|
|
onContentPrefSet: function FullZoom_onContentPrefSet(aGroup, aName, aValue) {
|
2012-06-30 07:50:07 -07:00
|
|
|
let contentPrefs = getContentPrefs(gBrowser.contentDocument.defaultView);
|
|
|
|
if (aGroup == contentPrefs.grouper.group(gBrowser.currentURI))
|
2007-06-19 11:58:14 -07:00
|
|
|
this._applyPrefToSetting(aValue);
|
|
|
|
else if (aGroup == null) {
|
|
|
|
this.globalValue = this._ensureValid(aValue);
|
|
|
|
|
|
|
|
// If the current page doesn't have a site-specific preference,
|
|
|
|
// then its zoom should be set to the new global preference now that
|
|
|
|
// the global preference has changed.
|
2012-06-30 07:50:07 -07:00
|
|
|
if (!contentPrefs.hasPref(gBrowser.currentURI, this.name))
|
2007-06-19 11:58:14 -07:00
|
|
|
this._applyPrefToSetting();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2007-11-26 00:35:22 -08:00
|
|
|
onContentPrefRemoved: function FullZoom_onContentPrefRemoved(aGroup, aName) {
|
2012-06-30 07:50:07 -07:00
|
|
|
let contentPrefs = getContentPrefs(gBrowser.contentDocument.defaultView);
|
|
|
|
if (aGroup == contentPrefs.grouper.group(gBrowser.currentURI))
|
2007-06-19 11:58:14 -07:00
|
|
|
this._applyPrefToSetting();
|
|
|
|
else if (aGroup == null) {
|
|
|
|
this.globalValue = undefined;
|
|
|
|
|
|
|
|
// If the current page doesn't have a site-specific preference,
|
|
|
|
// then its zoom should be set to the default preference now that
|
|
|
|
// the global preference has changed.
|
2012-06-30 07:50:07 -07:00
|
|
|
if (!contentPrefs.hasPref(gBrowser.currentURI, this.name))
|
2007-06-19 11:58:14 -07:00
|
|
|
this._applyPrefToSetting();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2007-11-26 00:35:22 -08:00
|
|
|
// location change observer
|
2007-06-19 11:58:14 -07:00
|
|
|
|
2009-08-02 10:53:01 -07:00
|
|
|
/**
|
|
|
|
* Called when the location of a tab changes.
|
|
|
|
* When that happens, we need to update the current zoom level if appropriate.
|
|
|
|
*
|
|
|
|
* @param aURI
|
|
|
|
* A URI object representing the new location.
|
|
|
|
* @param aIsTabSwitch
|
|
|
|
* Whether this location change has happened because of a tab switch.
|
|
|
|
* @param aBrowser
|
|
|
|
* (optional) browser object displaying the document
|
|
|
|
*/
|
|
|
|
onLocationChange: function FullZoom_onLocationChange(aURI, aIsTabSwitch, aBrowser) {
|
|
|
|
if (!aURI || (aIsTabSwitch && !this.siteSpecific))
|
2007-11-26 00:35:22 -08:00
|
|
|
return;
|
2010-03-25 03:52:21 -07:00
|
|
|
|
|
|
|
// Avoid the cps roundtrip and apply the default/global pref.
|
2012-04-25 12:50:09 -07:00
|
|
|
if (aURI.spec == "about:blank") {
|
2010-03-30 18:24:05 -07:00
|
|
|
this._applyPrefToSetting(undefined, aBrowser);
|
2010-03-25 03:52:21 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-12-28 12:45:04 -08:00
|
|
|
let browser = aBrowser || gBrowser.selectedBrowser;
|
|
|
|
|
2012-01-20 11:43:24 -08:00
|
|
|
// Media documents should always start at 1, and are not affected by prefs.
|
|
|
|
if (!aIsTabSwitch && browser.contentDocument.mozSyntheticDocument) {
|
2012-01-18 16:01:19 -08:00
|
|
|
ZoomManager.setZoomForBrowser(browser, 1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-06-30 07:50:07 -07:00
|
|
|
let contentPrefs = getContentPrefs(gBrowser.contentDocument.defaultView);
|
|
|
|
if (contentPrefs.hasCachedPref(aURI, this.name)) {
|
|
|
|
let zoomValue = contentPrefs.getPref(aURI, this.name);
|
2010-12-28 12:45:04 -08:00
|
|
|
this._applyPrefToSetting(zoomValue, browser);
|
|
|
|
} else {
|
|
|
|
var self = this;
|
2012-06-30 07:50:07 -07:00
|
|
|
contentPrefs.getPref(aURI, this.name, function (aResult) {
|
2010-12-28 12:45:04 -08:00
|
|
|
// Check that we're still where we expect to be in case this took a while.
|
2011-07-28 14:18:53 -07:00
|
|
|
// Null check currentURI, since the window may have been destroyed before
|
|
|
|
// we were called.
|
|
|
|
if (browser.currentURI && aURI.equals(browser.currentURI)) {
|
2010-12-28 12:45:04 -08:00
|
|
|
self._applyPrefToSetting(aResult, browser);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2007-06-19 11:58:14 -07:00
|
|
|
},
|
|
|
|
|
2008-02-13 03:00:45 -08:00
|
|
|
// update state of zoom type menu item
|
|
|
|
|
|
|
|
updateMenu: function FullZoom_updateMenu() {
|
|
|
|
var menuItem = document.getElementById("toggle_zoom");
|
|
|
|
|
|
|
|
menuItem.setAttribute("checked", !ZoomManager.useFullZoom);
|
|
|
|
},
|
2007-06-19 11:58:14 -07:00
|
|
|
|
|
|
|
//**************************************************************************//
|
|
|
|
// Setting & Pref Manipulation
|
|
|
|
|
2007-11-26 00:35:22 -08:00
|
|
|
reduce: function FullZoom_reduce() {
|
2007-10-25 16:02:20 -07:00
|
|
|
ZoomManager.reduce();
|
2007-06-19 11:58:14 -07:00
|
|
|
this._applySettingToPref();
|
|
|
|
},
|
|
|
|
|
2007-11-26 00:35:22 -08:00
|
|
|
enlarge: function FullZoom_enlarge() {
|
2007-10-25 16:02:20 -07:00
|
|
|
ZoomManager.enlarge();
|
2007-06-19 11:58:14 -07:00
|
|
|
this._applySettingToPref();
|
|
|
|
},
|
|
|
|
|
2007-11-26 00:35:22 -08:00
|
|
|
reset: function FullZoom_reset() {
|
2007-06-19 11:58:14 -07:00
|
|
|
if (typeof this.globalValue != "undefined")
|
2008-02-13 03:00:45 -08:00
|
|
|
ZoomManager.zoom = this.globalValue;
|
2007-06-19 11:58:14 -07:00
|
|
|
else
|
2007-10-25 16:02:20 -07:00
|
|
|
ZoomManager.reset();
|
2007-06-19 11:58:14 -07:00
|
|
|
|
|
|
|
this._removePref();
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
2007-10-25 16:02:20 -07:00
|
|
|
* Set the zoom level for the current tab.
|
2007-06-19 11:58:14 -07:00
|
|
|
*
|
2007-11-26 00:35:22 -08:00
|
|
|
* Per nsPresContext::setFullZoom, we can set the zoom to its current value
|
|
|
|
* without significant impact on performance, as the setting is only applied
|
|
|
|
* if it differs from the current setting. In fact getting the zoom and then
|
|
|
|
* checking ourselves if it differs costs more.
|
|
|
|
*
|
|
|
|
* And perhaps we should always set the zoom even if it was more expensive,
|
2012-11-28 16:26:39 -08:00
|
|
|
* since nsDocumentViewer::SetTextZoom claims that child documents can have
|
2007-11-26 00:35:22 -08:00
|
|
|
* a different text zoom (although it would be unusual), and it implies that
|
|
|
|
* those child text zooms should get updated when the parent zoom gets set,
|
|
|
|
* and perhaps the same is true for full zoom
|
2012-11-28 16:26:39 -08:00
|
|
|
* (although nsDocumentViewer::SetFullZoom doesn't mention it).
|
2007-06-19 11:58:14 -07:00
|
|
|
*
|
|
|
|
* So when we apply new zoom values to the browser, we simply set the zoom.
|
|
|
|
* We don't check first to see if the new value is the same as the current
|
|
|
|
* one.
|
|
|
|
**/
|
2009-01-12 12:15:27 -08:00
|
|
|
_applyPrefToSetting: function FullZoom__applyPrefToSetting(aValue, aBrowser) {
|
bug 679784: let nsIContentPrefService handle private browsing mode; r=ehsan
Manage private browsing mode in content pref service. CPS should be available
in private browsing mode, but should not store informations on disk, and should
clear all informations once the private session ends.
When setting a pref in private mode, it is stored in an in-memory hash table.
When getting a pref, it is retrieved from that hash table if available.
Otherwise, it is retrieved using the standard mechanism. When removing a pref,
it is retrieved from the hash table. The rationale is that in private mode,
it's ok to read a pref from normal database, but not ok to set it.
The in-memory hash table is cleared when leaving the private browsing mode.
When removing a set of preferences (with removeGroupedPrefs or
removePrefsByName), preferences are removed from the in-memory hashtable, *and*
from normal mode database. The rationale is that visiting a website may trigger
setting/getting/removing for a specific preference only. But removing many
prefs at once is the result of an action not associated with a website. For
example, user may wish to delete all its informations. In that case, user
probably expects to not have those informations restored once it leaves private
browsing mode.
2011-09-01 11:13:03 -07:00
|
|
|
if ((!this.siteSpecific) || gInPrintPreviewMode)
|
2009-09-09 13:04:05 -07:00
|
|
|
return;
|
2007-11-09 02:19:12 -08:00
|
|
|
|
2010-03-25 03:52:21 -07:00
|
|
|
var browser = aBrowser || (gBrowser && gBrowser.selectedBrowser);
|
2007-06-19 11:58:14 -07:00
|
|
|
try {
|
2012-01-20 11:43:24 -08:00
|
|
|
if (browser.contentDocument.mozSyntheticDocument)
|
2012-01-18 16:01:19 -08:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (typeof aValue != "undefined")
|
2009-03-07 22:42:54 -08:00
|
|
|
ZoomManager.setZoomForBrowser(browser, this._ensureValid(aValue));
|
2007-06-19 11:58:14 -07:00
|
|
|
else if (typeof this.globalValue != "undefined")
|
2009-03-07 22:42:54 -08:00
|
|
|
ZoomManager.setZoomForBrowser(browser, this.globalValue);
|
2007-06-19 11:58:14 -07:00
|
|
|
else
|
2009-03-07 22:42:54 -08:00
|
|
|
ZoomManager.setZoomForBrowser(browser, 1);
|
2007-06-19 11:58:14 -07:00
|
|
|
}
|
|
|
|
catch(ex) {}
|
|
|
|
},
|
|
|
|
|
2007-11-26 00:35:22 -08:00
|
|
|
_applySettingToPref: function FullZoom__applySettingToPref() {
|
2008-12-08 04:47:42 -08:00
|
|
|
if (!this.siteSpecific || gInPrintPreviewMode ||
|
2012-01-20 11:43:24 -08:00
|
|
|
content.document.mozSyntheticDocument)
|
2007-11-09 02:19:12 -08:00
|
|
|
return;
|
|
|
|
|
2008-02-13 03:00:45 -08:00
|
|
|
var zoomLevel = ZoomManager.zoom;
|
2012-06-30 07:50:07 -07:00
|
|
|
getContentPrefs(gBrowser.contentDocument.defaultView).setPref(gBrowser.currentURI, this.name, zoomLevel);
|
2007-06-19 11:58:14 -07:00
|
|
|
},
|
|
|
|
|
2007-11-26 00:35:22 -08:00
|
|
|
_removePref: function FullZoom__removePref() {
|
2012-01-20 11:43:24 -08:00
|
|
|
if (!(content.document.mozSyntheticDocument))
|
2012-06-30 07:50:07 -07:00
|
|
|
getContentPrefs(gBrowser.contentDocument.defaultView).removePref(gBrowser.currentURI, this.name);
|
2007-06-19 11:58:14 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//**************************************************************************//
|
|
|
|
// Utilities
|
|
|
|
|
2007-11-26 00:35:22 -08:00
|
|
|
_ensureValid: function FullZoom__ensureValid(aValue) {
|
2007-06-19 11:58:14 -07:00
|
|
|
if (isNaN(aValue))
|
2007-10-25 16:02:20 -07:00
|
|
|
return 1;
|
2007-06-19 11:58:14 -07:00
|
|
|
|
2007-10-25 16:02:20 -07:00
|
|
|
if (aValue < ZoomManager.MIN)
|
|
|
|
return ZoomManager.MIN;
|
2007-06-19 11:58:14 -07:00
|
|
|
|
2007-10-25 16:02:20 -07:00
|
|
|
if (aValue > ZoomManager.MAX)
|
|
|
|
return ZoomManager.MAX;
|
2007-06-19 11:58:14 -07:00
|
|
|
|
|
|
|
return aValue;
|
|
|
|
}
|
|
|
|
};
|