Bug 707571 (part 5) - Add a hidden pref to ignore user-scalable=no [r=mfinkle]

This commit is contained in:
Matt Brubeck 2012-05-18 08:24:27 -07:00
parent dd1a410b01
commit 7dce3aecfa
2 changed files with 12 additions and 12 deletions

View File

@ -445,20 +445,10 @@ pref("dom.max_script_run_time", 20);
// JS error console
pref("devtools.errorconsole.enabled", false);
pref("browser.ui.layout.tablet", -1); // on: 1, off: 0, auto: -1
// kinetic tweakables
pref("browser.ui.kinetic.updateInterval", 16);
pref("browser.ui.kinetic.exponentialC", 1400);
pref("browser.ui.kinetic.polynomialC", 100);
pref("browser.ui.kinetic.swipeLength", 160);
pref("font.size.inflation.minTwips", 120);
// pinch gesture
pref("browser.ui.pinch.maxGrowth", 150); // max pinch distance growth
pref("browser.ui.pinch.maxShrink", 200); // max pinch distance shrinkage
pref("browser.ui.pinch.scalingFactor", 500); // scaling factor for above pinch limits
// When true, zooming will be enabled on all sites, even ones that declare user-scalable=no.
pref("browser.ui.zoom.force-user-scalable", false);
// Touch radius (area around the touch location to look for target elements),
// in 1/240-inch pixels:

View File

@ -1616,6 +1616,7 @@ Tab.prototype = {
this.browser.addEventListener("pageshow", this, true);
Services.obs.addObserver(this, "before-first-paint", false);
Services.prefs.addObserver("browser.ui.zoom.force-user-scalable", this, false);
if (!aParams.delayLoad) {
let flags = "flags" in aParams ? aParams.flags : Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
@ -1660,6 +1661,7 @@ Tab.prototype = {
this.browser.removeEventListener("MozScrolledAreaChanged", this, true);
Services.obs.removeObserver(this, "before-first-paint");
Services.prefs.removeObserver("browser.ui.zoom.force-user-scalable", this);
// Make sure the previously selected panel remains selected. The selected panel of a deck is
// not stable when panels are removed.
@ -2350,6 +2352,10 @@ Tab.prototype = {
/** Update viewport when the metadata changes. */
updateViewportMetadata: function updateViewportMetadata(aMetadata) {
if (Services.prefs.getBoolPref("browser.ui.zoom.force-user-scalable")) {
aMetadata.allowZoom = true;
aMetadata.minZoom = aMetadata.maxZoom = NaN;
}
if (aMetadata && aMetadata.autoScale) {
let scaleRatio = aMetadata.scaleRatio = ViewportHandler.getScaleRatio();
@ -2545,6 +2551,10 @@ Tab.prototype = {
this.contentDocumentIsDisplayed = true;
}
break;
case "nsPref:changed":
if (aData == "browser.ui.zoom.force-user-scalable")
ViewportHandler.updateMetadata(this);
break;
}
},