Bug 1352069 - Introduce a pref that allows for disabling cosmetic animations r=jaws

This rolls browser.tabs.animate, browser.fullscreen.animate, and
alerts.disableSlidingEffect into a single pref; if any of these are disabled,
we'll disable the new pref too (toolkit.cosmeticAnimations.enabled). Most
future animations will also be subject to this pref.

MozReview-Commit-ID: 77pLMtERDna

--HG--
extra : rebase_source : 8939e453c2277caa4a90123ae09bb542aaa421ed
This commit is contained in:
Jim Porter 2017-04-11 13:47:31 -05:00
parent c66c159ddb
commit 3517459260
15 changed files with 38 additions and 26 deletions

View File

@ -254,7 +254,6 @@ pref("browser.warnOnQuit", true);
// might still show the window closing dialog with showQuitWarning == false.
pref("browser.showQuitWarning", false);
pref("browser.fullscreen.autohide", true);
pref("browser.fullscreen.animate", true);
pref("browser.overlink-delay", 80);
#ifdef UNIX_BUT_NOT_MAC
@ -444,7 +443,6 @@ pref("browser.tabs.opentabfor.middleclick", true);
pref("browser.tabs.loadDivertedInBackground", false);
pref("browser.tabs.loadBookmarksInBackground", false);
pref("browser.tabs.tabClipWidth", 140);
pref("browser.tabs.animate", true);
#ifdef UNIX_BUT_NOT_MAC
pref("browser.tabs.drawInTitlebar", false);
#else

View File

