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

Unified Diff: content/browser/renderer_host/input/web_input_event_builders_android.cc

Issue 2054193002: Android mouse events shouldn't appear as TouchEvents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added working mouse buttons. Created 4 years, 3 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/renderer_host/input/web_input_event_builders_android.cc
diff --git a/content/browser/renderer_host/input/web_input_event_builders_android.cc b/content/browser/renderer_host/input/web_input_event_builders_android.cc
index 016665399a487bceb948b457ef39652e539189a8..0d19f6ee30c66853fd98567390846183a147cb1c 100644
--- a/content/browser/renderer_host/input/web_input_event_builders_android.cc
+++ b/content/browser/renderer_host/input/web_input_event_builders_android.cc
@@ -112,20 +112,24 @@ WebKeyboardEvent WebKeyboardEventBuilder::Build(
}
WebMouseEvent WebMouseEventBuilder::Build(
- WebInputEvent::Type type,
- WebMouseEvent::Button button,
- double time_sec,
- int window_x,
- int window_y,
- int modifiers,
- int click_count,
- WebPointerProperties::PointerType pointer_type) {
+ WebInputEvent::Type type,
+ double time_sec,
+ int window_x,
+ int window_y,
+ int modifiers,
+ int click_count,
+ int pointer_id,
+ float pressure,
+ float orientation_rad,
+ float tilt_rad,
+ int old_button_state,
+ int new_button_state,
+ int tool_type) {
DCHECK(WebInputEvent::isMouseEventType(type));
WebMouseEvent result;
result.type = type;
- result.pointerType = pointer_type;
result.x = window_x;
result.y = window_y;
result.windowX = window_x;
@@ -134,10 +138,20 @@ WebMouseEvent WebMouseEventBuilder::Build(
result.clickCount = click_count;
result.modifiers = modifiers;
- if (type == WebInputEvent::MouseDown || type == WebInputEvent::MouseUp)
- result.button = button;
- else
- result.button = WebMouseEvent::Button::NoButton;
+ int android_buttons_changed = 0;
+ if (type == WebInputEvent::MouseDown)
+ android_buttons_changed = new_button_state & ~old_button_state;
+ else if (type == WebInputEvent::MouseUp)
+ android_buttons_changed = old_button_state & ~new_button_state;
+
+ ui::SetWebPointerPropertiesFromMotionEventData(
+ result,
+ pointer_id,
+ pressure,
+ orientation_rad,
+ tilt_rad,
+ android_buttons_changed,
+ tool_type);
return result;
}

Powered by Google App Engine
This is Rietveld 408576698