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

Unified Diff: content/browser/renderer_host/web_input_event_aura.cc

Issue 302593002: Use changed_button_flags() when converting MouseEvent to blink::WebMouseEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use changed_button_flags() only if it is set. Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/web_input_event_aura.cc
diff --git a/content/browser/renderer_host/web_input_event_aura.cc b/content/browser/renderer_host/web_input_event_aura.cc
index a4cf12b0e51041a305be9a491011f1d83cef90e9..be4906871ec37afaa3bbe7d7b41a9579939cacde 100644
--- a/content/browser/renderer_host/web_input_event_aura.cc
+++ b/content/browser/renderer_host/web_input_event_aura.cc
@@ -313,11 +313,20 @@ blink::WebMouseEvent MakeWebMouseEventFromAuraEvent(ui::MouseEvent* event) {
webkit_event.timeStampSeconds = event->time_stamp().InSecondsF();
webkit_event.button = blink::WebMouseEvent::ButtonNone;
- if (event->flags() & ui::EF_LEFT_MOUSE_BUTTON)
+ int button_flags = event->flags();
+ if (event->type() == ui::ET_MOUSE_PRESSED ||
+ event->type() == ui::ET_MOUSE_RELEASED) {
+ // We want to use changed_button_flags() for mouse pressed & released.
+ // These flags can be used only if they are set which is not always the case
+ // (see e.g. GetChangedMouseButtonFlagsFromNative() in events_win.cc).
+ if (event->changed_button_flags())
+ button_flags = event->changed_button_flags();
+ }
+ if (button_flags & ui::EF_LEFT_MOUSE_BUTTON)
webkit_event.button = blink::WebMouseEvent::ButtonLeft;
- if (event->flags() & ui::EF_MIDDLE_MOUSE_BUTTON)
+ if (button_flags & ui::EF_MIDDLE_MOUSE_BUTTON)
webkit_event.button = blink::WebMouseEvent::ButtonMiddle;
- if (event->flags() & ui::EF_RIGHT_MOUSE_BUTTON)
+ if (button_flags & ui::EF_RIGHT_MOUSE_BUTTON)
webkit_event.button = blink::WebMouseEvent::ButtonRight;
switch (event->type()) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698