JSValue* jsCSSRuleListPrototypeFunctionItem(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSCSSRuleList::s_info)) return throwError(exec, TypeError); JSCSSRuleList* castedThisObj = static_cast<JSCSSRuleList*>(thisValue); CSSRuleList* imp = static_cast<CSSRuleList*>(castedThisObj->impl()); unsigned index = args.at(exec, 0)->toInt32(exec); JSC::JSValue* result = toJS(exec, WTF::getPtr(imp->item(index))); return result; }
JSValue* JSCSSRuleListPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) { if (!thisObj->inherits(&JSCSSRuleList::info)) return throwError(exec, TypeError); CSSRuleList* imp = static_cast<CSSRuleList*>(static_cast<JSCSSRuleList*>(thisObj)->impl()); switch (id) { case JSCSSRuleList::ItemFuncNum: { bool indexOk; unsigned index = args[0]->toInt32(exec, indexOk); if (!indexOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->item(index))); return result; } } return 0; }
static v8::Handle<v8::Value> itemCallback(const v8::Arguments& args) { INC_STATS("DOM.CSSRuleList.item"); CSSRuleList* imp = V8CSSRuleList::toNative(args.Holder()); unsigned index = toInt32(args[0]); return toV8(imp->item(index)); }