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

Unified Diff: content/renderer/render_widget.cc

Issue 10962011: Allow tap gestures to open the IME on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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_widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index ccff877d8d0426b74c3a330227ee3c7b89c9d3d2..d275215edb35c74b63cafb0fded357694e910e97 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -605,6 +605,13 @@ void RenderWidget::OnHandleInputEvent(const IPC::Message& message) {
Send(response);
}
+#if defined(OS_ANDROID)
+ // Allow the IME to be shown when the focus changes as a consequence
+ // of a processed touch end event.
+ if (input_event->type == WebInputEvent::TouchEnd && processed)
+ UpdateTextInputState(SHOW_IME_IF_NEEDED);
+#endif
+
handling_input_event_ = false;
if (!prevent_default) {
@@ -873,7 +880,7 @@ void RenderWidget::DoDeferredUpdate() {
// The following two can result in further layout and possibly
// enable GPU acceleration so they need to be called before any painting
// is done.
- UpdateTextInputState();
+ UpdateTextInputState(DO_NOT_SHOW_IME);
UpdateSelectionBounds();
// Suppress painting if nothing is dirty. This has to be done after updating
@@ -1163,7 +1170,7 @@ void RenderWidget::willBeginCompositorFrame() {
// The following two can result in further layout and possibly
// enable GPU acceleration so they need to be called before any painting
// is done.
- UpdateTextInputState();
+ UpdateTextInputState(DO_NOT_SHOW_IME);
UpdateSelectionBounds();
WillInitiatePaint();
@@ -1637,8 +1644,9 @@ void RenderWidget::set_next_paint_is_repaint_ack() {
next_paint_flags_ |= ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK;
}
-void RenderWidget::UpdateTextInputState() {
- if (!input_method_is_active_)
+void RenderWidget::UpdateTextInputState(ShowIme show_ime) {
+ bool show_ime_if_needed = (show_ime == SHOW_IME_IF_NEEDED);
+ if (!show_ime_if_needed && !input_method_is_active_)
return;
ui::TextInputType new_type = GetTextInputType();
WebKit::WebTextInputInfo new_info;
@@ -1647,9 +1655,11 @@ void RenderWidget::UpdateTextInputState() {
bool new_can_compose_inline = CanComposeInline();
- // Only sends text input params if they are changed.
- if (text_input_type_ != new_type || text_input_info_ != new_info
- || can_compose_inline_ != new_can_compose_inline) {
+ // Only sends text input params if they are changed or if the ime should be
+ // shown.
+ if (show_ime_if_needed || (text_input_type_ != new_type
+ || text_input_info_ != new_info
+ || can_compose_inline_ != new_can_compose_inline)) {
ViewHostMsg_TextInputState_Params p;
p.type = new_type;
p.value = new_info.value.utf8();
@@ -1658,6 +1668,7 @@ void RenderWidget::UpdateTextInputState() {
p.composition_start = new_info.compositionStart;
p.composition_end = new_info.compositionEnd;
p.can_compose_inline = new_can_compose_inline;
+ p.show_ime_if_needed = show_ime_if_needed;
Send(new ViewHostMsg_TextInputStateChanged(routing_id(), p));
text_input_info_ = new_info;
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698