libcef: Update due to underlying chromium changes.

- Fix problem displaying select lists due to ordering of focus events in WebWidgetHost::MouseEvent()  (issue #17).
- Add new BrowserWebKitInit class and related webkit_glue changes.
- Add webkit_glue::InitializeTextEncoding() function called from the main thread in CefContext::Initialize() to avoid an assert in  third_party\WebKit\WebCore\platform\text\TextEncodingRegistry.cpp buildBaseTextCodecMaps().
- V8NPObject::v8_object member renamed to V8NPObject::v8Object.
- Add WebKit project dependency.

libcef_dll:
- Fix crash when creating a popup window due to not duplicating the m_windowName member in cpptoc\handler_cpptoc.cc handler_handle_before_created().

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@17 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2009-03-05 17:14:16 +00:00
parent 35e21da884
commit a5bdcddd1e
16 changed files with 251 additions and 148 deletions

View File

@@ -167,6 +167,7 @@ void CefBrowserImpl::ExecuteJavaScript(const std::wstring& jsCode,
bool CefBrowserImpl::AddJSHandler(const std::wstring& classname,
CefRefPtr<CefJSHandler> handler)
{
DCHECK(handler.get());
bool rv = false;
Lock();

View File

@@ -46,6 +46,7 @@
#include "net/base/io_buffer.h"
#include "net/base/net_util.h"
#include "net/base/upload_data.h"
#include "net/http/http_response_headers.h"
#include "net/proxy/proxy_service.h"
#include "net/url_request/url_request.h"
#include "webkit/glue/resource_loader_bridge.h"
@@ -601,36 +602,6 @@ ResourceLoaderBridge* ResourceLoaderBridge::Create(
method, url, policy_url, referrer, headers, load_flags);
}
void SetCookie(const GURL& url, const GURL& policy_url,
const std::string& cookie) {
// Proxy to IO thread to synchronize w/ network loading.
if (!EnsureIOThread()) {
NOTREACHED();
return;
}
scoped_refptr<CookieSetter> cookie_setter = new CookieSetter();
io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
cookie_setter.get(), &CookieSetter::Set, url, cookie));
}
std::string GetCookies(const GURL& url, const GURL& policy_url) {
// Proxy to IO thread to synchronize w/ network loading
if (!EnsureIOThread()) {
NOTREACHED();
return std::string();
}
scoped_refptr<CookieGetter> getter = new CookieGetter();
io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
getter.get(), &CookieGetter::Get, url));
return getter->GetResult();
}
// Issue the proxy resolve request on the io thread, and wait
// for the result.
bool FindProxyForUrl(const GURL& url, std::string* proxy_list) {
@@ -643,12 +614,21 @@ bool FindProxyForUrl(const GURL& url, std::string* proxy_list) {
net::ProxyInfo proxy_info;
int rv = sync_proxy_service->ResolveProxy(url, &proxy_info);
if (rv == net::OK) {
*proxy_list = proxy_info.GetAnnotatedProxyList();
*proxy_list = proxy_info.ToPacString();
}
return rv == net::OK;
}
void SetCookie(const GURL& url, const GURL& policy_url,
const std::string& cookie) {
BrowserResourceLoaderBridge::SetCookie(url, policy_url, cookie);
}
std::string GetCookies(const GURL& url, const GURL& policy_url) {
return BrowserResourceLoaderBridge::GetCookies(url, policy_url);
}
} // namespace webkit_glue
//-----------------------------------------------------------------------------
@@ -676,3 +656,34 @@ void BrowserResourceLoaderBridge::Shutdown() {
DCHECK(!request_context) << "should have been nulled by thread dtor";
}
}
void BrowserResourceLoaderBridge::SetCookie(
const GURL& url, const GURL& policy_url, const std::string& cookie) {
// Proxy to IO thread to synchronize w/ network loading.
if (!EnsureIOThread()) {
NOTREACHED();
return;
}
scoped_refptr<CookieSetter> cookie_setter = new CookieSetter();
io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
cookie_setter.get(), &CookieSetter::Set, url, cookie));
}
std::string BrowserResourceLoaderBridge::GetCookies(
const GURL& url, const GURL& policy_url) {
// Proxy to IO thread to synchronize w/ network loading
if (!EnsureIOThread()) {
NOTREACHED();
return std::string();
}
scoped_refptr<CookieGetter> getter = new CookieGetter();
io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
getter.get(), &CookieGetter::Get, url));
return getter->GetResult();
}

View File

