Bug 768440 Part 2: Animate CSS Transitions on the compositor r=roc,dbaron

This commit is contained in:
David Zbarsky
2012-07-31 10:28:22 -07:00
parent c1125ae35c
commit 6a56e516b5
8 changed files with 261 additions and 124 deletions

View File

@@ -83,6 +83,8 @@
#endif
#include "sampler.h"
#include "nsAnimationManager.h"
#include "nsTransitionManager.h"
using namespace mozilla;
using namespace mozilla::layers;
@@ -113,6 +115,32 @@ static ContentMap& GetContentMap() {
return *sContentMap;
}
bool
nsLayoutUtils::HasAnimationsForCompositor(nsIContent* aContent,
nsCSSProperty aProperty)
{
if (!aContent->MayHaveAnimations())
return false;
ElementAnimations* animations =
static_cast<ElementAnimations*>(aContent->GetProperty(nsGkAtoms::animationsProperty));
if (animations) {
bool propertyMatches = animations->HasAnimationOfProperty(aProperty);
if (propertyMatches && animations->CanPerformOnCompositorThread()) {
return true;
}
}
ElementTransitions* transitions =
static_cast<ElementTransitions*>(aContent->GetProperty(nsGkAtoms::transitionsProperty));
if (transitions) {
bool propertyMatches = transitions->HasTransitionOfProperty(aProperty);
if (propertyMatches && transitions->CanPerformOnCompositorThread()) {
return true;
}
}
return false;
}
bool
nsLayoutUtils::Are3DTransformsEnabled()