コード例 #1
0
static v8::Handle<v8::Value> initializeCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGPointList.initialize");
    SVGPointList* imp = V8SVGPointList::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    bool itemOk;
    FloatPoint item = V8SVGPODTypeUtil::toSVGPODType<FloatPoint>(&V8SVGPoint::info, args[0], itemOk);
    if (UNLIKELY(!itemOk)) {
        ec = TYPE_MISMATCH_ERR;
        goto fail;
    }
    SVGList<RefPtr<SVGPODListItem<FloatPoint> > >* listImp = imp;
    RefPtr<SVGPODListItem<FloatPoint> > result = listImp->initialize(SVGPODListItem<FloatPoint>::copy(item), ec);
    if (UNLIKELY(ec))
        goto fail;
    RefPtr<V8SVGPODTypeWrapper<FloatPoint> > wrapper = V8SVGPODTypeWrapperCreatorForList<FloatPoint>::create(result, imp->associatedAttributeName());
    SVGElement* context = V8Proxy::svgContext(imp);
    V8Proxy::setSVGContext(wrapper.get(), context);
    context->svgAttributeChanged(imp->associatedAttributeName());
    return toV8(wrapper.release());
    }
    fail:
    V8Proxy::setDOMException(ec);
    return v8::Handle<v8::Value>();
}
コード例 #2
0
JSValue* JSSVGTransformList::insertItemBefore(ExecState* exec, const List& args)
{
    ExceptionCode ec = 0;
    SVGTransform newItem = toSVGTransform(args[0]);

    bool indexOk;
    unsigned index = args[1]->toInt32(exec, indexOk);
    if (!indexOk) {
        setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
        return jsUndefined();
    }

    SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
    SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;

    SVGPODListItem<SVGTransform>* listItem = listImp->insertItemBefore(SVGPODListItem<SVGTransform>::copy(newItem), index, ec).get();
    JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());

    KJS::JSValue* result = toJS(exec, obj, m_context.get());
    setDOMException(exec, ec);

    m_context->svgAttributeChanged(imp->associatedAttributeName());

    return result;
}
コード例 #3
0
JSValue* JSSVGTransformList::initialize(ExecState* exec, const List& args)
{
    ExceptionCode ec = 0;
    SVGTransform newItem = toSVGTransform(args[0]);

    SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
    SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;

    SVGPODListItem<SVGTransform>* listItem = listImp->initialize(SVGPODListItem<SVGTransform>::copy(newItem), ec).get(); 
    JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());

    KJS::JSValue* result = toJS(exec, obj, m_context.get());
    setDOMException(exec, ec);

    m_context->svgAttributeChanged(imp->associatedAttributeName());

    return result;
}
コード例 #4
0
static v8::Handle<v8::Value> getItemCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGPointList.getItem");
    SVGPointList* imp = V8SVGPointList::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    EXCEPTION_BLOCK(unsigned, index, toUInt32(args[0]));
    SVGList<RefPtr<SVGPODListItem<FloatPoint> > >* listImp = imp;
    RefPtr<SVGPODListItem<FloatPoint> > result = listImp->getItem(index, ec);
    if (UNLIKELY(ec))
        goto fail;
    RefPtr<V8SVGPODTypeWrapper<FloatPoint> > wrapper = V8SVGPODTypeWrapperCreatorForList<FloatPoint>::create(result, imp->associatedAttributeName());
    SVGElement* context = V8Proxy::svgContext(imp);
    V8Proxy::setSVGContext(wrapper.get(), context);
    return toV8(wrapper.release());
    }
    fail:
    V8Proxy::setDOMException(ec);
    return v8::Handle<v8::Value>();
}
コード例 #5
0
JSValue* JSSVGTransformList::removeItem(ExecState* exec, const List& args)
{
    ExceptionCode ec = 0;
    
    bool indexOk;
    unsigned index = args[0]->toInt32(exec, indexOk);
    if (!indexOk) {
        setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
        return jsUndefined();
    }

    SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
    SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;

    RefPtr<SVGPODListItem<SVGTransform> > listItem(listImp->removeItem(index, ec));
    JSSVGPODTypeWrapper<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorReadOnly<SVGTransform>(*listItem.get());

    KJS::JSValue* result = toJS(exec, obj, m_context.get());
    setDOMException(exec, ec);

    m_context->svgAttributeChanged(imp->associatedAttributeName());

    return result;
}