@@ -6,8 +6,9 @@
#ifndef _BROWSER_RESOURCE_LOADER_BRIDGE_H
#define _BROWSER_RESOURCE_LOADER_BRIDGE_H
#include "base/ref_counted.h"
#include <string>
class GURL;
class URLRequestContext;
class BrowserResourceLoaderBridge {
@@ -26,6 +27,12 @@ class BrowserResourceLoaderBridge {
// Call this function to shutdown the simple resource loader bridge.
static void Shutdown();
// May only be called after Init.
static void SetCookie(
const GURL& url, const GURL& policy_url, const std::string& cookie);
static std::string GetCookies(
const GURL& url, const GURL& policy_url);
};
#endif // _BROWSER_RESOURCE_LOADER_BRIDGE_H

View File

@@ -12,6 +12,7 @@
#include "webkit_version.h"
MSVC_PUSH_WARNING_LEVEL(0);
#include "Markup.h"
#include "TextEncoding.h"
#include "webkit/glue/webframe_impl.h"
MSVC_POP_WARNING();
@@ -22,11 +23,12 @@ MSVC_POP_WARNING();
#include "base/win_util.h"
#include "net/base/mime_util.h"
#include "webkit/glue/glue_util.h"
#include "webkit/glue/screen_info.h"
#include "webkit/glue/webframe.h"
#include "webkit/glue/webkit_glue.h"
// Generated by GRIT
#include "webkit_resources.h"
#include "grit/webkit_resources.h"
namespace webkit_glue {
@@ -34,28 +36,12 @@ bool IsMediaPlayerAvailable() {
return true;
}
void PrefetchDns(const std::string& hostname) {}
void PrecacheUrl(const char16* url, int url_length) {}
void AppendToLog(const char* file, int line, const char* msg) {
logging::LogMessage(file, line).stream() << msg;
}
bool GetMimeTypeFromExtension(const std::wstring &ext, std::string *mime_type) {
return net::GetMimeTypeFromExtension(ext, mime_type);
}
bool GetMimeTypeFromFile(const std::wstring &file_path,
std::string *mime_type) {
return net::GetMimeTypeFromFile(file_path, mime_type);
}
bool GetPreferredExtensionForMimeType(const std::string& mime_type,
std::wstring* ext) {
return net::GetPreferredExtensionForMimeType(mime_type, ext);
}
std::string GetDataResource(int resource_id) {
if (resource_id == IDR_BROKENIMAGE) {
// Use webkit's broken image icon (16x16)
@@ -176,4 +162,8 @@ ScreenInfo GetScreenInfo(gfx::NativeViewId window) {
return GetScreenInfoHelper(gfx::NativeViewFromId(window));
}
void InitializeTextEncoding() {
WebCore::UTF8Encoding();
}
} // namespace webkit_glue

View File

@@ -21,4 +21,7 @@ void CaptureWebViewBitmap(HWND mainWnd, WebView* webview, HBITMAP& bitmap,
BOOL SaveBitmapToFile(HBITMAP hBmp, HDC hDC, LPCTSTR file, LPBYTE lpBits);
#endif
// Text encoding objects must be initialized on the main thread.
void InitializeTextEncoding();
} // namespace webkit_glue

View File

@@ -0,0 +1,58 @@
// Copyright (c) 2009 The Chromium Embedded Framework Authors.
// Portions copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef _BROWSER_WEBKIT_INIT_H
#define _BROWSER_WEBKIT_INIT_H
#include "base/string_util.h"
#include "webkit/glue/simple_webmimeregistry_impl.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webkitclient_impl.h"
#include "browser_resource_loader_bridge.h"
#include "WebKit.h"
#include "WebString.h"
#include "WebURL.h"
class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
public:
BrowserWebKitInit() {
WebKit::initialize(this);
WebKit::setLayoutTestMode(false);
WebKit::registerURLSchemeAsLocal(
ASCIIToUTF16(webkit_glue::GetUIResourceProtocol()));
}
~BrowserWebKitInit() {
WebKit::shutdown();
}
virtual WebKit::WebMimeRegistry* mimeRegistry() {
return &mime_registry_;
}
virtual void setCookies(
const WebKit::WebURL& url, const WebKit::WebURL& policy_url,
const WebKit::WebString& value) {
BrowserResourceLoaderBridge::SetCookie(url, policy_url, UTF16ToUTF8(value));
}
virtual WebKit::WebString cookies(
const WebKit::WebURL& url, const WebKit::WebURL& policy_url) {
return UTF8ToUTF16(BrowserResourceLoaderBridge::GetCookies(url, policy_url));
}
virtual void prefetchHostName(const WebKit::WebString&) {
}
virtual WebKit::WebString defaultLocale() {
return ASCIIToUTF16("en-US");
}
private:
webkit_glue::SimpleWebMimeRegistryImpl mime_registry_;
};
#endif // _BROWSER_WEBKIT_INIT_H

View File

@@ -8,6 +8,7 @@
#include "browser_impl.h"
#include "browser_resource_loader_bridge.h"
#include "browser_request_context.h"
#include "browser_webkit_glue.h"
#include "../include/cef_nplugin.h"
#include "base/command_line.h"
@@ -298,6 +299,9 @@ bool CefContext::Initialize(bool multi_threaded_message_loop)
};
RegisterClassEx(&wcex);
// Initialize WebKit encodings
webkit_glue::InitializeTextEncoding();
// Initialize web preferences
webprefs_ = new WebPreferences;
*webprefs_ = WebPreferences();

View File

@@ -10,7 +10,8 @@
#include "base/at_exit.h"
#include "base/message_loop.h"
#include "base/gfx/native_widget_types.h"
#include "webkit/glue/webpreferences.h"
#include "webkit/glue/webpreferences.h"
#include "browser_webkit_init.h"
class CefBrowserImpl;
@@ -68,8 +69,10 @@ protected:
WebPreferences* webprefs_;
StatsTable* statstable_;
// Instantiate the AtExitManager to avoid asserts and possible memory leaks.
// Initialize the AtExitManager to avoid asserts and possible memory leaks.
base::AtExitManager at_exit_manager_;
// Initialize WebKit for this scope.
BrowserWebKitInit webkit_init_;
friend DWORD WINAPI ThreadHandlerUI(LPVOID lpParam);
};

