本文整理汇总了C++中SVGSMILElement::clearAnimatedType方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGSMILElement::clearAnimatedType方法的具体用法?C++ SVGSMILElement::clearAnimatedType怎么用?C++ SVGSMILElement::clearAnimatedType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGSMILElement
的用法示例。
在下文中一共展示了SVGSMILElement::clearAnimatedType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateAnimations
SMILTime SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime)
{
ASSERT(document().isActive());
SMILTime earliestFireTime = SMILTime::unresolved();
#if ENABLE(ASSERT)
// This boolean will catch any attempts to schedule/unschedule scheduledAnimations during this critical section.
// Similarly, any elements removed will unschedule themselves, so this will catch modification of animationsToApply.
m_preventScheduledAnimationsChanges = true;
#endif
if (m_documentOrderIndexesDirty)
updateDocumentOrderIndexes();
HeapHashSet<ElementAttributePair> invalidKeys;
using AnimationsVector = HeapVector<Member<SVGSMILElement>>;
AnimationsVector animationsToApply;
AnimationsVector scheduledAnimationsInSameGroup;
for (const auto& entry : m_scheduledAnimations) {
if (!entry.key.first || entry.value->isEmpty()) {
invalidKeys.add(entry.key);
continue;
}
// Sort according to priority. Elements with later begin time have higher priority.
// In case of a tie, document order decides.
// FIXME: This should also consider timing relationships between the elements. Dependents
// have higher priority.
copyToVector(*entry.value, scheduledAnimationsInSameGroup);
std::sort(scheduledAnimationsInSameGroup.begin(), scheduledAnimationsInSameGroup.end(), PriorityCompare(elapsed));
SVGSMILElement* resultElement = nullptr;
for (const auto& itAnimation : scheduledAnimationsInSameGroup) {
SVGSMILElement* animation = itAnimation.get();
ASSERT(animation->timeContainer() == this);
ASSERT(animation->targetElement());
ASSERT(animation->hasValidAttributeName());
ASSERT(animation->hasValidAttributeType());
// Results are accumulated to the first animation that animates and contributes to a particular element/attribute pair.
if (!resultElement) {
resultElement = animation;
resultElement->lockAnimatedType();
}
// This will calculate the contribution from the animation and add it to the resultElement.
if (!animation->progress(elapsed, resultElement, seekToTime) && resultElement == animation) {
resultElement->unlockAnimatedType();
resultElement->clearAnimatedType();
resultElement = nullptr;
}
SMILTime nextFireTime = animation->nextProgressTime();
if (nextFireTime.isFinite())
earliestFireTime = std::min(nextFireTime, earliestFireTime);
}
if (resultElement) {
animationsToApply.append(resultElement);
resultElement->unlockAnimatedType();
}
}
m_scheduledAnimations.removeAll(invalidKeys);
std::sort(animationsToApply.begin(), animationsToApply.end(), PriorityCompare(elapsed));
unsigned animationsToApplySize = animationsToApply.size();
if (!animationsToApplySize) {
#if ENABLE(ASSERT)
m_preventScheduledAnimationsChanges = false;
#endif
return earliestFireTime;
}
// Apply results to target elements.
for (unsigned i = 0; i < animationsToApplySize; ++i)
animationsToApply[i]->applyResultsToTarget();
#if ENABLE(ASSERT)
m_preventScheduledAnimationsChanges = false;
#endif
for (unsigned i = 0; i < animationsToApplySize; ++i) {
if (animationsToApply[i]->inShadowIncludingDocument() && animationsToApply[i]->isSVGDiscardElement()) {
SVGSMILElement* animDiscard = animationsToApply[i];
SVGElement* targetElement = animDiscard->targetElement();
if (targetElement && targetElement->inShadowIncludingDocument()) {
targetElement->remove(IGNORE_EXCEPTION);
ASSERT(!targetElement->inShadowIncludingDocument());
}
if (animDiscard->inShadowIncludingDocument()) {
animDiscard->remove(IGNORE_EXCEPTION);
ASSERT(!animDiscard->inShadowIncludingDocument());
}
}
}
return earliestFireTime;
}