Backed out changeset dad84422bcfc (bug 1300376)

This commit is contained in:
Dão Gottwald 2016-11-03 11:55:04 +01:00
parent 05eb5322dd
commit 8ed8f8e276
2 changed files with 37 additions and 45 deletions

View File

@ -50,7 +50,6 @@ Cu.import("resource://gre/modules/NotificationDB.jsm");
["TelemetryStopwatch", "resource://gre/modules/TelemetryStopwatch.jsm"],
["Translation", "resource:///modules/translation/Translation.jsm"],
["UITour", "resource:///modules/UITour.jsm"],
["URLBarZoom", "resource:///modules/URLBarZoom.jsm"],
["UpdateUtils", "resource://gre/modules/UpdateUtils.jsm"],
["Weave", "resource://services-sync/main.js"],
["fxAccounts", "resource://gre/modules/FxAccounts.jsm"],
@ -4448,13 +4447,16 @@ var XULBrowserWindow = {
}
URLBarSetURI(aLocationURI);
BookmarkingUI.onLocationChange();
gIdentityHandler.onLocationChange();
SocialUI.updateState();
UITour.onLocationChange(location);
gTabletModePageCounter.inc();
ReaderParent.updateReaderButton(gBrowser.selectedBrowser);
URLBarZoom.updateZoomButton(gBrowser.selectedBrowser, "browser-fullZoom:location-change");
// Utility functions for disabling find
var shouldDisableFind = function shouldDisableFind(aDocument) {
@ -4508,6 +4510,7 @@ var XULBrowserWindow = {
}
}
UpdateBackForwardCommands(gBrowser.webNavigation);
ReaderParent.updateReaderButton(gBrowser.selectedBrowser);
gGestureSupport.restoreRotationState();

View File

@ -11,52 +11,41 @@ Components.utils.import("resource://gre/modules/Services.jsm");
var URLBarZoom = {
init(aWindow) {
init: function(aWindow) {
// Register ourselves with the service so we know when the zoom prefs change.
Services.obs.addObserver(this, "browser-fullZoom:zoomChange", false);
Services.obs.addObserver(this, "browser-fullZoom:zoomReset", false);
Services.obs.addObserver(this, "browser-fullZoom:location-change", false);
Services.obs.addObserver(updateZoomButton, "browser-fullZoom:zoomChange", false);
Services.obs.addObserver(updateZoomButton, "browser-fullZoom:zoomReset", false);
Services.obs.addObserver(updateZoomButton, "browser-fullZoom:location-change", false);
},
}
observe(aSubject, aTopic) {
this.updateZoomButton(aSubject, aTopic);
},
function updateZoomButton(aSubject, aTopic) {
let win = aSubject.ownerDocument.defaultView;
let customizableZoomControls = win.document.getElementById("zoom-controls");
let zoomResetButton = win.document.getElementById("urlbar-zoom-button");
let zoomFactor = Math.round(win.ZoomManager.zoom * 100);
updateZoomButton(aSubject, aTopic) {
// aSubject.ownerGlobal may no longer exist if a tab has been dragged to a
// new window. In this case, aSubject.ownerGlobal will be supplied by
// updateZoomButton() called in XULBrowserWindow.onLocationChange().
if (!aSubject.ownerGlobal) {
return;
// Ensure that zoom controls haven't already been added to browser in Customize Mode
if (customizableZoomControls &&
customizableZoomControls.getAttribute("cui-areatype") == "toolbar") {
zoomResetButton.hidden = true;
return;
}
if (zoomFactor != 100) {
// Check if zoom button is visible and update label if it is
if (zoomResetButton.hidden) {
zoomResetButton.hidden = false;
}
let win = aSubject.ownerGlobal;
let customizableZoomControls = win.document.getElementById("zoom-controls");
let zoomResetButton = win.document.getElementById("urlbar-zoom-button");
let zoomFactor = Math.round(win.ZoomManager.zoom * 100);
// Ensure that zoom controls haven't already been added to browser in Customize Mode
if (customizableZoomControls &&
customizableZoomControls.getAttribute("cui-areatype") == "toolbar") {
zoomResetButton.hidden = true;
return;
}
if (zoomFactor != 100) {
// Check if zoom button is visible and update label if it is
if (zoomResetButton.hidden) {
zoomResetButton.hidden = false;
}
// Only allow pulse animation for zoom changes, not tab switching
if (aTopic != "browser-fullZoom:location-change") {
zoomResetButton.setAttribute("animate", "true");
} else {
zoomResetButton.removeAttribute("animate");
}
zoomResetButton.setAttribute("label",
win.gNavigatorBundle.getFormattedString("urlbar-zoom-button.label", [zoomFactor]));
// Only allow pulse animation for zoom changes, not tab switching
if (aTopic != "browser-fullZoom:location-change") {
zoomResetButton.setAttribute("animate", "true");
} else {
// Hide button if zoom is at 100%
zoomResetButton.hidden = true;
zoomResetButton.removeAttribute("animate");
}
},
};
zoomResetButton.setAttribute("label",
win.gNavigatorBundle.getFormattedString("urlbar-zoom-button.label", [zoomFactor]));
// Hide button if zoom is at 100%
} else {
zoomResetButton.hidden = true;
}
}