View File

@@ -299,6 +299,10 @@
RelativePath=".\browser_webkit_glue_win.cc"
>
</File>
<File
RelativePath=".\browser_webkit_init.h"
>
</File>
<File
RelativePath=".\browser_webview_delegate.cc"
>

View File

@@ -3,6 +3,6 @@
ProjectType="Visual C++"
Version="8.00"
Name="webkit_common"
InheritedPropertySheets=".\libcef_webkit_includes.vsprops;$(SolutionDir)..\webkit\build\webkit_common_defines.vsprops;$(SolutionDir)..\webkit\build\js_engine$(JS_ENGINE_TYPE).vsprops;$(SolutionDir)..\third_party\npapi\using_npapi.vsprops;$(SolutionDir)..\skia\using_skia.vsprops;$(SolutionDir)..\build\external_code.vsprops;$(SolutionDir)..\third_party\icu38\build\using_icu.vsprops"
InheritedPropertySheets=".\libcef_webkit_includes.vsprops;$(SolutionDir)..\webkit\build\webkit_common_defines.vsprops;$(SolutionDir)..\webkit\build\js_engine$(JS_ENGINE_TYPE).vsprops;$(SolutionDir)..\third_party\npapi\using_npapi.vsprops;$(SolutionDir)..\skia\using_skia.vsprops;$(SolutionDir)..\build\external_code.vsprops;$(SolutionDir)..\third_party\icu38\build\using_icu.vsprops;$(SolutionDir)..\webkit\build\webkit\using_WebKit.vsprops"
>
</VisualStudioPropertySheet>

View File

