Index: content/browser/android/content_view_core_impl.cc |
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc |
index 5fd29f12512c4cd97d3e5dbdf8bf6b49f29d14b3..ef5fef56c09687f53a1bd79b774d4ede3ab52761 100644 |
--- a/content/browser/android/content_view_core_impl.cc |
+++ b/content/browser/android/content_view_core_impl.cc |
@@ -16,6 +16,7 @@ |
#include "cc/layers/layer.h" |
#include "cc/layers/solid_color_layer.h" |
#include "cc/output/begin_frame_args.h" |
+#include "cc/output/viewport_selection_bound.h" |
#include "content/browser/accessibility/browser_accessibility_state_impl.h" |
#include "content/browser/android/gesture_event_type.h" |
#include "content/browser/android/interstitial_page_delegate_android.h" |
@@ -379,7 +380,8 @@ void ContentViewCoreImpl::UpdateFrameInfo( |
const gfx::SizeF& content_size, |
const gfx::SizeF& viewport_size, |
const gfx::Vector2dF& controls_offset, |
- const gfx::Vector2dF& content_offset) { |
+ const gfx::Vector2dF& content_offset, |
+ const cc::ViewportSelectionBound& selection_start) { |
JNIEnv* env = AttachCurrentThread(); |
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
if (obj.is_null()) |
@@ -388,6 +390,25 @@ void ContentViewCoreImpl::UpdateFrameInfo( |
window_android_->set_content_offset( |
gfx::ScaleVector2d(content_offset, dpi_scale_)); |
+ // We are interested only in zero width selection bounds here because non-zero |
+ // width selection bounds cannot be represented in CursorAnchorInfo API in |
+ // Android Framework as of API Level 21. Actually supporting non-zero width |
+ // selection bounds in CursorAnchorInfo API was once considered in the design |
+ // phase of that API, but the idea was abandoned because the IME is still able |
+ // to retrieve the same information from the following parameters in |
+ // CursorAnchorInfo: |
+ // - CursorAnchorInfo#getCharacterBounds and |
+ // - CursorAnchorInfo#getSelection{Start, End}. |
+ const jboolean has_insertion_marker = |
+ selection_start.type == cc::SELECTION_BOUND_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_ContentViewCore_updateFrameInfo( |
env, obj.obj(), |
scroll_offset.x(), |
@@ -400,7 +421,12 @@ void ContentViewCoreImpl::UpdateFrameInfo( |
viewport_size.width(), |
viewport_size.height(), |
controls_offset.y(), |
- content_offset.y()); |
+ content_offset.y(), |
+ has_insertion_marker, |
+ is_insertion_marker_visible, |
+ insertion_marker_horizontal, |
+ insertion_marker_top, |
+ insertion_marker_bottom); |
} |
void ContentViewCoreImpl::SetTitle(const base::string16& title) { |