diff options
author | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-15 03:22:32 +0000 |
---|---|---|
committer | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-15 03:22:32 +0000 |
commit | 51fcbab1bcd1995b4c5c13dc371200ad557a5cfb (patch) | |
tree | fd12cfbd66c07c9486e60aba23c1e4ac19b3d03c /webkit | |
parent | 7410acb43f5ec233007662abf8bf53ce413fa785 (diff) | |
download | chromium_src-51fcbab1bcd1995b4c5c13dc371200ad557a5cfb.zip chromium_src-51fcbab1bcd1995b4c5c13dc371200ad557a5cfb.tar.gz chromium_src-51fcbab1bcd1995b4c5c13dc371200ad557a5cfb.tar.bz2 |
A fix for Issue 2673 in chromium: "Flash: IME not available".
To investigate this issue deeply, I noticed this issue consisted of two issues:
1. Windows cannot attach IMEs to a plug-in process.
Somehow, Windows attaches IMEs (i.e. loads IME DLLs, attaches them to a process, and adds message hooks to a window) while creating a top-level window. On the other hand, a plug-in process does not create any top-level windows. These facts prevent Windows from attaching IMEs to windowed plug-ins.
2. The CallWindowProc() function does not dispatch messages to the message-hook functions used by IMEs.
When the |plugin_wnd_proc_| value is a handle referring the DefWindowProc() function, it seems the CallWindowProc() does not dispatch messages to the hook functions used by IMEs.
To fix the former issue, this change once creates a top-level window and have Windows attach IMEs to this window, and change the window to a client window of the given parent window.
To fix the latter issue, this change creates a dummy window procedure WebPluginDelegateImpl::DummyWindowProc(), which just encapsulates the DefWindowProc(), and use it instead of the DefWindowProc() function.
BUG=2673
Review URL: http://codereview.chromium.org/4325
Review URL: http://codereview.chromium.org/4325
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3391 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.cc | 30 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.h | 2 |
2 files changed, 30 insertions, 2 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc index fa2a64f..e0c74ed 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl.cc @@ -369,7 +369,7 @@ bool WebPluginDelegateImpl::WindowedCreatePlugin() { WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, kNativeWindowClassName, 0, - WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, + WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0, 0, 0, @@ -381,6 +381,21 @@ bool WebPluginDelegateImpl::WindowedCreatePlugin() { if (windowed_handle_ == 0) return false; + if (IsWindow(parent_)) { + // This is a tricky workaround for Issue 2673 in chromium "Flash: IME not + // available". To use IMEs in this window, we have to make Windows attach + // IMEs to this window (i.e. load IME DLLs, attach them to this process, + // and add their message hooks to this window). Windows attaches IMEs while + // this process creates a top-level window. On the other hand, to layout + // this window correctly in the given parent window (RenderWidgetHostHWND), + // this window should be a child window of the parent window. + // To satisfy both of the above conditions, this code once creates a + // top-level window and change it to a child window of the parent window. + SetWindowLongPtr(windowed_handle_, GWL_STYLE, + WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); + SetParent(windowed_handle_, parent_); + } + BOOL result = SetProp(windowed_handle_, kWebPluginDelegateProperty, this); DCHECK(result == TRUE) << "SetProp failed, last error = " << GetLastError(); // Get the name of the plugin, create an atom and set that in a window @@ -706,7 +721,7 @@ ATOM WebPluginDelegateImpl::RegisterNativeWindowClass() { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_DBLCLKS; - wcex.lpfnWndProc = DefWindowProc; + wcex.lpfnWndProc = DummyWindowProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = GetModuleHandle(NULL); @@ -725,6 +740,17 @@ ATOM WebPluginDelegateImpl::RegisterNativeWindowClass() { return RegisterClassEx(&wcex); } +LRESULT CALLBACK WebPluginDelegateImpl::DummyWindowProc( + HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { + // This is another workaround for Issue 2673 in chromium "Flash: IME not + // available". Somehow, the CallWindowProc() function does not dispatch + // window messages when its first parameter is a handle representing the + // DefWindowProc() function. To avoid this problem, this code creates a + // wrapper function which just encapsulates the DefWindowProc() function + // and set it as the window procedure of a windowed plug-in. + return DefWindowProc(hWnd, message, wParam, lParam); +} + LRESULT CALLBACK WebPluginDelegateImpl::NativeWndProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { WebPluginDelegateImpl* delegate = reinterpret_cast<WebPluginDelegateImpl*>( diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h index 51d0b9b..f3131f1 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.h +++ b/webkit/glue/plugins/webplugin_delegate_impl.h @@ -132,6 +132,8 @@ class WebPluginDelegateImpl : public WebPluginDelegate { ATOM RegisterNativeWindowClass(); // Our WndProc functions. + static LRESULT CALLBACK DummyWindowProc( + HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK NativeWndProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); static LRESULT CALLBACK FlashWindowlessWndProc( |