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

Side by Side Diff: content/common/input/synthetic_pointer_action_params.h

Issue 2621353003: Replace mouse actions in pointer event tests with pointerActionSequence (Closed)
Patch Set: mouse test 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_ 5 #ifndef CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_
6 #define CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_ 6 #define CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "content/common/input/input_param_traits.h" 10 #include "content/common/input/input_param_traits.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 DCHECK_LT(index, blink::WebTouchEvent::kTouchesLengthCap); 44 DCHECK_LT(index, blink::WebTouchEvent::kTouchesLengthCap);
45 index_ = index; 45 index_ = index;
46 } 46 }
47 47
48 void set_position(const gfx::PointF& position) { 48 void set_position(const gfx::PointF& position) {
49 DCHECK(pointer_action_type_ == PointerActionType::PRESS || 49 DCHECK(pointer_action_type_ == PointerActionType::PRESS ||
50 pointer_action_type_ == PointerActionType::MOVE); 50 pointer_action_type_ == PointerActionType::MOVE);
51 position_ = position; 51 position_ = position;
52 } 52 }
53 53
54 void set_button(int button) {
55 DCHECK(pointer_action_type_ == PointerActionType::PRESS ||
56 pointer_action_type_ == PointerActionType::RELEASE);
57 DCHECK_GE(button, 0);
58 DCHECK_LT(button, 3);
59 button_ = button;
60 }
61
54 PointerActionType pointer_action_type() const { return pointer_action_type_; } 62 PointerActionType pointer_action_type() const { return pointer_action_type_; }
55 63
56 int index() const { 64 int index() const {
57 DCHECK_GE(index_, 0); 65 DCHECK_GE(index_, 0);
58 DCHECK_LT(index_, blink::WebTouchEvent::kTouchesLengthCap); 66 DCHECK_LT(index_, blink::WebTouchEvent::kTouchesLengthCap);
59 return index_; 67 return index_;
60 } 68 }
61 69
62 gfx::PointF position() const { 70 gfx::PointF position() const {
63 DCHECK(pointer_action_type_ == PointerActionType::PRESS || 71 DCHECK(pointer_action_type_ == PointerActionType::PRESS ||
64 pointer_action_type_ == PointerActionType::MOVE); 72 pointer_action_type_ == PointerActionType::MOVE);
65 return position_; 73 return position_;
66 } 74 }
67 75
76 int button() const {
77 DCHECK(pointer_action_type_ == PointerActionType::PRESS ||
78 pointer_action_type_ == PointerActionType::RELEASE);
79 DCHECK_GE(button_, 0);
80 DCHECK_LT(button_, 3);
Navid Zolghadr 2017/01/12 18:23:46 Shouldn't this be LE with the current code? Althou
lanwei 2017/01/13 17:29:30 Done.
81 return button_;
82 }
83
68 private: 84 private:
69 friend struct IPC::ParamTraits<content::SyntheticPointerActionParams>; 85 friend struct IPC::ParamTraits<content::SyntheticPointerActionParams>;
70 friend struct ipc_fuzzer::FuzzTraits<content::SyntheticPointerActionParams>; 86 friend struct ipc_fuzzer::FuzzTraits<content::SyntheticPointerActionParams>;
71 87
72 PointerActionType pointer_action_type_; 88 PointerActionType pointer_action_type_;
73 // The position of the pointer, where it presses or moves to. 89 // The position of the pointer, where it presses or moves to.
74 gfx::PointF position_; 90 gfx::PointF position_;
75 // The index of the pointer in the pointer action sequence passed from the 91 // The index of the pointer in the pointer action sequence passed from the
76 // user API. 92 // user API.
77 int index_; 93 int index_;
94 int button_;
78 }; 95 };
79 96
80 } // namespace content 97 } // namespace content
81 98
82 #endif // CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_ 99 #endif // CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698