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

Unified Diff: content/renderer/render_view.cc

Issue 6990072: The first step for enabling off-the-spot IME on Pepper on ChromeOS/Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed a silly mistake lacking an initialization. Created 9 years, 7 months 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 | « content/renderer/render_view.h ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view.cc
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc
index 4cbe162e01b4196609bff7f1d1a875c50124eda8..f87e94660c2b357849fc923f189b5336174fa191 100644
--- a/content/renderer/render_view.cc
+++ b/content/renderer/render_view.cc
@@ -89,6 +89,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifier.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h"
@@ -3936,6 +3937,60 @@ void RenderView::OnSetFocus(bool enable) {
}
}
+void RenderView::PpapiPluginFocusChanged() {
+ UpdateInputMethod();
+}
+
+void RenderView::OnImeSetComposition(
+ const string16& text,
+ const std::vector<WebKit::WebCompositionUnderline>& underlines,
+ int selection_start,
+ int selection_end) {
+ // Until PPAPI has an interface for handling IME events, we skip sending
+ // OnImeSetComposition. Otherwise the composition is canceled when a
+ // non-editable DOM element is focused.
+ //
+ // TODO(kinaba) This temporal remedy can be removed after PPAPI is extended
+ // with an IME handling interface.
+ if (!pepper_delegate_.IsPluginFocused()) {
+ RenderWidget::OnImeSetComposition(text,
+ underlines,
+ selection_start,
+ selection_end);
+ }
+}
+
+void RenderView::OnImeConfirmComposition(const string16& text) {
+ if (pepper_delegate_.IsPluginFocused()) {
+ // TODO(kinaba) Until PPAPI has an interface for handling IME events, we
+ // send character events.
+ for (size_t i = 0; i < text.size(); ++i) {
+ WebKit::WebKeyboardEvent char_event;
+ char_event.type = WebKit::WebInputEvent::Char;
+ char_event.timeStampSeconds = base::Time::Now().ToDoubleT();
+ char_event.modifiers = 0;
+ char_event.windowsKeyCode = text[i];
+ char_event.nativeKeyCode = text[i];
+ char_event.text[0] = text[i];
+ char_event.unmodifiedText[0] = text[i];
+ if (webwidget_)
+ webwidget_->handleInputEvent(char_event);
+ }
+ } else {
+ RenderWidget::OnImeConfirmComposition(text);
+ }
+}
+
+WebKit::WebTextInputType RenderView::GetTextInputType() {
+ if (pepper_delegate_.IsPluginFocused()) {
+ // TODO(kinaba) Until PPAPI has an interface for handling IME events, we
+ // consider all the parts of PPAPI plugins are accepting text inputs.
+ return WebKit::WebTextInputTypeText;
+ } else {
+ return RenderWidget::GetTextInputType();
+ }
+}
+
#if defined(OS_MACOSX)
void RenderView::PluginFocusChanged(bool focused, int plugin_id) {
IPC::Message* msg = new ViewHostMsg_PluginFocusChanged(routing_id(),
« no previous file with comments | « content/renderer/render_view.h ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698