JSValue JSSVGPathSegList::clear(ExecState* exec, const ArgList&)
{
    ExceptionCode ec = 0;

    SVGPathSegList* list = impl();
    list->clear(ec);

    setDOMException(exec, ec);

    JSSVGContextCache::propagateSVGDOMChange(this, list->associatedAttributeName());
    return jsUndefined();
}
JSValue JSSVGPathSegList::appendItem(ExecState* exec, const ArgList& args)
{
    ExceptionCode ec = 0;
    SVGPathSeg* newItem = toSVGPathSeg(args.at(0));

    SVGPathSegList* list = impl();
    SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);

    JSValue result = toJS(exec, globalObject(), WTF::getPtr(list->appendItem(newItem, ec)), context);
    setDOMException(exec, ec);

    JSSVGContextCache::propagateSVGDOMChange(this, list->associatedAttributeName());
    return result;
}
Ejemplo n.º 3
0
static v8::Handle<v8::Value> clearCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGPathSegList.clear");
    SVGPathSegList* imp = V8SVGPathSegList::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    imp->clear(ec);
    if (UNLIKELY(ec))
        goto fail;
    SVGElement* context = V8Proxy::svgContext(imp);
    context->svgAttributeChanged(imp->associatedAttributeName());
    return v8::Handle<v8::Value>();
    }
    fail:
    V8Proxy::setDOMException(ec);
    return v8::Handle<v8::Value>();
}
Ejemplo n.º 4
0
static v8::Handle<v8::Value> initializeCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGPathSegList.initialize");
    SVGPathSegList* imp = V8SVGPathSegList::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    EXCEPTION_BLOCK(SVGPathSeg*, newItem, V8SVGPathSeg::HasInstance(args[0]) ? V8SVGPathSeg::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
    RefPtr<SVGPathSeg> result = imp->initialize(newItem, ec);
    if (UNLIKELY(ec))
        goto fail;
    SVGElement* context = V8Proxy::svgContext(imp);
    V8Proxy::setSVGContext(result.get(), context);
    context->svgAttributeChanged(imp->associatedAttributeName());
    return toV8(result.release());
    }
    fail:
    V8Proxy::setDOMException(ec);
    return v8::Handle<v8::Value>();
}
Ejemplo n.º 5
0
static v8::Handle<v8::Value> removeItemCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGPathSegList.removeItem");
    SVGPathSegList* imp = V8SVGPathSegList::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    EXCEPTION_BLOCK(unsigned, index, toUInt32(args[0]));
    RefPtr<SVGPathSeg> result = imp->removeItem(index, ec);
    if (UNLIKELY(ec))
        goto fail;
    SVGElement* context = V8Proxy::svgContext(imp);
    V8Proxy::setSVGContext(result.get(), context);
    context->svgAttributeChanged(imp->associatedAttributeName());
    return toV8(result.release());
    }
    fail:
    V8Proxy::setDOMException(ec);
    return v8::Handle<v8::Value>();
}
JSValue JSSVGPathSegList::replaceItem(ExecState* exec, const ArgList& args)
{
    ExceptionCode ec = 0;
    SVGPathSeg* newItem = toSVGPathSeg(args.at(0));
    
    bool indexOk;
    unsigned index = args.at(1).toInt32(exec, indexOk);
    if (!indexOk) {
        setDOMException(exec, TYPE_MISMATCH_ERR);
        return jsUndefined();
    }

    SVGPathSegList* list = impl();
    SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);

    JSValue result = toJS(exec, globalObject(), WTF::getPtr(list->replaceItem(newItem, index, ec)), context);
    setDOMException(exec, ec);

    JSSVGContextCache::propagateSVGDOMChange(this, list->associatedAttributeName());
    return result;
}