当前位置: 首页>>代码示例>>C++>>正文


C++ SVGSMILElement::remove方法代码示例

本文整理汇总了C++中SVGSMILElement::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGSMILElement::remove方法的具体用法?C++ SVGSMILElement::remove怎么用?C++ SVGSMILElement::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SVGSMILElement的用法示例。


在下文中一共展示了SVGSMILElement::remove方法的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;
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:99,代码来源:SMILTimeContainer.cpp


注:本文中的SVGSMILElement::remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。