Index: content/browser/web_contents/web_drag_dest_mac.mm |
diff --git a/content/browser/web_contents/web_drag_dest_mac.mm b/content/browser/web_contents/web_drag_dest_mac.mm |
index 0e57d4fffdee46ca083f189ca7a90f08e91da6ae..764ff6b0e85fa554f93b2c317dce467ffa8fcba6 100644 |
--- a/content/browser/web_contents/web_drag_dest_mac.mm |
+++ b/content/browser/web_contents/web_drag_dest_mac.mm |
@@ -35,6 +35,19 @@ int GetModifierFlags() { |
modifier_state |= blink::WebInputEvent::AltKey; |
if (currentModifiers & ::cmdKey) |
modifier_state |= blink::WebInputEvent::MetaKey; |
+ |
+ // The return value of 1 << 0 corresponds to the left mouse button, |
+ // 1 << 1 corresponds to the right mouse button, |
+ // 1 << n, n >= 2 correspond to other mouse buttons. |
+ NSUInteger pressedButtons = [NSEvent pressedMouseButtons]; |
+ |
+ if (pressedButtons & (1 << 0)) |
+ modifier_state |= blink::WebInputEvent::LeftButtonDown; |
+ if (pressedButtons & (1 << 1)) |
+ modifier_state |= blink::WebInputEvent::RightButtonDown; |
+ if (pressedButtons & (1 << 2)) |
+ modifier_state |= blink::WebInputEvent::MiddleButtonDown; |
+ |
return modifier_state; |
} |