Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1341)

Unified Diff: Source/web/WebViewImpl.cpp

Issue 102963005: Add supportsInputMethod() interface for WebPlugin. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add comments. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | public/web/WebPlugin.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index b9914471a160362749da4e8daa39cfddf0c3d4f1..981ad9849c2666c9607cebcd7be2e88526e523e1 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,14 @@ InputMethodContext* WebViewImpl::inputMethodContext()
return 0;
}
+WebPlugin* WebViewImpl::focusedPluginIfInputMethodSupported(Frame* frame)
+{
+ WebPluginContainerImpl* container = WebFrameImpl::pluginContainerFromNode(frame, WebNode(focusedElement()));
+ if (container && container->supportsInputMethod())
+ return container->plugin();
+ return 0;
+}
+
void WebViewImpl::didShowCandidateWindow()
{
if (InputMethodContext* context = inputMethodContext())
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | public/web/WebPlugin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698