[Bug 875204] Merge OMTA prefs r=nrc

This commit is contained in:
David Zbarsky 2013-05-23 15:09:26 +08:00
parent 631b94994d
commit c2366b46a1
5 changed files with 22 additions and 60 deletions

View File

@ -237,15 +237,13 @@ pref("ui.dragThresholdY", 25);
#ifndef MOZ_WIDGET_GONK
pref("dom.ipc.tabs.disabled", true);
pref("layers.offmainthreadcomposition.enabled", false);
pref("layers.offmainthreadcomposition.animate-opacity", false);
pref("layers.offmainthreadcomposition.animate-transform", false);
pref("layers.offmainthreadcomposition.async-animations", false);
pref("layers.async-video.enabled", false);
#else
pref("dom.ipc.tabs.disabled", false);
pref("layers.offmainthreadcomposition.enabled", true);
pref("layers.acceleration.disabled", false);
pref("layers.offmainthreadcomposition.animate-opacity", true);
pref("layers.offmainthreadcomposition.animate-transform", true);
pref("layers.offmainthreadcomposition.async-animations", true);
pref("layers.async-video.enabled", true);
pref("layers.async-pan-zoom.enabled", true);
#endif

View File

@ -321,42 +321,20 @@ nsLayoutUtils::Are3DTransformsEnabled()
return s3DTransformsEnabled;
}
bool
nsLayoutUtils::AreOpacityAnimationsEnabled()
{
static bool sAreOpacityAnimationsEnabled;
static bool sOpacityPrefCached = false;
if (!sOpacityPrefCached) {
sOpacityPrefCached = true;
Preferences::AddBoolVarCache(&sAreOpacityAnimationsEnabled,
"layers.offmainthreadcomposition.animate-opacity");
}
return sAreOpacityAnimationsEnabled &&
gfxPlatform::OffMainThreadCompositingEnabled();
}
bool
nsLayoutUtils::AreTransformAnimationsEnabled()
{
static bool sAreTransformAnimationsEnabled;
static bool sTransformPrefCached = false;
if (!sTransformPrefCached) {
sTransformPrefCached = true;
Preferences::AddBoolVarCache(&sAreTransformAnimationsEnabled,
"layers.offmainthreadcomposition.animate-transform");
}
return sAreTransformAnimationsEnabled &&
gfxPlatform::OffMainThreadCompositingEnabled();
}
bool
nsLayoutUtils::AreAsyncAnimationsEnabled()
{
return AreOpacityAnimationsEnabled() || AreTransformAnimationsEnabled();
static bool sAreAsyncAnimationsEnabled;
static bool sAsyncPrefCached = false;
if (!sAsyncPrefCached) {
sAsyncPrefCached = true;
Preferences::AddBoolVarCache(&sAreAsyncAnimationsEnabled,
"layers.offmainthreadcomposition.async-animations");
}
return sAreAsyncAnimationsEnabled &&
gfxPlatform::OffMainThreadCompositingEnabled();
}
bool

View File

@ -1586,10 +1586,8 @@ public:
static bool Are3DTransformsEnabled();
/**
* Checks if off-main-thread transform and opacity animations are enabled.
* Checks if off-main-thread animations are enabled.
*/
static bool AreOpacityAnimationsEnabled();
static bool AreTransformAnimationsEnabled();
static bool AreAsyncAnimationsEnabled();
/**

View File

@ -271,15 +271,6 @@ CommonElementAnimationData::CanAnimatePropertyOnCompositor(const dom::Element *a
}
return false;
}
if (aProperty == eCSSProperty_opacity) {
bool enabled = nsLayoutUtils::AreOpacityAnimationsEnabled();
if (!enabled && shouldLog) {
nsCString message;
message.AppendLiteral("Performance warning: Async animation of 'opacity' is disabled");
LogAsyncAnimationFailure(message);
}
return enabled;
}
if (aProperty == eCSSProperty_transform) {
if (frame->Preserves3D() &&
frame->Preserves3DChildren()) {
@ -306,15 +297,14 @@ CommonElementAnimationData::CanAnimatePropertyOnCompositor(const dom::Element *a
}
return false;
}
bool enabled = nsLayoutUtils::AreTransformAnimationsEnabled();
if (!enabled && shouldLog) {
nsCString message;
message.AppendLiteral("Performance warning: Async animation of 'transform' is disabled");
LogAsyncAnimationFailure(message);
}
return enabled;
}
return aFlags & CanAnimate_AllowPartial;
bool enabled = nsLayoutUtils::AreAsyncAnimationsEnabled();
if (!enabled && shouldLog) {
nsCString message;
message.AppendLiteral("Performance warning: Async animations are disabled");
LogAsyncAnimationFailure(message);
}
return enabled && (aFlags & CanAnimate_AllowPartial);
}
/* static */ void

View File

@ -3989,9 +3989,7 @@ pref("layers.offmainthreadcomposition.enabled", false);
// use with tests.
pref("layers.offmainthreadcomposition.testing.enabled", false);
// Whether to animate simple opacity and transforms on the compositor
pref("layers.offmainthreadcomposition.animate-opacity", false);
pref("layers.offmainthreadcomposition.animate-transform", false);
pref("layers.offmainthreadcomposition.log-animations", false);
pref("layers.offmainthreadcomposition.async-animations", false);
#ifdef MOZ_X11
#ifdef MOZ_WIDGET_GTK2