这篇教程C++ toNode函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中toNode函数的典型用法代码示例。如果您正苦于以下问题:C++ toNode函数的具体用法?C++ toNode怎么用?C++ toNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了toNode函数的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: toNodeJSValue JSNode::replaceChild(ExecState* exec){ Node* imp = static_cast<Node*>(impl()); ExceptionCode ec = 0; bool ok = imp->replaceChild(toNode(exec->argument(0)), toNode(exec->argument(1)), ec, true); setDOMException(exec, ec); if (ok) return exec->argument(1); return jsNull();}
开发者ID:Treeeater,项目名称:Chromium_on_windows,代码行数:10,
示例2: jsXPathEvaluatorPrototypeFunctionEvaluateJSValue* jsXPathEvaluatorPrototypeFunctionEvaluate(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args){ if (!thisValue->isObject(&JSXPathEvaluator::s_info)) return throwError(exec, TypeError); JSXPathEvaluator* castedThisObj = static_cast<JSXPathEvaluator*>(thisValue); XPathEvaluator* imp = static_cast<XPathEvaluator*>(castedThisObj->impl()); ExceptionCode ec = 0; const UString& expression = args[0]->toString(exec); Node* contextNode = toNode(args[1]); RefPtr<XPathNSResolver> customResolver; XPathNSResolver* resolver = toXPathNSResolver(args[2]); if (!resolver) { customResolver = JSCustomXPathNSResolver::create(exec, args[2]); if (exec->hadException()) return jsUndefined(); resolver = customResolver.get(); } unsigned short type = args[3]->toInt32(exec); XPathResult* inResult = toXPathResult(args[4]); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->evaluate(expression, contextNode, resolver, type, inResult, ec))); setDOMException(exec, ec); return result;}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:25,
示例3: jsUndefinedJSValue JSCommandLineAPIHost::getEventListeners(ExecState* exec){ if (exec->argumentCount() < 1) return jsUndefined(); JSValue value = exec->uncheckedArgument(0); if (!value.isObject() || value.isNull()) return jsUndefined(); Node* node = toNode(value); if (!node) return jsUndefined(); Vector<EventListenerInfo> listenersArray; impl().getEventListenersImpl(node, listenersArray); JSObject* result = constructEmptyObject(exec); for (size_t i = 0; i < listenersArray.size(); ++i) { JSArray* listeners = getJSListenerFunctions(exec, &node->document(), listenersArray[i]); if (!listeners->length()) continue; AtomicString eventType = listenersArray[i].eventType; result->putDirect(exec->vm(), Identifier(exec, eventType.impl()), JSValue(listeners)); } return result;}
开发者ID:CannedFish,项目名称:webkit,代码行数:27,
示例4: jsUndefinedJSValue JSInjectedScriptHost::getEventListeners(ExecState* exec){ if (exec->argumentCount() < 1) return jsUndefined(); JSValue value = exec->argument(0); if (!value.isObject() || value.isNull()) return jsUndefined(); Node* node = toNode(value); if (!node) return jsUndefined(); // This can only happen for orphan DocumentType nodes. Document* document = node->document(); if (!node->document()) return jsUndefined(); Vector<EventListenerInfo> listenersArray; impl()->getEventListenersImpl(node, listenersArray); JSObject* result = constructEmptyObject(exec); for (size_t i = 0; i < listenersArray.size(); ++i) { JSArray* listeners = getJSListenerFunctions(exec, document, listenersArray[i]); if (!listeners->length()) continue; AtomicString eventType = listenersArray[i].eventType; result->putDirect(exec->globalData(), Identifier(exec, eventType.impl()), JSValue(listeners)); } return result;}
开发者ID:dzhshf,项目名称:WebKit,代码行数:29,
示例5: jsUndefinedJSValue JSInspectorFrontendHost::search(ExecState* exec, const ArgList& args){ if (args.size() < 2) return jsUndefined(); Node* node = toNode(args.at(0)); if (!node) return jsUndefined(); String target = args.at(1).toString(exec); if (exec->hadException()) return jsUndefined(); MarkedArgumentBuffer result; RefPtr<Range> searchRange(rangeOfContents(node)); ExceptionCode ec = 0; do { RefPtr<Range> resultRange(findPlainText(searchRange.get(), target, true, false)); if (resultRange->collapsed(ec)) break; // A non-collapsed result range can in some funky whitespace cases still not // advance the range's start position (4509328). Break to avoid infinite loop. VisiblePosition newStart = endVisiblePosition(resultRange.get(), DOWNSTREAM); if (newStart == startVisiblePosition(searchRange.get(), DOWNSTREAM)) break; result.append(toJS(exec, resultRange.get())); setStart(searchRange.get(), newStart); } while (true); return constructArray(exec, result);}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:35,
示例6: jsXPathEvaluatorPrototypeFunctionEvaluateEncodedJSValue JSC_HOST_CALL jsXPathEvaluatorPrototypeFunctionEvaluate(ExecState* exec){ JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSXPathEvaluator::s_info)) return throwVMTypeError(exec); JSXPathEvaluator* castedThis = static_cast<JSXPathEvaluator*>(asObject(thisValue)); XPathEvaluator* imp = static_cast<XPathEvaluator*>(castedThis->impl()); ExceptionCode ec = 0; const String& expression(ustringToString(exec->argument(0).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); Node* contextNode(toNode(exec->argument(1))); if (exec->hadException()) return JSValue::encode(jsUndefined()); RefPtr<XPathNSResolver> customResolver; XPathNSResolver* resolver = toXPathNSResolver(exec->argument(2)); if (!resolver) { customResolver = JSCustomXPathNSResolver::create(exec, exec->argument(2)); if (exec->hadException()) return JSValue::encode(jsUndefined()); resolver = customResolver.get(); } unsigned short type(exec->argument(3).toUInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); XPathResult* inResult(toXPathResult(exec->argument(4))); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->evaluate(expression, contextNode, resolver, type, inResult, ec))); setDOMException(exec, ec); return JSValue::encode(result);}
开发者ID:13W,项目名称:phantomjs,代码行数:34,
示例7: CRASHvoid HandleSet::writeBarrier(HandleSlot slot, const JSValue& value){ // Forbid assignment to handles during the finalization phase, since it would violate many GC invariants. // File a bug with stack trace if you hit this. if (m_nextToFinalize) CRASH(); if (!value == !*slot && slot->isCell() == value.isCell()) return; Node* node = toNode(slot);#if ENABLE(GC_VALIDATION) if (!isLiveNode(node)) CRASH();#endif SentinelLinkedList<Node>::remove(node); if (!value || !value.isCell()) { m_immediateList.push(node); return; } m_strongList.push(node);#if ENABLE(GC_VALIDATION) if (!isLiveNode(node)) CRASH();#endif}
开发者ID:jiezh,项目名称:h5vcc,代码行数:27,
示例8: jsXPathEvaluatorPrototypeFunctionEvaluateEncodedJSValue JSC_HOST_CALL jsXPathEvaluatorPrototypeFunctionEvaluate(ExecState* exec){ JSValue thisValue = exec->hostThisValue(); JSXPathEvaluator* castedThis = jsDynamicCast<JSXPathEvaluator*>(thisValue); if (!castedThis) return throwVMTypeError(exec); ASSERT_GC_OBJECT_INHERITS(castedThis, JSXPathEvaluator::info()); XPathEvaluator& impl = castedThis->impl(); ExceptionCode ec = 0; const String& expression(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); Node* contextNode(toNode(exec->argument(1))); if (exec->hadException()) return JSValue::encode(jsUndefined()); RefPtr<XPathNSResolver> customResolver; XPathNSResolver* resolver = toXPathNSResolver(exec->argument(2)); if (!resolver) { customResolver = JSCustomXPathNSResolver::create(exec, exec->argument(2)); if (exec->hadException()) return JSValue::encode(jsUndefined()); resolver = customResolver.get(); } uint16_t type(toUInt16(exec, exec->argument(3), NormalConversion)); if (exec->hadException()) return JSValue::encode(jsUndefined()); XPathResult* inResult(toXPathResult(exec->argument(4))); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.evaluate(expression, contextNode, resolver, type, inResult, ec))); setDOMException(exec, ec); return JSValue::encode(result);}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:34,
示例9: toNodebool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture){ // FIXME: listener null check should throw TypeError (and be done in // generated bindings), but breaks legacy content. http://crbug.com/249598 if (!listener) return false; V8DOMActivityLogger* activityLogger = V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld(); if (activityLogger) { Vector<String> argv; argv.append(toNode() ? toNode()->nodeName() : interfaceName()); argv.append(eventType); activityLogger->logEvent("blinkAddEventListener", argv.size(), argv.data()); } return ensureEventTargetData().eventListenerMap.add(eventType, listener, useCapture);}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:17,
示例10: implJSValue* JSNodeFilter::acceptNode(ExecState* exec, const ArgList& args){ JSValue* exception = 0; short result = impl()->acceptNode(toNode(args[0]), exception); if (exception) exec->setException(exception); return jsNumber(exec, result);}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:8,
示例11: implJSValuePtr JSNode::appendChild(ExecState* exec, const ArgList& args){ ExceptionCode ec = 0; bool ok = impl()->appendChild(toNode(args.at(exec, 0)), ec, true); setDOMException(exec, ec); if (ok) return args.at(exec, 0); return jsNull();}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:9,
示例12: implJSValue JSNode::removeChild(ExecState* exec, const ArgList& args){ ExceptionCode ec = 0; bool ok = impl()->removeChild(toNode(args.at(0)), ec); setDOMException(exec, ec); if (ok) return args.at(0); return jsNull();}
开发者ID:ShouqingZhang,项目名称:webkitdriver,代码行数:9,
示例13: setJSTestInterfaceImplementsNodevoid setJSTestInterfaceImplementsNode(ExecState* exec, JSObject* thisObject, JSValue value){ UNUSED_PARAM(exec); JSTestInterface* castedThis = jsCast<JSTestInterface*>(thisObject); TestInterface& impl = castedThis->impl(); Node* nativeValue(toNode(value)); if (exec->hadException()) return; impl.setImplementsNode(nativeValue);}
开发者ID:ZeusbaseWeb,项目名称:webkit,代码行数:10,
示例14: jsNodePrototypeFunctionIsEqualNodeJSValue* jsNodePrototypeFunctionIsEqualNode(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args){ if (!thisValue->isObject(&JSNode::s_info)) return throwError(exec, TypeError); JSNode* castedThisObj = static_cast<JSNode*>(thisValue); Node* imp = static_cast<Node*>(castedThisObj->impl()); Node* other = toNode(args[0]); KJS::JSValue* result = jsBoolean(imp->isEqualNode(other)); return result;}
开发者ID:Chingliu,项目名称:EAWebkit,代码行数:12,
示例15: switchvoid 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; } }}
开发者ID:Chingliu,项目名称:EAWebkit,代码行数:12,
示例16: jsXPathEvaluatorPrototypeFunctionCreateNSResolverJSValue* jsXPathEvaluatorPrototypeFunctionCreateNSResolver(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args){ if (!thisValue->isObject(&JSXPathEvaluator::s_info)) return throwError(exec, TypeError); JSXPathEvaluator* castedThisObj = static_cast<JSXPathEvaluator*>(thisValue); XPathEvaluator* imp = static_cast<XPathEvaluator*>(castedThisObj->impl()); Node* nodeResolver = toNode(args[0]); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createNSResolver(nodeResolver))); return result;}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:12,
示例17: jsUndefinedJSValue JSInjectedScriptHost::pushNodePathToFrontend(ExecState* exec, const ArgList& args){ if (args.size() < 3) return jsUndefined(); Node* node = toNode(args.at(0)); if (!node) return jsUndefined(); bool withChildren = args.at(1).toBoolean(exec); bool selectInUI = args.at(2).toBoolean(exec); return jsNumber(exec, impl()->pushNodePathToFrontend(node, withChildren, selectInUI));}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:13,
示例18: jsRangePrototypeFunctionSurroundContentsJSValue* jsRangePrototypeFunctionSurroundContents(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args){ if (!thisValue->isObject(&JSRange::s_info)) return throwError(exec, TypeError); JSRange* castedThisObj = static_cast<JSRange*>(thisValue); Range* imp = static_cast<Range*>(castedThisObj->impl()); ExceptionCode ec = 0; Node* newParent = toNode(args[0]); imp->surroundContents(newParent, ec); setDOMException(exec, ec); return jsUndefined();}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:13,
示例19: jsUndefinedJSValue JSInjectedScriptHost::pushNodePathToFrontend(ExecState* exec){ if (exec->argumentCount() < 3) return jsUndefined(); Node* node = toNode(exec->argument(0)); if (!node) return jsUndefined(); bool withChildren = exec->argument(1).toBoolean(exec); bool selectInUI = exec->argument(2).toBoolean(exec); return jsNumber(impl()->pushNodePathToFrontend(node, withChildren, selectInUI));}
开发者ID:dslab-epfl,项目名称:warr,代码行数:13,
示例20: searchstatic JSValueRef search(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* /*exception*/){ InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject)); if (!controller) return JSValueMakeUndefined(ctx); if (argumentCount < 2 || !JSValueIsString(ctx, arguments[1])) return JSValueMakeUndefined(ctx); Node* node = toNode(toJS(arguments[0])); if (!node) return JSValueMakeUndefined(ctx); JSStringRef string = JSValueToStringCopy(ctx, arguments[1], 0); String target(JSStringGetCharactersPtr(string), JSStringGetLength(string)); JSStringRelease(string); JSObjectRef globalObject = JSContextGetGlobalObject(ctx); JSStringRef constructorString = JSStringCreateWithUTF8CString("Array"); JSObjectRef arrayConstructor = JSValueToObject(ctx, JSObjectGetProperty(ctx, globalObject, constructorString, 0), 0); JSStringRelease(constructorString); JSObjectRef array = JSObjectCallAsConstructor(ctx, arrayConstructor, 0, 0, 0); JSStringRef pushString = JSStringCreateWithUTF8CString("push"); JSValueRef pushValue = JSObjectGetProperty(ctx, array, pushString, 0); JSStringRelease(pushString); JSObjectRef push = JSValueToObject(ctx, pushValue, 0); RefPtr<Range> searchRange(rangeOfContents(node)); int exception = 0; do { RefPtr<Range> resultRange(findPlainText(searchRange.get(), target, true, false)); if (resultRange->collapsed(exception)) break; // A non-collapsed result range can in some funky whitespace cases still not // advance the range's start position (4509328). Break to avoid infinite loop. VisiblePosition newStart = endVisiblePosition(resultRange.get(), DOWNSTREAM); if (newStart == startVisiblePosition(searchRange.get(), DOWNSTREAM)) break; KJS::JSLock lock; JSValueRef arg0 = toRef(toJS(toJS(ctx), resultRange.get())); JSObjectCallAsFunction(ctx, push, array, 1, &arg0, 0); setStart(searchRange.get(), newStart); } while (true); return array;}
开发者ID:FilipBE,项目名称:qtextended,代码行数:51,
示例21: jsRangePrototypeFunctionCompareNodeJSValue* jsRangePrototypeFunctionCompareNode(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args){ if (!thisValue->isObject(&JSRange::s_info)) return throwError(exec, TypeError); JSRange* castedThisObj = static_cast<JSRange*>(thisValue); Range* imp = static_cast<Range*>(castedThisObj->impl()); ExceptionCode ec = 0; Node* refNode = toNode(args[0]); KJS::JSValue* result = jsNumber(exec, imp->compareNode(refNode, ec)); setDOMException(exec, ec); return result;}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:14,
示例22: jsRangePrototypeFunctionSetEndJSValue* jsRangePrototypeFunctionSetEnd(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args){ if (!thisValue->isObject(&JSRange::s_info)) return throwError(exec, TypeError); JSRange* castedThisObj = static_cast<JSRange*>(thisValue); Range* imp = static_cast<Range*>(castedThisObj->impl()); ExceptionCode ec = 0; Node* refNode = toNode(args[0]); int offset = args[1]->toInt32(exec); imp->setEnd(refNode, offset, ec); setDOMException(exec, ec); return jsUndefined();}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:14,
注:本文中的toNode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ toNumber函数代码示例 C++ toMapCoordinates函数代码示例 |