Пример #1
0
JSValue* jsHTMLTableElementPrototypeFunctionDeleteCaption(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
    if (!thisValue->isObject(&JSHTMLTableElement::s_info))
        return throwError(exec, TypeError);
    JSHTMLTableElement* castedThisObj = static_cast<JSHTMLTableElement*>(thisValue);
    HTMLTableElement* imp = static_cast<HTMLTableElement*>(castedThisObj->impl());

    imp->deleteCaption();
    return jsUndefined();
}
Пример #2
0
JSValue* jsHTMLTableElementPrototypeFunctionCreateCaption(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
    if (!thisValue->isObject(&JSHTMLTableElement::s_info))
        return throwError(exec, TypeError);
    JSHTMLTableElement* castedThisObj = static_cast<JSHTMLTableElement*>(thisValue);
    HTMLTableElement* imp = static_cast<HTMLTableElement*>(castedThisObj->impl());


    KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createCaption()));
    return result;
}
Пример #3
0
JSValue* jsHTMLTableElementPrototypeFunctionDeleteRow(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
    if (!thisValue->isObject(&JSHTMLTableElement::s_info))
        return throwError(exec, TypeError);
    JSHTMLTableElement* castedThisObj = static_cast<JSHTMLTableElement*>(thisValue);
    HTMLTableElement* imp = static_cast<HTMLTableElement*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    int index = args[0]->toInt32(exec);

    imp->deleteRow(index, ec);
    setDOMException(exec, ec);
    return jsUndefined();
}
Пример #4
0
JSValue* jsHTMLTableElementPrototypeFunctionInsertRow(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
    if (!thisValue->isObject(&JSHTMLTableElement::s_info))
        return throwError(exec, TypeError);
    JSHTMLTableElement* castedThisObj = static_cast<JSHTMLTableElement*>(thisValue);
    HTMLTableElement* imp = static_cast<HTMLTableElement*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    int index = args[0]->toInt32(exec);


    KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->insertRow(index, ec)));
    setDOMException(exec, ec);
    return result;
}
Пример #5
0
JSValue* JSHTMLTableElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
{
    if (!thisObj->inherits(&JSHTMLTableElement::info))
      return throwError(exec, TypeError);

    JSHTMLTableElement* castedThisObj = static_cast<JSHTMLTableElement*>(thisObj);
    HTMLTableElement* imp = static_cast<HTMLTableElement*>(castedThisObj->impl());

    switch (id) {
    case JSHTMLTableElement::CreateTHeadFuncNum: {


        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createTHead()));
        return result;
    }
    case JSHTMLTableElement::DeleteTHeadFuncNum: {

        imp->deleteTHead();
        return jsUndefined();
    }
    case JSHTMLTableElement::CreateTFootFuncNum: {


        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createTFoot()));
        return result;
    }
    case JSHTMLTableElement::DeleteTFootFuncNum: {

        imp->deleteTFoot();
        return jsUndefined();
    }
    case JSHTMLTableElement::CreateCaptionFuncNum: {


        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createCaption()));
        return result;
    }
    case JSHTMLTableElement::DeleteCaptionFuncNum: {

        imp->deleteCaption();
        return jsUndefined();
    }
    case JSHTMLTableElement::InsertRowFuncNum: {
        ExceptionCode ec = 0;
        bool indexOk;
        int index = args[0]->toInt32(exec, indexOk);
        if (!indexOk) {
            setDOMException(exec, TYPE_MISMATCH_ERR);
            return jsUndefined();
        }


        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->insertRow(index, ec)));
        setDOMException(exec, ec);
        return result;
    }
    case JSHTMLTableElement::DeleteRowFuncNum: {
        ExceptionCode ec = 0;
        bool indexOk;
        int index = args[0]->toInt32(exec, indexOk);
        if (!indexOk) {
            setDOMException(exec, TYPE_MISMATCH_ERR);
            return jsUndefined();
        }

        imp->deleteRow(index, ec);
        setDOMException(exec, ec);
        return jsUndefined();
    }
    }
    return 0;
}