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

Unified Diff: content/browser/android/ime_adapter_android.cc

Issue 2834343005: Let IME frame update bypass ContentViewCore (Closed)
Patch Set: comment Created 3 years, 8 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/browser/android/ime_adapter_android.cc
diff --git a/content/browser/android/ime_adapter_android.cc b/content/browser/android/ime_adapter_android.cc
index 1a92e3c33bc0b92da648de4cbb6cde76a2511bee..bbb0ec982690b34d7d61052a70e15a434d525663 100644
--- a/content/browser/android/ime_adapter_android.cc
+++ b/content/browser/android/ime_adapter_android.cc
@@ -157,6 +157,33 @@ void ImeAdapterAndroid::UpdateState(const TextInputState& state) {
state.composition_end, state.reply_to_request);
}
+void ImeAdapterAndroid::UpdateFrameInfo(
+ const gfx::SelectionBound& selection_start,
+ float dip_scale,
+ float content_offset_ypix) {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> obj = java_ime_adapter_.get(env);
+ if (obj.is_null())
+ return;
+
+ // The CursorAnchorInfo API in Android only supports zero width selection
+ // bounds.
+ const jboolean has_insertion_marker =
+ selection_start.type() == gfx::SelectionBound::CENTER;
+ const jboolean is_insertion_marker_visible = selection_start.visible();
+ const jfloat insertion_marker_horizontal =
+ has_insertion_marker ? selection_start.edge_top().x() : 0.0f;
+ const jfloat insertion_marker_top =
+ has_insertion_marker ? selection_start.edge_top().y() : 0.0f;
+ const jfloat insertion_marker_bottom =
+ has_insertion_marker ? selection_start.edge_bottom().y() : 0.0f;
+
+ Java_ImeAdapter_updateFrameInfo(
+ env, obj, dip_scale, content_offset_ypix, has_insertion_marker,
+ is_insertion_marker_visible, insertion_marker_horizontal,
+ insertion_marker_top, insertion_marker_bottom);
+}
+
bool ImeAdapterAndroid::SendKeyEvent(
JNIEnv* env,
const JavaParamRef<jobject>&,

Powered by Google App Engine
This is Rietveld 408576698