@@ -6,6 +6,6 @@
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(OutDir)\obj\WebCore&quot;;&quot;$(OutDir)\obj\WebCore\JavaScriptHeaders&quot;;&quot;$(OutDir)\obj\WebCore\JavaScriptHeaders\JavaScriptCore&quot;;&quot;$(SolutionDir)..\webkit\pending\&quot;;&quot;$(SolutionDir)..\webkit\port\platform&quot;;&quot;$(SolutionDir)..\webkit\port\platform\image-decoders&quot;;&quot;$(SolutionDir)..\webkit\port\platform\image-decoders\bmp&quot;;&quot;$(SolutionDir)..\webkit\port\platform\image-decoders\gif&quot;;&quot;$(SolutionDir)..\webkit\port\platform\image-decoders\ico&quot;;&quot;$(SolutionDir)..\webkit\port\platform\image-decoders\jpeg&quot;;&quot;$(SolutionDir)..\webkit\port\platform\image-decoders\png&quot;;&quot;$(SolutionDir)..\webkit\port\platform\image-decoders\xbm&quot;;&quot;$(SolutionDir)..\webkit&quot;;&quot;$(SolutionDir)..\webkit\build&quot;;&quot;$(ProjectDir)&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\bridge&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\bridge\c&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\css&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\dom&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\editing&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\history&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\html&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\loader&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\loader\appcache&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\loader\archive&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\loader\icon&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\page&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\page\animation&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\text&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics\chromium&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\svg\graphics&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\network&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\sql&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\rendering&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\rendering\style&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\storage&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\xml&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\os-win32&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\wtf&quot;;&quot;$(SolutionDir)..\third_party\WebKit\JavaScriptCore&quot;;&quot;$(SolutionDir)..\third_party\WebKit\JavaScriptCore\wtf&quot;;&quot;$(SolutionDir)..\third_party\WebKit\JavaScriptCore\os-win32&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\svg&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\svg\animation&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\svg\graphics\filters&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\plugins&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\inspector&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\chromium&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics\skia&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\network\chromium&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\animation&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics\transforms&quot;;&quot;$(SolutionDir)..\third_party\sqlite&quot;;&quot;$(SDKIncludes)&quot;;&quot;$(IntDir)\..\WebCore\DerivedSources&quot;;"
AdditionalIncludeDirectories="&quot;$(OutDir)\obj\WebCore&quot;;&quot;$(OutDir)\obj\WebCore\JavaScriptHeaders&quot;;&quot;$(OutDir)\obj\WebCore\JavaScriptHeaders\JavaScriptCore&quot;;&quot;$(SolutionDir)..\webkit\pending\&quot;;&quot;$(SolutionDir)..\webkit\port\platform&quot;;&quot;$(SolutionDir)..\webkit\port\platform\image-decoders&quot;;&quot;$(SolutionDir)..\webkit\port\platform\image-decoders\bmp&quot;;&quot;$(SolutionDir)..\webkit\port\platform\image-decoders\gif&quot;;&quot;$(SolutionDir)..\webkit\port\platform\image-decoders\ico&quot;;&quot;$(SolutionDir)..\webkit\port\platform\image-decoders\jpeg&quot;;&quot;$(SolutionDir)..\webkit\port\platform\image-decoders\png&quot;;&quot;$(SolutionDir)..\webkit\port\platform\image-decoders\xbm&quot;;&quot;$(SolutionDir)..\webkit&quot;;&quot;$(SolutionDir)..\webkit\build&quot;;&quot;$(ProjectDir)&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\bindings\v8&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\bridge&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\bridge\c&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\css&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\dom&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\editing&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\history&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\html&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\loader&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\loader\appcache&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\loader\archive&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\loader\icon&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\page&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\page\animation&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\text&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics\chromium&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\svg\graphics&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\network&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\sql&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\rendering&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\rendering\style&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\storage&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\xml&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\os-win32&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\wtf&quot;;&quot;$(SolutionDir)..\third_party\WebKit\JavaScriptCore&quot;;&quot;$(SolutionDir)..\third_party\WebKit\JavaScriptCore\wtf&quot;;&quot;$(SolutionDir)..\third_party\WebKit\JavaScriptCore\os-win32&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\svg&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\svg\animation&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\svg\graphics\filters&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\plugins&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\inspector&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\chromium&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics\skia&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\network\chromium&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\animation&quot;;&quot;$(SolutionDir)..\third_party\WebKit\WebCore\platform\graphics\transforms&quot;;&quot;$(SolutionDir)..\third_party\sqlite&quot;;&quot;$(SDKIncludes)&quot;;&quot;$(IntDir)\..\WebCore\DerivedSources&quot;;"
/>
</VisualStudioPropertySheet>

View File

@@ -79,10 +79,10 @@ bool _NPN_ArrayObjectToStringVector(NPObject* npobject,
return false;
V8NPObject *object = reinterpret_cast<V8NPObject*>(npobject);
if (!object->v8_object->IsArray())
if (!object->v8Object->IsArray())
return false;
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(object->v8_object);
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(object->v8Object);
for (uint32_t i = 0; i < array->Length(); i++) {
v8::Local<v8::Value> value = array->Get(v8::Integer::New(i));
v8::Local<v8::String> sval = value->ToString();
@@ -102,10 +102,10 @@ bool _NPN_ArrayObjectToWStringVector(NPObject* npobject,
return false;
V8NPObject *object = reinterpret_cast<V8NPObject*>(npobject);
if (!object->v8_object->IsArray())
if (!object->v8Object->IsArray())
return false;
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(object->v8_object);
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(object->v8Object);
for (uint32_t i = 0; i < array->Length(); i++) {
v8::Local<v8::Value> value = array->Get(v8::Integer::New(i));
v8::Local<v8::String> sval = value->ToString();
@@ -125,10 +125,10 @@ bool _NPN_ArrayObjectToIntVector(NPObject* npobject,
return false;
V8NPObject *object = reinterpret_cast<V8NPObject*>(npobject);
if (!object->v8_object->IsArray())
if (!object->v8Object->IsArray())
return false;
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(object->v8_object);
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(object->v8Object);
for (uint32_t i = 0; i < array->Length(); i++) {
v8::Local<v8::Value> value = array->Get(v8::Integer::New(i));
v8::Local<v8::Int32> ival = value->ToInt32();
@@ -144,10 +144,10 @@ bool _NPN_ArrayObjectToDoubleVector(NPObject* npobject,
return false;
V8NPObject *object = reinterpret_cast<V8NPObject*>(npobject);
if (!object->v8_object->IsArray())
if (!object->v8Object->IsArray())
return false;
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(object->v8_object);
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(object->v8Object);
for (uint32_t i = 0; i < array->Length(); i++) {
v8::Local<v8::Value> value = array->Get(v8::Integer::New(i));
v8::Local<v8::Number> dval = value->ToNumber();
@@ -163,10 +163,10 @@ bool _NPN_ArrayObjectToBooleanVector(NPObject* npobject,
return false;
V8NPObject *object = reinterpret_cast<V8NPObject*>(npobject);
if (!object->v8_object->IsArray())
if (!object->v8Object->IsArray())
return false;
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(object->v8_object);
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(object->v8Object);
for (uint32_t i = 0; i < array->Length(); i++) {
v8::Local<v8::Value> value = array->Get(v8::Integer::New(i));
v8::Local<v8::Boolean> bval = value->ToBoolean();
@@ -182,10 +182,10 @@ int _NPN_ArrayObjectGetVectorSize(NPObject* npobject)
return -1;
V8NPObject *object = reinterpret_cast<V8NPObject*>(npobject);
if (!object->v8_object->IsArray())
if (!object->v8Object->IsArray())
return -1;
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(object->v8_object);
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(object->v8Object);
return array->Length();
}
@@ -196,10 +196,10 @@ bool _NPN_ArrayObjectToVectorTypeHint(NPObject* npobject,
return false;
V8NPObject *object = reinterpret_cast<V8NPObject*>(npobject);
if (!object->v8_object->IsArray())
if (!object->v8Object->IsArray())
return false;
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(object->v8_object);
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(object->v8Object);
if (array->Length() == 0)
return false;

View File

@@ -144,7 +144,11 @@ void WebWidgetHost::DidInvalidateRect(const gfx::Rect& damaged_rect) {
}
void WebWidgetHost::DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect) {
DCHECK(dx || dy);
if (dx != 0 && dy != 0) {
// We only support uni-directional scroll
DidScrollRect(0, dy, clip_rect);
dy = 0;
}
// If we already have a pending scroll operation or if this scroll operation
// intersects the existing paint region, then just failover to invalidating.
@@ -188,7 +192,6 @@ WebWidgetHost::~WebWidgetHost() {
TrackMouseLeave(false);
webwidget_->Close();
webwidget_->Release();
}
bool WebWidgetHost::WndProc(UINT message, WPARAM wparam, LPARAM lparam) {
@@ -282,6 +285,11 @@ void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) {
break;
case WebInputEvent::MOUSE_DOWN:
SetCapture(view_);
// This mimics a temporary workaround in RenderWidgetHostViewWin
// for bug 765011 to get focus when the mouse is clicked. This
// happens after the mouse down event is sent to the renderer
// because normally Windows does a WM_SETFOCUS after WM_LBUTTONDOWN.
::SetFocus(view_);
break;
case WebInputEvent::MOUSE_UP:
if (GetCapture() == view_)
@@ -289,14 +297,6 @@ void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) {
break;
}
webwidget_->HandleInputEvent(&event);
if (event.type == WebInputEvent::MOUSE_DOWN) {
// This mimics a temporary workaround in RenderWidgetHostViewWin
// for bug 765011 to get focus when the mouse is clicked. This
// happens after the mouse down event is sent to the renderer
// because normally Windows does a WM_SETFOCUS after WM_LBUTTONDOWN.
::SetFocus(view_);
}
}
void WebWidgetHost::WheelEvent(WPARAM wparam, LPARAM lparam) {