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

Unified Diff: content/common/input/synthetic_pointer_action_params.cc

Issue 2634183002: Support multi-button press for synthetic mouse events (Closed)
Patch Set: button Created 3 years, 11 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/common/input/synthetic_pointer_action_params.cc
diff --git a/content/common/input/synthetic_pointer_action_params.cc b/content/common/input/synthetic_pointer_action_params.cc
index 84efe479259462cfec12641b12359aefab239f52..7b858d6dcc66173cb142872db565ab60af2b76b5 100644
--- a/content/common/input/synthetic_pointer_action_params.cc
+++ b/content/common/input/synthetic_pointer_action_params.cc
@@ -7,12 +7,45 @@
namespace content {
SyntheticPointerActionParams::SyntheticPointerActionParams()
- : pointer_action_type_(PointerActionType::NOT_INITIALIZED), index_(0) {}
+ : pointer_action_type_(PointerActionType::NOT_INITIALIZED),
+ index_(0),
+ button_(Button::LEFT) {}
SyntheticPointerActionParams::SyntheticPointerActionParams(
PointerActionType action_type)
- : pointer_action_type_(action_type), index_(0) {}
+ : pointer_action_type_(action_type), index_(0), button_(Button::LEFT) {}
SyntheticPointerActionParams::~SyntheticPointerActionParams() {}
+// static
+unsigned SyntheticPointerActionParams::GetWebMouseEventModifier(
+ SyntheticPointerActionParams::Button button) {
+ switch (button) {
+ case SyntheticPointerActionParams::Button::LEFT:
+ return blink::WebMouseEvent::LeftButtonDown;
+ case SyntheticPointerActionParams::Button::MIDDLE:
+ return blink::WebMouseEvent::MiddleButtonDown;
+ case SyntheticPointerActionParams::Button::RIGHT:
+ return blink::WebMouseEvent::RightButtonDown;
+ }
+ NOTREACHED();
+ return blink::WebMouseEvent::NoModifiers;
+}
+
+// static
+blink::WebMouseEvent::Button
+SyntheticPointerActionParams::GetWebMouseEventButton(
+ SyntheticPointerActionParams::Button button) {
+ switch (button) {
+ case SyntheticPointerActionParams::Button::LEFT:
+ return blink::WebMouseEvent::Button::Left;
+ case SyntheticPointerActionParams::Button::MIDDLE:
+ return blink::WebMouseEvent::Button::Middle;
+ case SyntheticPointerActionParams::Button::RIGHT:
+ return blink::WebMouseEvent::Button::Right;
+ }
+ NOTREACHED();
+ return blink::WebMouseEvent::Button::NoButton;
+}
+
} // namespace content
« no previous file with comments | « content/common/input/synthetic_pointer_action_params.h ('k') | content/common/input/synthetic_web_input_event_builders.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698