Index: content/renderer/render_widget.cc |
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc |
index 57b7abfd8fc6e5dbfa959e7643050d997c4e9ee7..79f150b2f9703192430c280bfc46d835cf818af0 100644 |
--- a/content/renderer/render_widget.cc |
+++ b/content/renderer/render_widget.cc |
@@ -77,6 +77,7 @@ |
#if defined(OS_ANDROID) |
#include <android/keycodes.h> |
+#include "base/android/build_info.h" |
#include "content/renderer/android/synchronous_compositor_factory.h" |
#endif |
@@ -1541,7 +1542,7 @@ void RenderWidget::OnImeSetComposition( |
// sure we are in a consistent state. |
Send(new InputHostMsg_ImeCancelComposition(routing_id())); |
} |
-#if defined(OS_MACOSX) || defined(USE_AURA) |
+#if defined(OS_MACOSX) || defined(USE_AURA) || defined(OS_ANDROID) |
UpdateCompositionInfo(true); |
aurimas (slooooooooow)
2014/10/22 00:59:04
UpdateCompositionInfo is an expensive call. That w
yukawa
2014/10/22 01:11:35
Not yet, but this is why I added the the version c
|
#endif |
} |
@@ -1560,7 +1561,7 @@ void RenderWidget::OnImeConfirmComposition(const base::string16& text, |
else |
webwidget_->confirmComposition(WebWidget::DoNotKeepSelection); |
handling_input_event_ = false; |
-#if defined(OS_MACOSX) || defined(USE_AURA) |
+#if defined(OS_MACOSX) || defined(USE_AURA) || defined(OS_ANDROID) |
UpdateCompositionInfo(true); |
#endif |
} |
@@ -1886,7 +1887,7 @@ void RenderWidget::UpdateSelectionBounds() { |
} |
} |
-#if defined(OS_MACOSX) || defined(USE_AURA) |
+#if defined(OS_MACOSX) || defined(USE_AURA) || defined(OS_ANDROID) |
UpdateCompositionInfo(false); |
#endif |
} |
@@ -1941,8 +1942,15 @@ ui::TextInputType RenderWidget::GetTextInputType() { |
return ui::TEXT_INPUT_TYPE_NONE; |
} |
-#if defined(OS_MACOSX) || defined(USE_AURA) |
+#if defined(OS_MACOSX) || defined(USE_AURA) || defined(OS_ANDROID) |
void RenderWidget::UpdateCompositionInfo(bool should_update_range) { |
+#if defined(OS_ANDROID) |
+ // Sending composition info makes sense only in Lollipop (API level 21) |
+ // and above due to the API availability. |
+ if (base::android::BuildInfo::GetInstance()->sdk_int() < 21) |
+ return; |
+#endif |
+ |
gfx::Range range = gfx::Range(); |
if (should_update_range) { |
GetCompositionRange(&range); |
@@ -2034,7 +2042,7 @@ void RenderWidget::resetInputMethod() { |
Send(new InputHostMsg_ImeCancelComposition(routing_id())); |
} |
-#if defined(OS_MACOSX) || defined(USE_AURA) |
+#if defined(OS_MACOSX) || defined(USE_AURA) || defined(OS_ANDROID) |
UpdateCompositionInfo(true); |
#endif |
} |