| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/android/content_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 JNIEnv* env, | 103 JNIEnv* env, |
| 104 const gfx::Rect& rect) { | 104 const gfx::Rect& rect) { |
| 105 return ScopedJavaLocalRef<jobject>( | 105 return ScopedJavaLocalRef<jobject>( |
| 106 Java_ContentViewCore_createRect(env, | 106 Java_ContentViewCore_createRect(env, |
| 107 static_cast<int>(rect.x()), | 107 static_cast<int>(rect.x()), |
| 108 static_cast<int>(rect.y()), | 108 static_cast<int>(rect.y()), |
| 109 static_cast<int>(rect.right()), | 109 static_cast<int>(rect.right()), |
| 110 static_cast<int>(rect.bottom()))); | 110 static_cast<int>(rect.bottom()))); |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool PossiblyTriggeredByTimeout(const WebGestureEvent& event) { |
| 114 switch (event.type) { |
| 115 case WebInputEvent::GestureShowPress: |
| 116 case WebInputEvent::GestureLongPress: |
| 117 return true; |
| 118 // On Android, a GestureTap may be sent after a certain timeout window |
| 119 // if there is no GestureDoubleTap follow-up. |
| 120 case WebInputEvent::GestureTap: |
| 121 return true; |
| 122 // On Android, a GestureTapCancel may be triggered by the loss of window |
| 123 // focus (e.g., following a GestureLongPress). |
| 124 case WebInputEvent::GestureTapCancel: |
| 125 return true; |
| 126 default: |
| 127 break; |
| 128 } |
| 129 return false; |
| 130 } |
| 131 |
| 132 GestureEventPacket::GestureSource |
| 133 ToGestureSource(const WebGestureEvent& event) { |
| 134 return PossiblyTriggeredByTimeout(event) ? GestureEventPacket::TOUCH_TIMEOUT |
| 135 : GestureEventPacket::SYNTHETIC; |
| 136 } |
| 137 |
| 113 } // namespace | 138 } // namespace |
| 114 | 139 |
| 115 // Enables a callback when the underlying WebContents is destroyed, to enable | 140 // Enables a callback when the underlying WebContents is destroyed, to enable |
| 116 // nulling the back-pointer. | 141 // nulling the back-pointer. |
| 117 class ContentViewCoreImpl::ContentViewUserData | 142 class ContentViewCoreImpl::ContentViewUserData |
| 118 : public base::SupportsUserData::Data { | 143 : public base::SupportsUserData::Data { |
| 119 public: | 144 public: |
| 120 explicit ContentViewUserData(ContentViewCoreImpl* content_view_core) | 145 explicit ContentViewUserData(ContentViewCoreImpl* content_view_core) |
| 121 : content_view_core_(content_view_core) { | 146 : content_view_core_(content_view_core) { |
| 122 } | 147 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 java_ref_(env, obj), | 194 java_ref_(env, obj), |
| 170 web_contents_(static_cast<WebContentsImpl*>(web_contents)), | 195 web_contents_(static_cast<WebContentsImpl*>(web_contents)), |
| 171 root_layer_(cc::Layer::Create()), | 196 root_layer_(cc::Layer::Create()), |
| 172 vsync_interval_(base::TimeDelta::FromMicroseconds( | 197 vsync_interval_(base::TimeDelta::FromMicroseconds( |
| 173 kDefaultVSyncIntervalMicros)), | 198 kDefaultVSyncIntervalMicros)), |
| 174 expected_browser_composite_time_(base::TimeDelta::FromMicroseconds( | 199 expected_browser_composite_time_(base::TimeDelta::FromMicroseconds( |
| 175 kDefaultVSyncIntervalMicros * kDefaultBrowserCompositeVSyncFraction)), | 200 kDefaultVSyncIntervalMicros * kDefaultBrowserCompositeVSyncFraction)), |
| 176 view_android_(view_android), | 201 view_android_(view_android), |
| 177 window_android_(window_android), | 202 window_android_(window_android), |
| 178 device_orientation_(0), | 203 device_orientation_(0), |
| 179 geolocation_needs_pause_(false) { | 204 geolocation_needs_pause_(false), |
| 205 gesture_event_queue_(this), |
| 206 handling_touch_event_(false) { |
| 180 CHECK(web_contents) << | 207 CHECK(web_contents) << |
| 181 "A ContentViewCoreImpl should be created with a valid WebContents."; | 208 "A ContentViewCoreImpl should be created with a valid WebContents."; |
| 182 | 209 |
| 183 // TODO(leandrogracia): make use of the hardware_accelerated argument. | 210 // TODO(leandrogracia): make use of the hardware_accelerated argument. |
| 184 | 211 |
| 185 const gfx::Display& display = | 212 const gfx::Display& display = |
| 186 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 213 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
| 187 dpi_scale_ = display.device_scale_factor(); | 214 dpi_scale_ = display.device_scale_factor(); |
| 188 | 215 |
| 189 // Currently, the only use case we have for overriding a user agent involves | 216 // Currently, the only use case we have for overriding a user agent involves |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 break; | 324 break; |
| 298 } | 325 } |
| 299 } | 326 } |
| 300 } | 327 } |
| 301 | 328 |
| 302 void ContentViewCoreImpl::RenderViewReady() { | 329 void ContentViewCoreImpl::RenderViewReady() { |
| 303 if (device_orientation_ != 0) | 330 if (device_orientation_ != 0) |
| 304 SendOrientationChangeEventInternal(); | 331 SendOrientationChangeEventInternal(); |
| 305 } | 332 } |
| 306 | 333 |
| 334 void ContentViewCoreImpl::ForwardGestureEvent( |
| 335 const blink::WebGestureEvent& event) { |
| 336 JNIEnv* env = AttachCurrentThread(); |
| 337 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 338 if (j_obj.is_null()) |
| 339 return; |
| 340 |
| 341 if (Java_ContentViewCore_onForwardingGestureEvent( |
| 342 env, j_obj.obj(), event.type, event.x, event.y)) |
| 343 return; |
| 344 |
| 345 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 346 if (rwhv) |
| 347 rwhv->SendGestureEvent(event); |
| 348 } |
| 349 |
| 307 RenderWidgetHostViewAndroid* | 350 RenderWidgetHostViewAndroid* |
| 308 ContentViewCoreImpl::GetRenderWidgetHostViewAndroid() { | 351 ContentViewCoreImpl::GetRenderWidgetHostViewAndroid() { |
| 309 RenderWidgetHostView* rwhv = NULL; | 352 RenderWidgetHostView* rwhv = NULL; |
| 310 if (web_contents_) { | 353 if (web_contents_) { |
| 311 rwhv = web_contents_->GetRenderWidgetHostView(); | 354 rwhv = web_contents_->GetRenderWidgetHostView(); |
| 312 if (web_contents_->ShowingInterstitialPage()) { | 355 if (web_contents_->ShowingInterstitialPage()) { |
| 313 rwhv = static_cast<InterstitialPageImpl*>( | 356 rwhv = static_cast<InterstitialPageImpl*>( |
| 314 web_contents_->GetInterstitialPage())-> | 357 web_contents_->GetInterstitialPage())-> |
| 315 GetRenderViewHost()->GetView(); | 358 GetRenderViewHost()->GetView(); |
| 316 } | 359 } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 env->SetIntArrayRegion(enabled_array.obj(), i, 1, &enabled); | 533 env->SetIntArrayRegion(enabled_array.obj(), i, 1, &enabled); |
| 491 } | 534 } |
| 492 ScopedJavaLocalRef<jobjectArray> items_array( | 535 ScopedJavaLocalRef<jobjectArray> items_array( |
| 493 base::android::ToJavaArrayOfStrings(env, labels)); | 536 base::android::ToJavaArrayOfStrings(env, labels)); |
| 494 Java_ContentViewCore_showSelectPopup(env, j_obj.obj(), | 537 Java_ContentViewCore_showSelectPopup(env, j_obj.obj(), |
| 495 items_array.obj(), enabled_array.obj(), | 538 items_array.obj(), enabled_array.obj(), |
| 496 multiple, selected_array.obj()); | 539 multiple, selected_array.obj()); |
| 497 } | 540 } |
| 498 | 541 |
| 499 void ContentViewCoreImpl::ConfirmTouchEvent(InputEventAckState ack_result) { | 542 void ContentViewCoreImpl::ConfirmTouchEvent(InputEventAckState ack_result) { |
| 543 gesture_event_queue_.OnTouchEventAck(ack_result); |
| 544 } |
| 545 |
| 546 void ContentViewCoreImpl::UnhandledFlingStartEvent(float vx, float vy) { |
| 500 JNIEnv* env = AttachCurrentThread(); | 547 JNIEnv* env = AttachCurrentThread(); |
| 501 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 548 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 502 if (j_obj.is_null()) | 549 if (j_obj.is_null()) |
| 503 return; | 550 return; |
| 504 Java_ContentViewCore_confirmTouchEvent(env, j_obj.obj(), | 551 Java_ContentViewCore_unhandledFlingStartEvent(env, j_obj.obj(), vx, vy); |
| 505 static_cast<jint>(ack_result)); | |
| 506 } | |
| 507 | |
| 508 void ContentViewCoreImpl::UnhandledFlingStartEvent() { | |
| 509 JNIEnv* env = AttachCurrentThread(); | |
| 510 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | |
| 511 if (j_obj.is_null()) | |
| 512 return; | |
| 513 Java_ContentViewCore_unhandledFlingStartEvent(env, j_obj.obj()); | |
| 514 } | 552 } |
| 515 | 553 |
| 516 void ContentViewCoreImpl::OnScrollUpdateGestureConsumed() { | 554 void ContentViewCoreImpl::OnScrollUpdateGestureConsumed() { |
| 517 JNIEnv* env = AttachCurrentThread(); | 555 JNIEnv* env = AttachCurrentThread(); |
| 518 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 556 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 519 if (j_obj.is_null()) | 557 if (j_obj.is_null()) |
| 520 return; | 558 return; |
| 521 Java_ContentViewCore_onScrollUpdateGestureConsumed(env, j_obj.obj()); | 559 Java_ContentViewCore_onScrollUpdateGestureConsumed(env, j_obj.obj()); |
| 522 } | 560 } |
| 523 | 561 |
| 524 void ContentViewCoreImpl::HasTouchEventHandlers(bool need_touch_events) { | |
| 525 JNIEnv* env = AttachCurrentThread(); | |
| 526 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | |
| 527 if (j_obj.is_null()) | |
| 528 return; | |
| 529 Java_ContentViewCore_hasTouchEventHandlers(env, | |
| 530 j_obj.obj(), | |
| 531 need_touch_events); | |
| 532 } | |
| 533 | |
| 534 bool ContentViewCoreImpl::HasFocus() { | 562 bool ContentViewCoreImpl::HasFocus() { |
| 535 JNIEnv* env = AttachCurrentThread(); | 563 JNIEnv* env = AttachCurrentThread(); |
| 536 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 564 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 537 if (obj.is_null()) | 565 if (obj.is_null()) |
| 538 return false; | 566 return false; |
| 539 return Java_ContentViewCore_hasFocus(env, obj.obj()); | 567 return Java_ContentViewCore_hasFocus(env, obj.obj()); |
| 540 } | 568 } |
| 541 | 569 |
| 542 void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) { | 570 void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) { |
| 543 JNIEnv* env = AttachCurrentThread(); | 571 JNIEnv* env = AttachCurrentThread(); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 | 917 |
| 890 void ContentViewCoreImpl::SendOrientationChangeEvent(JNIEnv* env, | 918 void ContentViewCoreImpl::SendOrientationChangeEvent(JNIEnv* env, |
| 891 jobject obj, | 919 jobject obj, |
| 892 jint orientation) { | 920 jint orientation) { |
| 893 if (device_orientation_ != orientation) { | 921 if (device_orientation_ != orientation) { |
| 894 device_orientation_ = orientation; | 922 device_orientation_ = orientation; |
| 895 SendOrientationChangeEventInternal(); | 923 SendOrientationChangeEventInternal(); |
| 896 } | 924 } |
| 897 } | 925 } |
| 898 | 926 |
| 899 jboolean ContentViewCoreImpl::SendTouchEvent(JNIEnv* env, | 927 void ContentViewCoreImpl::OnTouchEventHandlingBegin(JNIEnv* env, |
| 900 jobject obj, | 928 jobject obj, |
| 901 jlong time_ms, | 929 jlong time_ms, |
| 902 jint type, | 930 jint type, |
| 903 jobjectArray pts) { | 931 jobjectArray pts) { |
| 932 DCHECK(!handling_touch_event_); |
| 933 handling_touch_event_ = true; |
| 934 |
| 935 blink::WebTouchEvent event; |
| 936 TouchPoint::BuildWebTouchEvent(env, type, time_ms, GetDpiScale(), pts, event); |
| 937 pending_touch_event_ = event; |
| 938 |
| 939 pending_gesture_packet_ = GestureEventPacket::FromTouch(event); |
| 940 } |
| 941 |
| 942 void ContentViewCoreImpl::OnTouchEventHandlingEnd(JNIEnv* env, jobject obj) { |
| 943 DCHECK(handling_touch_event_); |
| 944 handling_touch_event_ = false; |
| 945 |
| 904 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 946 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 905 if (rwhv) { | 947 if (!rwhv) |
| 906 using blink::WebTouchEvent; | 948 return; |
| 907 blink::WebTouchEvent event; | 949 |
| 908 TouchPoint::BuildWebTouchEvent(env, type, time_ms, GetDpiScale(), pts, | 950 // Note: Order is important here, as the touch may be ack'ed synchronously |
| 909 event); | 951 gesture_event_queue_.OnGestureEventPacket(pending_gesture_packet_); |
| 910 rwhv->SendTouchEvent(event); | 952 rwhv->SendTouchEvent(pending_touch_event_); |
| 911 return true; | |
| 912 } | |
| 913 return false; | |
| 914 } | 953 } |
| 915 | 954 |
| 916 float ContentViewCoreImpl::GetTouchPaddingDip() { | 955 float ContentViewCoreImpl::GetTouchPaddingDip() { |
| 917 return 48.0f / GetDpiScale(); | 956 return 48.0f / GetDpiScale(); |
| 918 } | 957 } |
| 919 | 958 |
| 920 float ContentViewCoreImpl::GetDpiScale() const { | 959 float ContentViewCoreImpl::GetDpiScale() const { |
| 921 return dpi_scale_; | 960 return dpi_scale_; |
| 922 } | 961 } |
| 923 | 962 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 } | 1012 } |
| 974 | 1013 |
| 975 WebGestureEvent ContentViewCoreImpl::MakeGestureEvent( | 1014 WebGestureEvent ContentViewCoreImpl::MakeGestureEvent( |
| 976 WebInputEvent::Type type, int64 time_ms, float x, float y) const { | 1015 WebInputEvent::Type type, int64 time_ms, float x, float y) const { |
| 977 return WebGestureEventBuilder::Build( | 1016 return WebGestureEventBuilder::Build( |
| 978 type, time_ms / 1000.0, x / GetDpiScale(), y / GetDpiScale()); | 1017 type, time_ms / 1000.0, x / GetDpiScale(), y / GetDpiScale()); |
| 979 } | 1018 } |
| 980 | 1019 |
| 981 void ContentViewCoreImpl::SendGestureEvent( | 1020 void ContentViewCoreImpl::SendGestureEvent( |
| 982 const blink::WebGestureEvent& event) { | 1021 const blink::WebGestureEvent& event) { |
| 983 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1022 if (handling_touch_event_) { |
| 984 if (rwhv) | 1023 pending_gesture_packet_.Push(event); |
| 985 rwhv->SendGestureEvent(event); | 1024 return; |
| 1025 } |
| 1026 gesture_event_queue_.OnGestureEventPacket( |
| 1027 GestureEventPacket::FromGesture(ToGestureSource(event), event)); |
| 1028 } |
| 1029 |
| 1030 void ContentViewCoreImpl::SendSyntheticGestureEvent( |
| 1031 const blink::WebGestureEvent& event) { |
| 1032 gesture_event_queue_.OnGestureEventPacket( |
| 1033 GestureEventPacket::FromGesture(GestureEventPacket::SYNTHETIC, event)); |
| 986 } | 1034 } |
| 987 | 1035 |
| 988 void ContentViewCoreImpl::ScrollBegin(JNIEnv* env, | 1036 void ContentViewCoreImpl::ScrollBegin(JNIEnv* env, |
| 989 jobject obj, | 1037 jobject obj, |
| 990 jlong time_ms, | 1038 jlong time_ms, |
| 991 jfloat x, | 1039 jfloat x, |
| 992 jfloat y, | 1040 jfloat y, |
| 993 jfloat hintx, | 1041 jfloat hintx, |
| 994 jfloat hinty) { | 1042 jfloat hinty) { |
| 995 WebGestureEvent event = MakeGestureEvent( | 1043 WebGestureEvent event = MakeGestureEvent( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 SendGestureEvent(event); | 1083 SendGestureEvent(event); |
| 1036 } | 1084 } |
| 1037 | 1085 |
| 1038 void ContentViewCoreImpl::SingleTap(JNIEnv* env, jobject obj, jlong time_ms, | 1086 void ContentViewCoreImpl::SingleTap(JNIEnv* env, jobject obj, jlong time_ms, |
| 1039 jfloat x, jfloat y, | 1087 jfloat x, jfloat y, |
| 1040 jboolean disambiguation_popup_tap) { | 1088 jboolean disambiguation_popup_tap) { |
| 1041 WebGestureEvent event = MakeGestureEvent( | 1089 WebGestureEvent event = MakeGestureEvent( |
| 1042 WebInputEvent::GestureTap, time_ms, x, y); | 1090 WebInputEvent::GestureTap, time_ms, x, y); |
| 1043 | 1091 |
| 1044 event.data.tap.tapCount = 1; | 1092 event.data.tap.tapCount = 1; |
| 1045 if (!disambiguation_popup_tap) { | 1093 if (disambiguation_popup_tap) { |
| 1046 const float touch_padding_dip = GetTouchPaddingDip(); | 1094 SendSyntheticGestureEvent(event); |
| 1047 event.data.tap.width = touch_padding_dip; | 1095 return; |
| 1048 event.data.tap.height = touch_padding_dip; | |
| 1049 } | 1096 } |
| 1050 | 1097 |
| 1098 const float touch_padding_dip = GetTouchPaddingDip(); |
| 1099 event.data.tap.width = touch_padding_dip; |
| 1100 event.data.tap.height = touch_padding_dip; |
| 1051 SendGestureEvent(event); | 1101 SendGestureEvent(event); |
| 1052 } | 1102 } |
| 1053 | 1103 |
| 1054 void ContentViewCoreImpl::SingleTapUnconfirmed(JNIEnv* env, jobject obj, | 1104 void ContentViewCoreImpl::SingleTapUnconfirmed(JNIEnv* env, jobject obj, |
| 1055 jlong time_ms, | 1105 jlong time_ms, |
| 1056 jfloat x, jfloat y) { | 1106 jfloat x, jfloat y) { |
| 1057 WebGestureEvent event = MakeGestureEvent( | 1107 WebGestureEvent event = MakeGestureEvent( |
| 1058 WebInputEvent::GestureTapUnconfirmed, time_ms, x, y); | 1108 WebInputEvent::GestureTapUnconfirmed, time_ms, x, y); |
| 1059 | 1109 |
| 1060 event.data.tap.tapCount = 1; | 1110 event.data.tap.tapCount = 1; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 WebInputEvent::GestureDoubleTap, time_ms, x, y); | 1148 WebInputEvent::GestureDoubleTap, time_ms, x, y); |
| 1099 SendGestureEvent(event); | 1149 SendGestureEvent(event); |
| 1100 } | 1150 } |
| 1101 | 1151 |
| 1102 void ContentViewCoreImpl::LongPress(JNIEnv* env, jobject obj, jlong time_ms, | 1152 void ContentViewCoreImpl::LongPress(JNIEnv* env, jobject obj, jlong time_ms, |
| 1103 jfloat x, jfloat y, | 1153 jfloat x, jfloat y, |
| 1104 jboolean disambiguation_popup_tap) { | 1154 jboolean disambiguation_popup_tap) { |
| 1105 WebGestureEvent event = MakeGestureEvent( | 1155 WebGestureEvent event = MakeGestureEvent( |
| 1106 WebInputEvent::GestureLongPress, time_ms, x, y); | 1156 WebInputEvent::GestureLongPress, time_ms, x, y); |
| 1107 | 1157 |
| 1108 if (!disambiguation_popup_tap) { | 1158 if (disambiguation_popup_tap) { |
| 1109 const float touch_padding_dip = GetTouchPaddingDip(); | 1159 SendSyntheticGestureEvent(event); |
| 1110 event.data.longPress.width = touch_padding_dip; | 1160 return; |
| 1111 event.data.longPress.height = touch_padding_dip; | |
| 1112 } | 1161 } |
| 1113 | 1162 |
| 1163 const float touch_padding_dip = GetTouchPaddingDip(); |
| 1164 event.data.longPress.width = touch_padding_dip; |
| 1165 event.data.longPress.height = touch_padding_dip; |
| 1114 SendGestureEvent(event); | 1166 SendGestureEvent(event); |
| 1115 } | 1167 } |
| 1116 | 1168 |
| 1117 void ContentViewCoreImpl::LongTap(JNIEnv* env, jobject obj, jlong time_ms, | 1169 void ContentViewCoreImpl::LongTap(JNIEnv* env, jobject obj, jlong time_ms, |
| 1118 jfloat x, jfloat y, | 1170 jfloat x, jfloat y, |
| 1119 jboolean disambiguation_popup_tap) { | 1171 jboolean disambiguation_popup_tap) { |
| 1120 WebGestureEvent event = MakeGestureEvent( | 1172 WebGestureEvent event = MakeGestureEvent( |
| 1121 WebInputEvent::GestureLongTap, time_ms, x, y); | 1173 WebInputEvent::GestureLongTap, time_ms, x, y); |
| 1122 | 1174 |
| 1123 if (!disambiguation_popup_tap) { | 1175 if (disambiguation_popup_tap) { |
| 1124 const float touch_padding_dip = GetTouchPaddingDip(); | 1176 SendSyntheticGestureEvent(event); |
| 1125 event.data.longPress.width = touch_padding_dip; | 1177 return; |
| 1126 event.data.longPress.height = touch_padding_dip; | |
| 1127 } | 1178 } |
| 1128 | 1179 |
| 1180 const float touch_padding_dip = GetTouchPaddingDip(); |
| 1181 event.data.longPress.width = touch_padding_dip; |
| 1182 event.data.longPress.height = touch_padding_dip; |
| 1129 SendGestureEvent(event); | 1183 SendGestureEvent(event); |
| 1130 } | 1184 } |
| 1131 | 1185 |
| 1132 void ContentViewCoreImpl::PinchBegin(JNIEnv* env, jobject obj, jlong time_ms, | 1186 void ContentViewCoreImpl::PinchBegin(JNIEnv* env, jobject obj, jlong time_ms, |
| 1133 jfloat x, jfloat y) { | 1187 jfloat x, jfloat y) { |
| 1134 WebGestureEvent event = MakeGestureEvent( | 1188 WebGestureEvent event = MakeGestureEvent( |
| 1135 WebInputEvent::GesturePinchBegin, time_ms, x, y); | 1189 WebInputEvent::GesturePinchBegin, time_ms, x, y); |
| 1136 SendGestureEvent(event); | 1190 SendGestureEvent(event); |
| 1137 } | 1191 } |
| 1138 | 1192 |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1682 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1736 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1683 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1737 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1684 return reinterpret_cast<intptr_t>(view); | 1738 return reinterpret_cast<intptr_t>(view); |
| 1685 } | 1739 } |
| 1686 | 1740 |
| 1687 bool RegisterContentViewCore(JNIEnv* env) { | 1741 bool RegisterContentViewCore(JNIEnv* env) { |
| 1688 return RegisterNativesImpl(env); | 1742 return RegisterNativesImpl(env); |
| 1689 } | 1743 } |
| 1690 | 1744 |
| 1691 } // namespace content | 1745 } // namespace content |
| OLD | NEW |