static v8::Handle<v8::Value> offsetAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGStopElement.offset._get");
    SVGStopElement* imp = V8SVGStopElement::toNative(info.Holder());
    SVGElement* context = imp;
    PassRefPtr<SVGAnimatedNumber> resultAsPassRefPtr = V8Proxy::withSVGContext(imp->offsetAnimated(), context);
    return toV8(resultAsPassRefPtr);
}
JSValue* JSSVGStopElement::getValueProperty(ExecState* exec, int token) const
{
    switch (token) {
    case OffsetAttrNum: {
        SVGStopElement* imp = static_cast<SVGStopElement*>(impl());

        ASSERT(exec && exec->dynamicInterpreter());

        RefPtr<SVGAnimatedNumber> obj = imp->offsetAnimated();
        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
        if (activeFrame) {
            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
            if (extensions) {
                if (extensions->hasGenericContext<SVGAnimatedNumber>(obj.get()))
                    ASSERT(extensions->genericContext<SVGAnimatedNumber>(obj.get()) == imp);
                else
                    extensions->setGenericContext<SVGAnimatedNumber>(obj.get(), imp);
            }
        }

        return toJS(exec, obj.get());
    }
    case ClassNameAttrNum: {
        SVGStopElement* imp = static_cast<SVGStopElement*>(impl());

        ASSERT(exec && exec->dynamicInterpreter());

        RefPtr<SVGAnimatedString> obj = imp->classNameAnimated();
        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
        if (activeFrame) {
            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
            if (extensions) {
                if (extensions->hasGenericContext<SVGAnimatedString>(obj.get()))
                    ASSERT(extensions->genericContext<SVGAnimatedString>(obj.get()) == imp);
                else
                    extensions->setGenericContext<SVGAnimatedString>(obj.get(), imp);
            }
        }

        return toJS(exec, obj.get());
    }
    case StyleAttrNum: {
        SVGStopElement* imp = static_cast<SVGStopElement*>(impl());

        return toJS(exec, WTF::getPtr(imp->style()));
    }
    }
    return 0;
}
Exemplo n.º 3
0
static v8::Handle<v8::Value> offsetAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGStopElement.offset._get");
    SVGStopElement* imp = V8SVGStopElement::toNative(info.Holder());
    return toV8(imp->offsetAnimated());
}