Bug 1622111 - Convert dom.animations.offscreen-throttling to static pref. r=njn

Converts dom.animations.offscreen-throttling to a static pref and removes the static function used to create the varcache pref.

Differential Revision: https://phabricator.services.mozilla.com/D67182

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kristen Wright 2020-03-18 20:46:07 +00:00
Родитель 08d2b6aa6d
Коммит e29d6cd395
5 изменённых файлов: 7 добавлений и 24 удалений

Просмотреть файл

@ -9,7 +9,6 @@
#include "mozilla/dom/Document.h"
#include "mozilla/dom/KeyframeEffect.h"
#include "mozilla/EffectSet.h"
#include "mozilla/Preferences.h"
#include "nsDebug.h"
#include "nsAtom.h"
#include "nsIContent.h"
@ -58,20 +57,6 @@ Document* AnimationUtils::GetDocumentFromGlobal(JSObject* aGlobalObject) {
return win->GetDoc();
}
/* static */
bool AnimationUtils::IsOffscreenThrottlingEnabled() {
static bool sOffscreenThrottlingEnabled;
static bool sPrefCached = false;
if (!sPrefCached) {
sPrefCached = true;
Preferences::AddBoolVarCache(&sOffscreenThrottlingEnabled,
"dom.animations.offscreen-throttling");
}
return sOffscreenThrottlingEnabled;
}
/* static */
bool AnimationUtils::FrameHasAnimatedScale(const nsIFrame* aFrame) {
EffectSet* effectSet = EffectSet::GetEffectSetForFrame(

Просмотреть файл

@ -73,11 +73,6 @@ class AnimationUtils {
*/
static Document* GetDocumentFromGlobal(JSObject* aGlobalObject);
/**
* Checks if offscreen animation throttling is enabled.
*/
static bool IsOffscreenThrottlingEnabled();
/**
* Returns true if the given frame has an animated scale.
*/

Просмотреть файл

@ -1838,7 +1838,7 @@ void KeyframeEffect::SetAnimation(Animation* aAnimation) {
}
bool KeyframeEffect::CanIgnoreIfNotVisible() const {
if (!AnimationUtils::IsOffscreenThrottlingEnabled()) {
if (StaticPrefs::dom_animations_offscreen_throttling()) {
return false;
}

Просмотреть файл

@ -1329,6 +1329,12 @@
value: false
mirror: always
# Checks if offscreen animation throttling is enabled.
- name: dom.animations.offscreen-throttling
type: bool
value: true
mirror: always
# Is support for automatically removing replaced filling animations enabled?
- name: dom.animations-api.autoremove.enabled
type: bool

Просмотреть файл

@ -2583,9 +2583,6 @@ pref("layout.testing.overlay-scrollbars.always-visible", false);
// pref to control whether layout warnings that are hit quite often are enabled
pref("layout.spammy_warnings.enabled", false);
// Pref to throttle offsreen animations
pref("dom.animations.offscreen-throttling", true);
// if true, allow plug-ins to override internal imglib decoder mime types in full-page mode
pref("plugin.override_internal_types", false);