JSValue* JSTreeWalker::getValueProperty(ExecState* exec, int token) const { switch (token) { case RootAttrNum: { TreeWalker* imp = static_cast<TreeWalker*>(impl()); return toJS(exec, WTF::getPtr(imp->root())); } case WhatToShowAttrNum: { TreeWalker* imp = static_cast<TreeWalker*>(impl()); return jsNumber(exec, imp->whatToShow()); } case FilterAttrNum: { TreeWalker* imp = static_cast<TreeWalker*>(impl()); return toJS(exec, WTF::getPtr(imp->filter())); } case ExpandEntityReferencesAttrNum: { TreeWalker* imp = static_cast<TreeWalker*>(impl()); return jsBoolean(imp->expandEntityReferences()); } case CurrentNodeAttrNum: { TreeWalker* imp = static_cast<TreeWalker*>(impl()); return toJS(exec, WTF::getPtr(imp->currentNode())); } } return 0; }
static void currentNodeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { INC_STATS("DOM.TreeWalker.currentNode._set"); TreeWalker* imp = V8TreeWalker::toNative(info.Holder()); Node* v = V8Node::HasInstance(value) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value)) : 0; ExceptionCode ec = 0; imp->setCurrentNode(WTF::getPtr(v), ec); if (UNLIKELY(ec)) V8Proxy::setDOMException(ec); return; }
void JSTreeWalker::putValueProperty(ExecState* exec, int token, JSValue* value) { switch (token) { case CurrentNodeAttrNum: { TreeWalker* imp = static_cast<TreeWalker*>(impl()); ExceptionCode ec = 0; imp->setCurrentNode(toNode(value), ec); setDOMException(exec, ec); break; } } }
static v8::Handle<v8::Value> parentNodeCallback(const v8::Arguments& args) { TreeWalker* imp = V8TreeWalker::toNative(args.Holder()); ScriptState* currentState = ScriptState::current(); if (!currentState) return v8Undefined(); ScriptState& state = *currentState; RefPtr<Node> result = imp->parentNode(&state); if (state.hadException()) { v8::Local<v8::Value> exception = state.exception(); state.clearException(); return throwError(exception, args.GetIsolate()); } return toV8(result.release(), args.Holder(), args.GetIsolate()); }
static v8::Handle<v8::Value> currentNodeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TreeWalker.currentNode._get"); TreeWalker* imp = V8TreeWalker::toNative(info.Holder()); return toV8(imp->currentNode()); }
static v8::Handle<v8::Value> expandEntityReferencesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TreeWalker.expandEntityReferences._get"); TreeWalker* imp = V8TreeWalker::toNative(info.Holder()); return v8Boolean(imp->expandEntityReferences()); }
static v8::Handle<v8::Value> whatToShowAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TreeWalker.whatToShow._get"); TreeWalker* imp = V8TreeWalker::toNative(info.Holder()); return v8::Integer::NewFromUnsigned(imp->whatToShow()); }
static v8::Handle<v8::Value> currentNodeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { TreeWalker* imp = V8TreeWalker::toNative(info.Holder()); return toV8Fast(imp->currentNode(), info, imp); }
static v8::Handle<v8::Value> expandEntityReferencesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { TreeWalker* imp = V8TreeWalker::toNative(info.Holder()); return v8Boolean(imp->expandEntityReferences(), info.GetIsolate()); }
static v8::Handle<v8::Value> whatToShowAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { TreeWalker* imp = V8TreeWalker::toNative(info.Holder()); return v8UnsignedInteger(imp->whatToShow(), info.GetIsolate()); }