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

Unified Diff: content/renderer/render_widget.cc

Issue 643193003: Support InputMethodManager#updateCursorAnchorInfo for Android 5.0 (C++ version) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Send ImeCompositionRangeChanged only when necessary Created 5 years, 11 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
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index d9dbe21ce1cbb745540202a7b985521962c3e388..ccda44a7695b27562ef3f37b21d40edc931bee5b 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -82,6 +82,7 @@
#if defined(OS_ANDROID)
#include <android/keycodes.h>
+#include "base/android/build_info.h"
#include "content/renderer/android/synchronous_compositor_factory.h"
#endif
@@ -2076,9 +2077,13 @@ ui::TextInputType RenderWidget::GetTextInputType() {
void RenderWidget::UpdateCompositionInfo(bool should_update_range) {
#if defined(OS_ANDROID)
- // TODO(yukawa): Start sending character bounds when the browser side
- // implementation becomes ready (crbug.com/424866).
-#else
+ const static bool is_cursor_anchor_info_supported =
+ base::android::BuildInfo::GetInstance()->sdk_int() >= 21 &&
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableCursorAnchorInfo);
+ if (!is_cursor_anchor_info_supported)
+ return;
+#endif
gfx::Range range = gfx::Range();
if (should_update_range) {
GetCompositionRange(&range);
@@ -2094,7 +2099,6 @@ void RenderWidget::UpdateCompositionInfo(bool should_update_range) {
composition_range_ = range;
Send(new InputHostMsg_ImeCompositionRangeChanged(
routing_id(), composition_range_, composition_character_bounds_));
-#endif
}
void RenderWidget::GetCompositionCharacterBounds(

Powered by Google App Engine
This is Rietveld 408576698