Exemplo n.º 1
0
SVGTimer::TargetAnimationMap SVGTimer::animationsByElement(double elapsedSeconds)
{
    // Build a list of all animations which apply to each element
    // FIXME: This list should be sorted by animation priority
    ExceptionCode ec = 0;
    TargetAnimationMap targetMap;
    SVGNotifySet::const_iterator end = m_notifySet.end();
    for (SVGNotifySet::const_iterator it = m_notifySet.begin(); it != end; ++it) {
        SVGAnimationElement* animation = *it;
        
        // If we're dealing with a disabled element with fill="freeze",
        // we have to take it into account for further calculations.
        if (!m_enabledNotifySet.contains(animation)) {
            if (!animation->isFrozen())
                continue;
            if (elapsedSeconds <= (animation->getStartTime() + animation->getSimpleDuration(ec)))
                continue;
        }
        
        SVGElement* target = const_cast<SVGElement*>(animation->targetElement());
        TargetAnimationMap::iterator i = targetMap.find(target);
        if (i != targetMap.end())
            i->second.append(animation);
        else {
            Vector<SVGAnimationElement*> list;
            list.append(animation);
            targetMap.set(target, list);
        }
    }
    return targetMap;
}
static v8::Handle<v8::Value> getSimpleDurationCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGAnimationElement.getSimpleDuration");
    SVGAnimationElement* imp = V8SVGAnimationElement::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    float result = imp->getSimpleDuration(ec);
    if (UNLIKELY(ec))
        goto fail;
    return v8::Number::New(result);
    }
    fail:
    V8Proxy::setDOMException(ec);
    return v8::Handle<v8::Value>();
}