Bug 416661 - Site specific zoom level shouldn't apply to image documents, r=gavin ui-r=faaborg

This commit is contained in:
Nochum Sossonko 2008-12-08 13:47:42 +01:00
parent 8f3afbc633
commit 9cfc9f9eb3
4 changed files with 68 additions and 3 deletions

View File

@ -287,7 +287,8 @@ var FullZoom = {
* one.
**/
_applyPrefToSetting: function FullZoom__applyPrefToSetting(aValue) {
if (!this.siteSpecific || gInPrintPreviewMode)
if (!this.siteSpecific || gInPrintPreviewMode ||
content.document instanceof Ci.nsIImageDocument)
return;
try {
@ -302,7 +303,8 @@ var FullZoom = {
},
_applySettingToPref: function FullZoom__applySettingToPref() {
if (!this.siteSpecific || gInPrintPreviewMode)
if (!this.siteSpecific || gInPrintPreviewMode ||
content.document instanceof Ci.nsIImageDocument)
return;
var zoomLevel = ZoomManager.zoom;
@ -310,7 +312,8 @@ var FullZoom = {
},
_removePref: function FullZoom__removePref() {
this._cps.removePref(gBrowser.currentURI, this.name);
if (!(content.document instanceof Ci.nsIImageDocument))
this._cps.removePref(gBrowser.currentURI, this.name);
},

View File

@ -80,6 +80,8 @@ _BROWSER_FILES = browser_bug321000.js \
plugin_both2.html \
browser_alltabslistener.js \
alltabslistener.html \
zoom_test.html \
browser_bug416661.js \
$(NULL)
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))

View File

@ -0,0 +1,46 @@
var tabElm, zoomLevel;
function start_test_prefNotSet() {
tabElm.linkedBrowser.removeEventListener("load", start_test_prefNotSet, true);
tabElm.linkedBrowser.addEventListener("load", continue_test_prefNotSet, true);
is(ZoomManager.zoom, 1, "initial zoom level should be 1");
FullZoom.enlarge();
//capture the zoom level to test later
zoomLevel = ZoomManager.zoom;
isnot(zoomLevel, 1, "zoom level should have changed");
content.location =
"http://localhost:8888/browser/browser/base/content/test/moz.png";
}
function continue_test_prefNotSet () {
tabElm.linkedBrowser.removeEventListener("load", continue_test_prefNotSet, true);
tabElm.linkedBrowser.addEventListener("load", end_test_prefNotSet, true);
is(ZoomManager.zoom, 1, "zoom level pref should not apply to an image");
FullZoom.reset();
content.location =
"http://localhost:8888/browser/browser/base/content/test/zoom_test.html";
}
function end_test_prefNotSet() {
is(ZoomManager.zoom, zoomLevel, "the zoom level should have persisted");
gBrowser.removeCurrentTab();
finish();
}
function test() {
waitForExplicitFinish();
tabElm = gBrowser.addTab();
gBrowser.selectedTab = tabElm;
tabElm.linkedBrowser.addEventListener("load", start_test_prefNotSet, true);
content.location =
"http://localhost:8888/browser/browser/base/content/test/zoom_test.html";
}

View File

@ -0,0 +1,14 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=416661
-->
<head>
<title>Test for zoom setting</title>
</head>
<body>
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=416661">Bug 416661</a>
<p>Site specific zoom settings should not apply to image documents.</p>
</body>
</html>