@ -593,7 +593,7 @@ var FullScreen = {
this._fullScrToggler.hidden = false;
if (aAnimate && gPrefService.getBoolPref("browser.fullscreen.animate")) {
if (aAnimate && gPrefService.getBoolPref("toolkit.cosmeticAnimations.enabled")) {
gNavToolbox.setAttribute("fullscreenShouldAnimate", true);
// Hide the fullscreen toggler until the transition ends.
let listener = () => {

View File

@ -2253,7 +2253,7 @@
// transition in that case.
let animate = !aSkipAnimation &&
this.tabContainer.getAttribute("overflow") != "true" &&
Services.prefs.getBoolPref("browser.tabs.animate");
Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled");
if (!animate) {
t.setAttribute("fadein", "true");
setTimeout(function(tabContainer) {
@ -2585,7 +2585,7 @@
this._removingTabs.length > 3 /* don't want lots of concurrent animations */ ||
aTab.getAttribute("fadein") != "true" /* fade-in transition hasn't been triggered yet */ ||
window.getComputedStyle(aTab).maxWidth == "0.1px" /* fade-in transition hasn't moved yet */ ||
!Services.prefs.getBoolPref("browser.tabs.animate")) {
!Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled")) {
// We're not animating, so we can cancel the animation stopwatch.
TelemetryStopwatch.cancel("FX_TAB_CLOSE_TIME_ANIM_MS", aTab);
this._endRemoveTab(aTab);

View File

@ -3,9 +3,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function test() {
Services.prefs.setBoolPref("browser.tabs.animate", false);
Services.prefs.setBoolPref("toolkit.cosmeticAnimations.enabled", false);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.tabs.animate");
Services.prefs.clearUserPref("toolkit.cosmeticAnimations.enabled");
});
// Open 2 other tabs, and pin the second one. Like that, the initial tab

View File

@ -13,7 +13,7 @@ add_task(function* test() {
let tab3 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, testPage3);
// Kill the animation for simpler test.
Services.prefs.setBoolPref("browser.tabs.animate", false);
Services.prefs.setBoolPref("toolkit.cosmeticAnimations.enabled", false);
gBrowser.selectedTab = tab1;
browser1.focus();
@ -152,5 +152,5 @@ add_task(function* test() {
gBrowser.removeCurrentTab();
}
Services.prefs.clearUserPref("browser.tabs.animate");
Services.prefs.clearUserPref("toolkit.cosmeticAnimations.enabled");
});

View File

@ -1568,7 +1568,7 @@ BrowserGlue.prototype = {
},
_migrateUI: function BG__migrateUI() {
const UI_VERSION = 43;
const UI_VERSION = 44;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
let currentUIVersion;
@ -1848,6 +1848,20 @@ BrowserGlue.prototype = {
}
}
if (currentUIVersion < 44) {
// Merge the various cosmetic animation prefs into one. If any were set to
// disable animations, we'll disabled cosmetic animations entirely.
let animate = Services.prefs.getBoolPref("browser.tabs.animate", true) &&
Services.prefs.getBoolPref("browser.fullscreen.animate", true) &&
!Services.prefs.getBoolPref("alerts.disableSlidingEffect", false);
Services.prefs.setBoolPref("toolkit.cosmeticAnimations.enabled", animate);
Services.prefs.clearUserPref("browser.tabs.animate");
Services.prefs.clearUserPref("browser.fullscreen.animate");
Services.prefs.clearUserPref("browser.tabs.animate");
}
// Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},

View File

@ -16,7 +16,7 @@ const PAGE_2 = "data:text/html,<html><body>Another%20regular,%20everyday,%20norm
add_task(function* test_initialize() {
yield SpecialPowers.pushPrefEnv({
set: [
[ "browser.tabs.animate", false]
[ "toolkit.cosmeticAnimations.enabled", false]
] });
});

View File

@ -14,7 +14,7 @@ const PAGE_2 = "data:text/html,<html><body>Another%20regular,%20everyday,%20norm
add_task(function* setup() {
yield pushPrefs(["dom.ipc.processCount", 1],
["browser.tabs.animate", false],
["toolkit.cosmeticAnimations.enabled", false],
["browser.sessionstore.restore_on_demand", false]);
});

View File

@ -13,9 +13,9 @@ add_task(function* () {
"<p>hello world";
let firstTab = gBrowser.selectedTab;
Services.prefs.setBoolPref("browser.tabs.animate", false);
Services.prefs.setBoolPref("toolkit.cosmeticAnimations.enabled", false);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("browser.tabs.animate");
Services.prefs.clearUserPref("toolkit.cosmeticAnimations.enabled");
});
yield loadTab(TEST_URI);

View File

@ -946,6 +946,8 @@ pref("toolkit.autocomplete.richBoundaryCutoff", 200);
// Variable controlling logging for osfile.
pref("toolkit.osfile.log", false);
pref("toolkit.cosmeticAnimations.enabled", true);
pref("toolkit.scrollbox.smoothScroll", true);
pref("toolkit.scrollbox.scrollIncrement", 20);
pref("toolkit.scrollbox.verticalScrollDistance", 3);
@ -4820,8 +4822,6 @@ pref("dom.webnotifications.requireinteraction.enabled", true);
pref("dom.webnotifications.requireinteraction.enabled", false);
#endif
// Alert animation effect, name is disableSlidingEffect for backwards-compat.
pref("alerts.disableSlidingEffect", false);
// Show favicons in web notifications.
pref("alerts.showFavicons", false);

View File

@ -458,8 +458,8 @@ class DesktopInstance(GeckoInstance):
# Start with a blank page by default
"browser.startup.page": 0,
# Disable tab animation
"browser.tabs.animate": False,
# Disable browser animations
"toolkit.cosmeticAnimations.enabled": False,
# Do not warn on exit when multiple tabs are open
"browser.tabs.warnOnClose": False,

View File

@ -126,8 +126,8 @@ const RECOMMENDED_PREFS = new Map([
// Do not redirect user when a milstone upgrade of Firefox is detected
["browser.startup.homepage_override.mstone", "ignore"],
// Disable tab animation
["browser.tabs.animate", false],
// Disable browser animations
["toolkit.cosmeticAnimations.enabled", false],
// Do not allow background tabs to be zombified, otherwise for tests
// that open additional tabs, the test harness tab itself might get

View File

@ -26,7 +26,7 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource:///modules/RecentWindow.jsm");
const TAB_ANIMATION_PREF = "browser.tabs.animate";
const ANIMATION_PREF = "toolkit.cosmeticAnimations.enabled";
const PROCESS_COUNT_PREF = "dom.ipc.processCount";
@ -70,8 +70,8 @@ var TabPaint = {
Services.mm.addMessageListener(msgName, this);
}
this.originalTabsAnimate = Services.prefs.getBoolPref(TAB_ANIMATION_PREF);
Services.prefs.setBoolPref(TAB_ANIMATION_PREF, false);
this.originalAnimate = Services.prefs.getBoolPref(ANIMATION_PREF);
Services.prefs.setBoolPref(ANIMATION_PREF, false);
this.originalProcessCount = Services.prefs.getIntPref(PROCESS_COUNT_PREF);
Services.prefs.setIntPref(PROCESS_COUNT_PREF, 1);
},
@ -81,7 +81,7 @@ var TabPaint = {
Services.mm.removeMessageListener(msgName, this);
}
Services.prefs.setBoolPref(TAB_ANIMATION_PREF, this.originalTabsAnimate);
Services.prefs.setBoolPref(ANIMATION_PREF, this.originalAnimate);
Services.prefs.setIntPref(PROCESS_COUNT_PREF, this.originalProcessCount);
},

View File

@ -169,7 +169,7 @@ function onAlertLoad() {
// If the require interaction flag is set, prevent auto-closing the notification.
if (!gRequireInteraction) {
if (Services.prefs.getBoolPref("alerts.disableSlidingEffect")) {
if (!Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled")) {
setTimeout(function() { window.close(); }, ALERT_DURATION_IMMEDIATE);
} else {
let alertBox = document.getElementById("alertBox");

View File

@ -178,7 +178,7 @@ const DEFAULT_ENVIRONMENT_PREFS = new Map([
["browser.search.suggest.enabled", {what: RECORD_PREF_VALUE}],
["browser.startup.homepage", {what: RECORD_PREF_STATE}],
["browser.startup.page", {what: RECORD_PREF_VALUE}],
["browser.tabs.animate", {what: RECORD_PREF_VALUE}],
["toolkit.cosmeticAnimations.enabled", {what: RECORD_PREF_VALUE}],
["browser.urlbar.suggest.searches", {what: RECORD_PREF_VALUE}],
["browser.urlbar.userMadeSearchSuggestionsChoice", {what: RECORD_PREF_VALUE}],
["devtools.chrome.enabled", {what: RECORD_PREF_VALUE}],