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 9c5692028381dbe26a36c0b582688c3230a1fed2..2ba4cc80bdc7f2769c8131b48fbef7b380b01316 100644 |
--- a/content/browser/android/content_view_core_impl.cc |
+++ b/content/browser/android/content_view_core_impl.cc |
@@ -21,6 +21,7 @@ |
#include "content/browser/android/interstitial_page_delegate_android.h" |
#include "content/browser/android/java/gin_java_bridge_dispatcher_host.h" |
#include "content/browser/android/load_url_params.h" |
+#include "content/browser/android/popup_touch_handle_drawable.h" |
#include "content/browser/frame_host/interstitial_page_impl.h" |
#include "content/browser/frame_host/navigation_controller_impl.h" |
#include "content/browser/frame_host/navigation_entry_impl.h" |
@@ -558,9 +559,6 @@ void ContentViewCoreImpl::OnGestureEventAck(const blink::WebGestureEvent& event, |
event.x * dpi_scale(), |
event.y * dpi_scale()); |
break; |
- case WebInputEvent::GestureDoubleTap: |
- Java_ContentViewCore_onDoubleTapEventAck(env, j_obj.obj()); |
- break; |
default: |
break; |
} |
@@ -607,22 +605,27 @@ void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) { |
Java_ContentViewCore_onSelectionChanged(env, obj.obj(), jtext.obj()); |
} |
-void ContentViewCoreImpl::OnSelectionBoundsChanged(const gfx::PointF& start, |
- const gfx::PointF& end, |
- int start_dir, |
- int end_dir) { |
+void ContentViewCoreImpl::OnSelectionEvent(SelectionEventType event, |
+ const gfx::PointF& position) { |
JNIEnv* env = AttachCurrentThread(); |
- ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
- if (obj.is_null()) |
+ ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
+ if (j_obj.is_null()) |
return; |
- Java_ContentViewCore_onSelectionBoundsChanged(env, |
- obj.obj(), |
- start.x(), |
- start.y(), |
- end.x(), |
- end.y(), |
- start_dir, |
- end_dir); |
+ Java_ContentViewCore_onSelectionEvent( |
+ env, j_obj.obj(), event, position.x(), position.y()); |
+} |
+ |
+scoped_ptr<TouchHandleDrawable> |
+ContentViewCoreImpl::CreatePopupTouchHandleDrawable() { |
+ JNIEnv* env = AttachCurrentThread(); |
+ ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
+ if (obj.is_null()) { |
+ NOTREACHED(); |
+ return scoped_ptr<TouchHandleDrawable>(); |
+ } |
+ return scoped_ptr<TouchHandleDrawable>(new PopupTouchHandleDrawable( |
+ Java_ContentViewCore_createPopupTouchHandleDrawable(env, obj.obj()), |
+ dpi_scale_)); |
} |
void ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) { |
@@ -788,7 +791,7 @@ float ContentViewCoreImpl::GetOverdrawBottomHeightDip() const { |
} |
void ContentViewCoreImpl::AttachLayer(scoped_refptr<cc::Layer> layer) { |
- root_layer_->AddChild(layer); |
+ root_layer_->InsertChild(layer, 0); |
root_layer_->SetIsDrawable(false); |
} |
@@ -799,6 +802,19 @@ void ContentViewCoreImpl::RemoveLayer(scoped_refptr<cc::Layer> layer) { |
root_layer_->SetIsDrawable(true); |
} |
+void ContentViewCoreImpl::SelectBetweenCoordinates(const gfx::PointF& start, |
+ const gfx::PointF& end) { |
+ if (!web_contents_) |
+ return; |
+ |
+ gfx::Point start_point = gfx::Point(start.x(), start.y()); |
+ gfx::Point end_point = gfx::Point(end.x(), end.y()); |
+ if (start_point == end_point) |
+ return; |
+ |
+ web_contents_->SelectRange(start_point, end_point); |
+} |
+ |
void ContentViewCoreImpl::LoadUrl( |
NavigationController::LoadURLParams& params) { |
GetWebContents()->GetController().LoadURLWithParams(params); |
@@ -952,7 +968,8 @@ jboolean ContentViewCoreImpl::OnTouchEvent(JNIEnv* env, |
jfloat raw_pos_y, |
jint android_tool_type_0, |
jint android_tool_type_1, |
- jint android_button_state) { |
+ jint android_button_state, |
+ jboolean is_touch_handle_event) { |
RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
// Avoid synthesizing a touch event if it cannot be forwarded. |
if (!rwhv) |
@@ -980,7 +997,8 @@ jboolean ContentViewCoreImpl::OnTouchEvent(JNIEnv* env, |
android_tool_type_1, |
android_button_state); |
- return rwhv->OnTouchEvent(event); |
+ return is_touch_handle_event ? rwhv->OnTouchHandleEvent(event) |
+ : rwhv->OnTouchEvent(event); |
} |
float ContentViewCoreImpl::GetDpiScale() const { |
@@ -1144,22 +1162,23 @@ void ContentViewCoreImpl::PinchBy(JNIEnv* env, jobject obj, jlong time_ms, |
void ContentViewCoreImpl::SelectBetweenCoordinates(JNIEnv* env, jobject obj, |
jfloat x1, jfloat y1, |
jfloat x2, jfloat y2) { |
- if (!web_contents_) |
- return; |
- |
- web_contents_->SelectRange( |
- gfx::Point(x1 / dpi_scale(), y1 / dpi_scale()), |
- gfx::Point(x2 / dpi_scale(), y2 / dpi_scale())); |
+ SelectBetweenCoordinates(gfx::PointF(x1 / dpi_scale(), y1 / dpi_scale()), |
+ gfx::PointF(x2 / dpi_scale(), y2 / dpi_scale())); |
} |
void ContentViewCoreImpl::MoveCaret(JNIEnv* env, jobject obj, |
jfloat x, jfloat y) { |
if (GetRenderWidgetHostViewAndroid()) { |
GetRenderWidgetHostViewAndroid()->MoveCaret( |
- gfx::Point(x / dpi_scale(), y / dpi_scale())); |
+ gfx::Point(x / dpi_scale_, y / dpi_scale_)); |
} |
} |
+void ContentViewCoreImpl::HideTextHandles(JNIEnv* env, jobject obj) { |
+ if (GetRenderWidgetHostViewAndroid()) |
+ GetRenderWidgetHostViewAndroid()->HideTextHandles(); |
+} |
+ |
void ContentViewCoreImpl::ResetGestureDetection(JNIEnv* env, jobject obj) { |
RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
if (rwhv) |
@@ -1494,14 +1513,6 @@ void ContentViewCoreImpl::SetAccessibilityEnabled(JNIEnv* env, jobject obj, |
SetAccessibilityEnabledInternal(enabled); |
} |
-void ContentViewCoreImpl::ShowSelectionHandlesAutomatically() const { |
- JNIEnv* env = AttachCurrentThread(); |
- ScopedJavaLocalRef<jobject> obj(java_ref_.get(env)); |
- if (obj.is_null()) |
- return; |
- Java_ContentViewCore_showSelectionHandlesAutomatically(env, obj.obj()); |
-} |
- |
bool ContentViewCoreImpl::IsFullscreenRequiredForOrientationLock() const { |
JNIEnv* env = AttachCurrentThread(); |
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |