• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ WebCore类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中WebCore的典型用法代码示例。如果您正苦于以下问题:C++ WebCore类的具体用法?C++ WebCore怎么用?C++ WebCore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了WebCore类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: awe_webcore_initialize

extern "C" EXPORT_API void awe_webcore_initialize(  )
{
	WebCore* webCore = WebCore::instance();
	if (webCore == 0)
	{
		WebConfig config = WebConfig();
		config.log_level = Awesomium::kLogLevel_Verbose;
		config.log_path = WSLit("awesomium_logs\\");
		webCore = WebCore::Initialize(config);

		if (AwesomiumUnity::g_SurfaceFactory == 0)
			AwesomiumUnity::g_SurfaceFactory = new AwesomiumUnity::UnitySurfaceFactory();

		webCore->set_surface_factory(AwesomiumUnity::g_SurfaceFactory);

		if (AwesomiumUnity::g_WebSession == 0)
		{
			WebPreferences prefs = WebPreferences();
			prefs.enable_gpu_acceleration = true;
			prefs.enable_web_gl = true;
			prefs.enable_javascript = true;
			prefs.enable_plugins = true;
			prefs.enable_web_audio = true;
			prefs.enable_remote_fonts = true;
			AwesomiumUnity::g_WebSession = webCore->CreateWebSession(WebString(), prefs);
		}
	}
}
开发者ID:imclab,项目名称:AwesomiumUnity,代码行数:28,代码来源:WebCore.cpp


示例2: _NPN_EvaluateHelper

bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPString* npScript, NPVariant* result)
{
    VOID_TO_NPVARIANT(*result);
    if (!npObject)
        return false;

    if (npObject->_class != npScriptObjectClass)
        return false;

    v8::HandleScope handleScope;
    v8::Handle<v8::Context> context = toV8Context(npp, npObject);
    if (context.IsEmpty())
        return false;

    V8Proxy* proxy = toV8Proxy(npObject);
    ASSERT(proxy);

    v8::Context::Scope scope(context);

    WebCore::String filename;
    if (!popupsAllowed)
        filename = "npscript";

    WebCore::String script = WebCore::String::fromUTF8(npScript->UTF8Characters, npScript->UTF8Length);
    v8::Local<v8::Value> v8result = proxy->evaluate(WebCore::ScriptSourceCode(script, WebCore::KURL(WebCore::ParsedURLString, filename)), 0);

    if (v8result.IsEmpty())
        return false;

    convertV8ObjectToNPVariant(v8result, npObject, result);
    return true;
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:32,代码来源:NPV8Object.cpp


示例3: awe_webcore_update

extern "C" EXPORT_API void awe_webcore_update()
{
	WebCore* webCore = WebCore::instance();
	if (webCore)
	{
		webCore->Update();
	}
}
开发者ID:imclab,项目名称:AwesomiumUnity,代码行数:8,代码来源:WebCore.cpp


示例4: toJS

void LayoutTestController::setAutofilled(JSContextRef context, JSValueRef nodeObject, bool autofilled)
{
    JSC::ExecState* exec = toJS(context);
    WebCore::Element* element = toElement(toJS(exec, nodeObject));
    if (!element)
        return;
    WebCore::HTMLInputElement* inputElement = element->toInputElement();
    if (!inputElement)
        return;

    inputElement->setAutofilled(autofilled);
}
开发者ID:dzhshf,项目名称:WebKit,代码行数:12,代码来源:LayoutTestControllerBlackBerry.cpp


示例5: ASSERT

HRESULT STDMETHODCALLTYPE DOMElement::markerTextForListItem(
    /* [retval][out] */ BSTR* markerText)
{
    if (!markerText)
        return E_POINTER;

    ASSERT(m_element);

    *markerText = BString(WebCore::markerTextForListItem(m_element)).release();
    return S_OK;
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:11,代码来源:DOMCoreClasses.cpp


示例6: toString

HRESULT DOMRange::toString(BSTR* str)
{
    if (!str)
        return E_POINTER;

    if (!m_range)
        return E_UNEXPECTED;

    WebCore::ExceptionCode ec = 0;
    *str = BString(m_range->toString(ec)).release();

    return S_OK;
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:13,代码来源:DOMCoreClasses.cpp


示例7: _NPN_GetProperty

bool _NPN_GetProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName, NPVariant* result)
{
    if (!npObject)
        return false;

    if (npObject->_class == npScriptObjectClass) {
        V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);

        v8::HandleScope handleScope;
        v8::Handle<v8::Context> context = toV8Context(npp, npObject);
        if (context.IsEmpty())
            return false;

        v8::Context::Scope scope(context);

        v8::Handle<v8::Object> obj(object->v8Object);
        v8::Local<v8::Value> v8result = obj->Get(npIdentifierToV8Identifier(propertyName));

        convertV8ObjectToNPVariant(v8result, npObject, result);
        return true;
    }

    if (npObject->_class->hasProperty && npObject->_class->getProperty) {
        if (npObject->_class->hasProperty(npObject, propertyName))
            return npObject->_class->getProperty(npObject, propertyName, result);
    }

    VOID_TO_NPVARIANT(*result);
    return false;
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:30,代码来源:NPV8Object.cpp


示例8: _NPN_SetProperty

bool _NPN_SetProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName, const NPVariant* value)
{
    if (!npObject)
        return false;

    if (npObject->_class == npScriptObjectClass) {
        V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);

        v8::HandleScope handleScope;
        v8::Handle<v8::Context> context = toV8Context(npp, npObject);
        if (context.IsEmpty())
            return false;

        v8::Context::Scope scope(context);

        v8::Handle<v8::Object> obj(object->v8Object);
        obj->Set(npIdentifierToV8Identifier(propertyName),
                 convertNPVariantToV8Object(value, object->rootObject->frame()->script()->windowScriptNPObject()));
        return true;
    }

    if (npObject->_class->setProperty)
        return npObject->_class->setProperty(npObject, propertyName, value);

    return false;
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:26,代码来源:NPV8Object.cpp


示例9: _NPN_InvokeDefault

// FIXME: Fix it same as _NPN_Invoke (HandleScope and such).
bool _NPN_InvokeDefault(NPP npp, NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
{
    if (!npObject)
        return false;

    if (npObject->_class != npScriptObjectClass) {
        if (npObject->_class->invokeDefault)
            return npObject->_class->invokeDefault(npObject, arguments, argumentCount, result);

        VOID_TO_NPVARIANT(*result);
        return true;
    }

    V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject);

    VOID_TO_NPVARIANT(*result);

    v8::HandleScope handleScope;
    v8::Handle<v8::Context> context = toV8Context(npp, npObject);
    if (context.IsEmpty())
        return false;

    v8::Context::Scope scope(context);

    // Lookup the function object and call it.
    v8::Handle<v8::Object> functionObject(v8NpObject->v8Object);
    if (!functionObject->IsFunction())
        return false;

    v8::Local<v8::Value> resultObject;
    v8::Handle<v8::Function> function(v8::Function::Cast(*functionObject));
    if (!function->IsNull()) {
        V8Proxy* proxy = toV8Proxy(npObject);
        ASSERT(proxy);

        OwnArrayPtr<v8::Handle<v8::Value> > argv(createValueListFromVariantArgs(arguments, argumentCount, npObject));
        resultObject = proxy->callFunction(function, functionObject, argumentCount, argv.get());
    }
    // If we had an error, return false.  The spec is a little unclear here, but says "Returns true if the method was
    // successfully invoked".  If we get an error return value, was that successfully invoked?
    if (resultObject.IsEmpty())
        return false;

    convertV8ObjectToNPVariant(resultObject, npObject, result);
    return true;
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:47,代码来源:NPV8Object.cpp


示例10: _NPN_Enumerate

bool _NPN_Enumerate(NPP npp, NPObject* npObject, NPIdentifier** identifier, uint32_t* count)
{
    if (!npObject)
        return false;

    if (npObject->_class == npScriptObjectClass) {
        V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);

        v8::HandleScope handleScope;
        v8::Handle<v8::Context> context = toV8Context(npp, npObject);
        if (context.IsEmpty())
            return false;
        v8::Context::Scope scope(context);

        v8::Handle<v8::Object> obj(object->v8Object);

        // FIXME: http://b/issue?id=1210340: Use a v8::Object::Keys() method when it exists, instead of evaluating javascript.

        // FIXME: Figure out how to cache this helper function.  Run a helper function that collects the properties
        // on the object into an array.
        const char enumeratorCode[] =
            "(function (obj) {"
            "  var props = [];"
            "  for (var prop in obj) {"
            "    props[props.length] = prop;"
            "  }"
            "  return props;"
            "});";
        v8::Handle<v8::String> source = v8::String::New(enumeratorCode);
        v8::Handle<v8::Script> script = v8::Script::Compile(source, 0);
        v8::Handle<v8::Value> enumeratorObj = script->Run();
        v8::Handle<v8::Function> enumerator = v8::Handle<v8::Function>::Cast(enumeratorObj);
        v8::Handle<v8::Value> argv[] = { obj };
#if PLATFORM(ANDROID)
// TODO(benm): implement an arry size function on android
        v8::Local<v8::Value> propsObj = enumerator->Call(v8::Handle<v8::Object>::Cast(enumeratorObj), 1, argv);
#else
        v8::Local<v8::Value> propsObj = enumerator->Call(v8::Handle<v8::Object>::Cast(enumeratorObj), ARRAYSIZE_UNSAFE(argv), argv);
#endif
        if (propsObj.IsEmpty())
            return false;

        // Convert the results into an array of NPIdentifiers.
        v8::Handle<v8::Array> props = v8::Handle<v8::Array>::Cast(propsObj);
        *count = props->Length();
        *identifier = static_cast<NPIdentifier*>(malloc(sizeof(NPIdentifier*) * *count));
        for (uint32_t i = 0; i < *count; ++i) {
            v8::Local<v8::Value> name = props->Get(v8::Integer::New(i));
            (*identifier)[i] = getStringIdentifier(v8::Local<v8::String>::Cast(name));
        }
        return true;
    }

    if (NP_CLASS_STRUCT_VERSION_HAS_ENUM(npObject->_class) && npObject->_class->enumerate)
       return npObject->_class->enumerate(npObject, identifier, count);

    return false;
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:58,代码来源:NPV8Object.cpp


示例11: textContent

HRESULT STDMETHODCALLTYPE DOMNode::textContent( 
    /* [retval][out] */ BSTR* result)
{
    if (!result)
        return E_POINTER;

    *result = BString(m_node->textContent()).release();

    return S_OK;
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:10,代码来源:DOMCoreClasses.cpp


示例12: _NPN_Construct

bool _NPN_Construct(NPP npp, NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
{
    if (!npObject)
        return false;

    if (npObject->_class == npScriptObjectClass) {
        V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);

        v8::HandleScope handleScope;
        v8::Handle<v8::Context> context = toV8Context(npp, npObject);
        if (context.IsEmpty())
            return false;
        v8::Context::Scope scope(context);

        // Lookup the constructor function.
        v8::Handle<v8::Object> ctorObj(object->v8Object);
        if (!ctorObj->IsFunction())
            return false;

        // Call the constructor.
        v8::Local<v8::Value> resultObject;
        v8::Handle<v8::Function> ctor(v8::Function::Cast(*ctorObj));
        if (!ctor->IsNull()) {
            V8Proxy* proxy = toV8Proxy(npObject);
            ASSERT(proxy);

            OwnArrayPtr<v8::Handle<v8::Value> > argv(createValueListFromVariantArgs(arguments, argumentCount, npObject));
            resultObject = proxy->newInstance(ctor, argumentCount, argv.get());
        }

        if (resultObject.IsEmpty())
            return false;

        convertV8ObjectToNPVariant(resultObject, npObject, result);
        return true;
    }

    if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->construct)
        return npObject->_class->construct(npObject, arguments, argumentCount, result);

    return false;
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:42,代码来源:NPV8Object.cpp


示例13: shadowPseudoId

HRESULT STDMETHODCALLTYPE DOMElement::shadowPseudoId(
    /* [retval][out] */ BSTR* result)
{
    if (!result)
        return E_POINTER;

    ASSERT(m_element);

    *result = BString(m_element->shadowPseudoId().string()).release();
    return S_OK;
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:11,代码来源:DOMCoreClasses.cpp


示例14: nodeValue

HRESULT STDMETHODCALLTYPE DOMNode::nodeValue( 
    /* [retval][out] */ BSTR* result)
{
    if (!m_node)
        return E_FAIL;
    WTF::String nodeValueStr = m_node->nodeValue();
    *result = BString(nodeValueStr).release();
    if (nodeValueStr.length() && !*result)
        return E_OUTOFMEMORY;
    return S_OK;
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:11,代码来源:DOMCoreClasses.cpp


示例15: nodeName

HRESULT STDMETHODCALLTYPE DOMNode::nodeName( 
    /* [retval][out] */ BSTR* result)
{
    if (!result)
        return E_POINTER;

    if (!m_node)
        return E_FAIL;

    *result = BString(m_node->nodeName()).release();
    return S_OK;
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:12,代码来源:DOMCoreClasses.cpp


示例16: tagName

HRESULT STDMETHODCALLTYPE DOMElement::tagName( 
        /* [retval][out] */ BSTR* result)
{
    if (!m_element)
        return E_FAIL;

    if (!result)
        return E_POINTER;

    *result = BString(m_element->tagName()).release();
    return S_OK;
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:12,代码来源:DOMCoreClasses.cpp


示例17: getAttribute

HRESULT STDMETHODCALLTYPE DOMElement::getAttribute( 
        /* [in] */ BSTR name,
        /* [retval][out] */ BSTR* result)
{
    if (!m_element)
        return E_FAIL;
    WTF::String nameString(name, SysStringLen(name));
    WTF::String& attrValueString = (WTF::String&) m_element->getAttribute(nameString);
    *result = BString(attrValueString).release();
    if (attrValueString.length() && !*result)
        return E_OUTOFMEMORY;
    return S_OK;
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:13,代码来源:DOMCoreClasses.cpp


示例18: _NPN_SetException

void _NPN_SetException(NPObject* npObject, const NPUTF8 *message)
{
    if (npObject->_class != npScriptObjectClass) {
        // We won't be able to find a proper scope for this exception, so just throw it.
        // This is consistent with JSC, which throws a global exception all the time.
        V8Proxy::throwError(V8Proxy::GeneralError, message);
        return;
    }
    v8::HandleScope handleScope;
    v8::Handle<v8::Context> context = toV8Context(0, npObject);
    if (context.IsEmpty())
        return;

    v8::Context::Scope scope(context);
    V8Proxy::throwError(V8Proxy::GeneralError, message);
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:16,代码来源:NPV8Object.cpp


示例19: innerText

HRESULT STDMETHODCALLTYPE DOMElement::innerText(
    /* [retval][out] */ BSTR* result)
{
    if (!result) {
        ASSERT_NOT_REACHED();
        return E_POINTER;
    }

    if (!m_element) {
        ASSERT_NOT_REACHED();
        return E_FAIL;
    }

    *result = BString(m_element->innerText()).release();
    return S_OK;
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:16,代码来源:DOMCoreClasses.cpp


示例20: _NPN_SetException

void _NPN_SetException(NPObject* npObject, const NPUTF8 *message)
{
    if (!npObject || npObject->_class != npScriptObjectClass) {
        // We won't be able to find a proper scope for this exception, so just throw it.
        // This is consistent with JSC, which throws a global exception all the time.
#if PLATFORM(ANDROID)
        // However, if there isn't a v8 context, throw the error away as there really isn't anything useful to do with it.
        if (v8::Context::InContext())
            V8Proxy::throwError(V8Proxy::GeneralError, message);
#endif
        return;
    }
    v8::HandleScope handleScope;
    v8::Handle<v8::Context> context = toV8Context(0, npObject);
    if (context.IsEmpty())
        return;

    v8::Context::Scope scope(context);
    V8Proxy::throwError(V8Proxy::GeneralError, message);
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:20,代码来源:NPV8Object.cpp



注:本文中的WebCore类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WebCoreSynchronousLoader类代码示例发布时间:2022-05-31
下一篇:
C++ WebCookieJar类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap