static v8::Handle<v8::Value> acceptNodeCallback(const v8::Arguments& args) { INC_STATS("DOM.NodeFilter.acceptNode"); NodeFilter* imp = V8NodeFilter::toNative(args.Holder()); EXCEPTION_BLOCK(Node*, n, V8Node::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0); EmptyScriptState state; int result = imp->acceptNode(&state, n); if (state.hadException()) return throwError(state.exception()); return v8::Integer::New(result); }
EncodedJSValue JSC_HOST_CALL jsNodeFilterPrototypeFunctionAcceptNode(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSNodeFilter::s_info)) return throwVMTypeError(exec); JSNodeFilter* castedThis = static_cast<JSNodeFilter*>(asObject(thisValue)); NodeFilter* imp = static_cast<NodeFilter*>(castedThis->impl()); Node* n(toNode(exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = jsNumber(imp->acceptNode(exec, n)); if (exec->hadException()) return JSValue::encode(jsUndefined()); return JSValue::encode(result); }
JSValue* JSNodeFilterPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) { if (!thisObj->inherits(&JSNodeFilter::info)) return throwError(exec, TypeError); NodeFilter* imp = static_cast<NodeFilter*>(static_cast<JSNodeFilter*>(thisObj)->impl()); switch (id) { case JSNodeFilter::AcceptNodeFuncNum: { Node* n = toNode(args[0]); KJS::JSValue* result = jsNumber(imp->acceptNode(n)); return result; } } return 0; }