本文整理汇总了C++中AnimationPlayerCollection::CanPerformOnCompositorThread方法的典型用法代码示例。如果您正苦于以下问题:C++ AnimationPlayerCollection::CanPerformOnCompositorThread方法的具体用法?C++ AnimationPlayerCollection::CanPerformOnCompositorThread怎么用?C++ AnimationPlayerCollection::CanPerformOnCompositorThread使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnimationPlayerCollection
的用法示例。
在下文中一共展示了AnimationPlayerCollection::CanPerformOnCompositorThread方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
AnimationPlayerCollection*
CommonAnimationManager::GetAnimationsForCompositor(nsIContent* aContent,
nsIAtom* aElementProperty,
nsCSSProperty aProperty)
{
if (!aContent->MayHaveAnimations())
return nullptr;
AnimationPlayerCollection* collection =
static_cast<AnimationPlayerCollection*>(
aContent->GetProperty(aElementProperty));
if (!collection ||
!collection->HasAnimationOfProperty(aProperty) ||
!collection->CanPerformOnCompositorThread(
AnimationPlayerCollection::CanAnimate_AllowPartial)) {
return nullptr;
}
// This animation can be done on the compositor.
return collection;
}
示例2: mb
void
nsAnimationManager::FlushAnimations(FlushFlags aFlags)
{
// FIXME: check that there's at least one style rule that's not
// in its "done" state, and if there isn't, remove ourselves from
// the refresh driver (but leave the animations!).
TimeStamp now = mPresContext->RefreshDriver()->MostRecentRefresh();
bool didThrottle = false;
for (PRCList *l = PR_LIST_HEAD(&mElementCollections);
l != &mElementCollections;
l = PR_NEXT_LINK(l)) {
AnimationPlayerCollection* collection =
static_cast<AnimationPlayerCollection*>(l);
nsAutoAnimationMutationBatch mb(collection->mElement);
collection->Tick();
bool canThrottleTick = aFlags == Can_Throttle &&
collection->CanPerformOnCompositorThread(
AnimationPlayerCollection::CanAnimateFlags(0)) &&
collection->CanThrottleAnimation(now);
nsRefPtr<css::AnimValuesStyleRule> oldStyleRule = collection->mStyleRule;
UpdateStyleAndEvents(collection, now, canThrottleTick
? EnsureStyleRule_IsThrottled
: EnsureStyleRule_IsNotThrottled);
if (oldStyleRule != collection->mStyleRule) {
collection->PostRestyleForAnimation(mPresContext);
} else {
didThrottle = true;
}
}
if (didThrottle) {
mPresContext->Document()->SetNeedStyleFlush();
}
DispatchEvents(); // may destroy us
}