Bug 947753 / Bug 1122526 - Don't claim to support off-main-thread animations when the nearest widget is not using OMT compositing. r=birtles

This moves the test for whether off-main-thread compositor is enabled
*earlier* in CanPerformOnCompositorThread, since
CanAnimatePropertyOnCompositor is called only from
CanPerformOnCompositorThread.  This change means we're using a more
accurate test for whether we actually have off-main-thread compositing
than the pref, since in some cases we won't use off-main-thread
compositing for certain widgets (e.g., transparent widgets on Windows)
even when the pref is enabled.
This commit is contained in:
L. David Baron 2015-04-16 18:36:29 -07:00
Родитель f3dd0c4c42
Коммит c83c61bfca
1 изменённых файлов: 13 добавлений и 9 удалений

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

@ -511,15 +511,6 @@ AnimationPlayerCollection::CanAnimatePropertyOnCompositor(
CanAnimateFlags aFlags)
{
bool shouldLog = nsLayoutUtils::IsAnimationLoggingEnabled();
if (!gfxPlatform::OffMainThreadCompositingEnabled()) {
if (shouldLog) {
nsCString message;
message.AppendLiteral("Performance warning: Compositor disabled");
LogAsyncAnimationFailure(message);
}
return false;
}
nsIFrame* frame = nsLayoutUtils::GetStyleFrame(aElement);
if (IsGeometricProperty(aProperty)) {
if (shouldLog) {
@ -587,6 +578,19 @@ AnimationPlayerCollection::CanPerformOnCompositorThread(
return false;
}
nsIWidget* widget = frame->GetNearestWidget();
if (!widget ||
widget->GetLayerManager()->GetBackendType() !=
layers::LayersBackend::LAYERS_CLIENT) {
// No widget (huh?), or a widget not using off-main-thread compositor.
if (nsLayoutUtils::IsAnimationLoggingEnabled()) {
nsCString message;
message.AppendLiteral("Performance warning: Compositor disabled");
LogAsyncAnimationFailure(message);
}
return false;
}
if (mElementProperty != nsGkAtoms::transitionsProperty &&
mElementProperty != nsGkAtoms::animationsProperty) {
if (nsLayoutUtils::IsAnimationLoggingEnabled()) {