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

Unified Diff: android_webview/renderer/aw_render_view_ext.cc

Issue 475633002: Pass TouchMajor to HitTestResult (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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: android_webview/renderer/aw_render_view_ext.cc
diff --git a/android_webview/renderer/aw_render_view_ext.cc b/android_webview/renderer/aw_render_view_ext.cc
index 41c212523e52497cab2c0931e20c20b7e0a410ea..7c5358484bba05439d06bef8d5e256dd084e8f1d 100644
--- a/android_webview/renderer/aw_render_view_ext.cc
+++ b/android_webview/renderer/aw_render_view_ext.cc
@@ -266,13 +266,23 @@ void AwRenderViewExt::FocusedNodeChanged(const blink::WebNode& node) {
Send(new AwViewHostMsg_UpdateHitTestData(routing_id(), data));
}
-void AwRenderViewExt::OnDoHitTest(int view_x, int view_y) {
+void AwRenderViewExt::OnDoHitTest(int view_x,
+ int view_y,
+ float touch_major_0,
+ float touch_major_1) {
if (!render_view() || !render_view()->GetWebView())
return;
+ // touch_major_1 refers to the touch area radius of the 2nd finger, if there
+ // are 2 fingers touching
+ // the screen. Some devices can report multiple movement traces at the same
+ // time, but not all.
+ // This follows what WebInputEventUtil::CreateWebTouchPoint is doing.
+ int radius = 0.5f * std::max(touch_major_0, touch_major_1);
boliu 2014/08/14 16:36:53 hmm, should we do max or min here...?
jdduke (slow) 2014/08/14 17:01:57 Sorry for the drive-by, but why put this max logic
hush (inactive) 2014/08/14 17:03:32 Sorry. I'm probably just doing a random thing here
boliu 2014/08/14 17:05:18 Use the first point here.
hush (inactive) 2014/08/14 17:25:22 Thanks Jared for the comments! By "following what
+ const blink::WebSize touch_area(radius, radius);
const blink::WebHitTestResult result =
render_view()->GetWebView()->hitTestResultAt(
- blink::WebPoint(view_x, view_y));
+ blink::WebPoint(view_x, view_y), touch_area);
AwHitTestData data;
if (!result.urlElement().isNull()) {

Powered by Google App Engine
This is Rietveld 408576698