Chromium Code Reviews| Index: Source/web/WebViewImpl.cpp |
| diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp |
| index b9914471a160362749da4e8daa39cfddf0c3d4f1..49140a2ab12ddc26658d046ed57166957c753e11 100644 |
| --- a/Source/web/WebViewImpl.cpp |
| +++ b/Source/web/WebViewImpl.cpp |
| @@ -88,6 +88,7 @@ |
| #include "core/events/WheelEvent.h" |
| #include "core/html/HTMLInputElement.h" |
| #include "core/html/HTMLMediaElement.h" |
| +#include "core/html/HTMLPlugInElement.h" |
| #include "core/html/HTMLTextAreaElement.h" |
| #include "core/html/HTMLVideoElement.h" |
| #include "core/html/ime/InputMethodContext.h" |
| @@ -2063,6 +2064,9 @@ bool WebViewImpl::setComposition( |
| if (!focused || !m_imeAcceptEvents) |
| return false; |
| + if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused)) |
| + return plugin->setComposition(text, underlines, selectionStart, selectionEnd); |
| + |
| // The input focus has been moved to another WebWidget object. |
| // We should use this |editor| object only to complete the ongoing |
| // composition. |
| @@ -2125,6 +2129,10 @@ bool WebViewImpl::confirmComposition(const WebString& text, ConfirmCompositionBe |
| Frame* focused = focusedWebCoreFrame(); |
| if (!focused || !m_imeAcceptEvents) |
| return false; |
| + |
| + if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused)) |
| + return plugin->confirmComposition(text, selectionBehavior); |
| + |
| return focused->inputMethodController().confirmCompositionOrInsertText(text, selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : InputMethodController::DoNotKeepSelection); |
| } |
| @@ -2333,6 +2341,20 @@ InputMethodContext* WebViewImpl::inputMethodContext() |
| return 0; |
| } |
| +WebPlugin* WebViewImpl::focusedPluginIfInputMethodSupported(Frame* frame) |
| +{ |
| + WebPluginContainerImpl* container = WebFrameImpl::pluginContainerFromFrame(frame); |
|
tkent
2013/12/10 08:41:26
Maybe you can use WebFrameImpl::pluginContainerFro
kochi
2013/12/10 08:48:20
Done.
looks nice.
|
| + if (!container) { |
| + Element* element = focusedElement(); |
| + if (element && element->isPluginElement()) |
| + container = toPluginContainerImpl(toHTMLPlugInElement(element)->pluginWidget()); |
| + } |
| + |
| + if (container && container->supportsInputMethod()) |
| + return container->plugin(); |
| + return 0; |
| +} |
| + |
| void WebViewImpl::didShowCandidateWindow() |
| { |
| if (InputMethodContext* context = inputMethodContext()) |