Ejemplo n.º 1
0
JSValue JSC_HOST_CALL jsSVGLengthListPrototypeFunctionAppendItem(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSSVGLengthList::s_info))
        return throwError(exec, TypeError);
    JSSVGLengthList* castedThisObj = static_cast<JSSVGLengthList*>(asObject(thisValue));
    SVGLengthList* imp = static_cast<SVGLengthList*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    SVGLength item = toSVGLength(args.at(0));


    JSC::JSValue result = toJS(exec, deprecatedGlobalObjectForPrototype(exec), JSSVGStaticPODTypeWrapper<SVGLength>::create(imp->appendItem(item, ec)).get(), castedThisObj->context());
    setDOMException(exec, ec);
    return result;
}
Ejemplo n.º 2
0
JSValue* JSSVGLengthListPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
{
    if (!thisObj->inherits(&JSSVGLengthList::info))
      return throwError(exec, TypeError);

    JSSVGLengthList* castedThisObj = static_cast<JSSVGLengthList*>(thisObj);
    SVGLengthList* imp = static_cast<SVGLengthList*>(castedThisObj->impl());

    switch (id) {
    case JSSVGLengthList::ClearFuncNum: {
        ExceptionCode ec = 0;

        imp->clear(ec);
        setDOMException(exec, ec);
        return jsUndefined();
    }
    case JSSVGLengthList::InitializeFuncNum: {
        ExceptionCode ec = 0;
        SVGLength item = toSVGLength(args[0]);


        KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<SVGLength>(imp->initialize(item, ec)), castedThisObj->context());
        setDOMException(exec, ec);
        return result;
    }
    case JSSVGLengthList::GetItemFuncNum: {
        ExceptionCode ec = 0;
        bool indexOk;
        unsigned index = args[0]->toInt32(exec, indexOk);
        if (!indexOk) {
            setDOMException(exec, TYPE_MISMATCH_ERR);
            return jsUndefined();
        }


        KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<SVGLength>(imp->getItem(index, ec)), castedThisObj->context());
        setDOMException(exec, ec);
        return result;
    }
    case JSSVGLengthList::InsertItemBeforeFuncNum: {
        ExceptionCode ec = 0;
        SVGLength item = toSVGLength(args[0]);
        bool indexOk;
        unsigned index = args[1]->toInt32(exec, indexOk);
        if (!indexOk) {
            setDOMException(exec, TYPE_MISMATCH_ERR);
            return jsUndefined();
        }


        KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<SVGLength>(imp->insertItemBefore(item, index, ec)), castedThisObj->context());
        setDOMException(exec, ec);
        return result;
    }
    case JSSVGLengthList::ReplaceItemFuncNum: {
        ExceptionCode ec = 0;
        SVGLength item = toSVGLength(args[0]);
        bool indexOk;
        unsigned index = args[1]->toInt32(exec, indexOk);
        if (!indexOk) {
            setDOMException(exec, TYPE_MISMATCH_ERR);
            return jsUndefined();
        }


        KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<SVGLength>(imp->replaceItem(item, index, ec)), castedThisObj->context());
        setDOMException(exec, ec);
        return result;
    }
    case JSSVGLengthList::RemoveItemFuncNum: {
        ExceptionCode ec = 0;
        bool indexOk;
        unsigned index = args[0]->toInt32(exec, indexOk);
        if (!indexOk) {
            setDOMException(exec, TYPE_MISMATCH_ERR);
            return jsUndefined();
        }


        KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<SVGLength>(imp->removeItem(index, ec)), castedThisObj->context());
        setDOMException(exec, ec);
        return result;
    }
    case JSSVGLengthList::AppendItemFuncNum: {
        ExceptionCode ec = 0;
        SVGLength item = toSVGLength(args[0]);


        KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<SVGLength>(imp->appendItem(item, ec)), castedThisObj->context());
        setDOMException(exec, ec);
        return result;
    }
    }
    return 0;
}