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

Unified Diff: content/renderer/gpu/actions_parser.cc

Issue 2621353003: Replace mouse actions in pointer event tests with pointerActionSequence (Closed)
Patch Set: pointer mouse event 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_common_input.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/gpu/actions_parser.cc
diff --git a/content/renderer/gpu/actions_parser.cc b/content/renderer/gpu/actions_parser.cc
index 41b5a3e25a748187d3187ee8718f5bfd9a2236e3..438c584d5f7df9b3dca1d5f37a04b6f53856e8b6 100644
--- a/content/renderer/gpu/actions_parser.cc
+++ b/content/renderer/gpu/actions_parser.cc
@@ -37,6 +37,18 @@ SyntheticGestureParams::GestureSourceType ToSyntheticGestureSourceType(
return SyntheticGestureParams::DEFAULT_INPUT;
}
+SyntheticPointerActionParams::Button ToSyntheticMouseButton(
+ std::string button) {
+ if (button == "left")
+ return SyntheticPointerActionParams::Button::LEFT;
+ if (button == "middle")
+ return SyntheticPointerActionParams::Button::MIDDLE;
+ if (button == "right")
+ return SyntheticPointerActionParams::Button::RIGHT;
+ NOTREACHED() << "Unexpected button";
+ return SyntheticPointerActionParams::Button();
+}
+
} // namespace
ActionsParser::ActionsParser(base::Value* pointer_actions_value)
@@ -192,6 +204,20 @@ bool ActionsParser::ParseAction(
return false;
}
+ std::string button_name = "left";
+ if (action.HasKey("button") && !action.GetString("button", &button_name)) {
+ error_message_ = base::StringPrintf(
+ "actions[%d].actions.button is not a string", action_index_);
+ return false;
+ } else if (button_name != "left" && button_name != "middle" &&
+ button_name != "right") {
+ error_message_ = base::StringPrintf(
+ "actions[%d].actions.button is an unsupported button", action_index_);
+ return false;
+ }
+ SyntheticPointerActionParams::Button button =
+ ToSyntheticMouseButton(button_name);
+
double duration = 0;
int num_idle = 0;
if (pointer_action_type ==
@@ -212,11 +238,20 @@ bool ActionsParser::ParseAction(
SyntheticPointerActionParams action_param(pointer_action_type);
action_param.set_index(action_index_);
- if (pointer_action_type ==
- SyntheticPointerActionParams::PointerActionType::PRESS ||
- pointer_action_type ==
- SyntheticPointerActionParams::PointerActionType::MOVE) {
- action_param.set_position(gfx::PointF(position_x, position_y));
+ switch (pointer_action_type) {
+ case SyntheticPointerActionParams::PointerActionType::PRESS:
+ action_param.set_position(gfx::PointF(position_x, position_y));
+ action_param.set_button(button);
+ break;
+ case SyntheticPointerActionParams::PointerActionType::MOVE:
+ action_param.set_position(gfx::PointF(position_x, position_y));
+ break;
+ case SyntheticPointerActionParams::PointerActionType::RELEASE:
+ action_param.set_button(button);
+ break;
+ case SyntheticPointerActionParams::PointerActionType::IDLE:
+ case SyntheticPointerActionParams::PointerActionType::NOT_INITIALIZED:
+ break;
}
param_list.push_back(action_param);
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_common_input.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698