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

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

Issue 2336803003: Make SyntheticPointerAction to flush the pointer action sequence (Closed)
Patch Set: controller Created 4 years 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_list_params.cc
diff --git a/content/common/input/synthetic_pointer_action_list_params.cc b/content/common/input/synthetic_pointer_action_list_params.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6a397d7741b532d16c1d5ff94a797e1c656c39dd
--- /dev/null
+++ b/content/common/input/synthetic_pointer_action_list_params.cc
@@ -0,0 +1,57 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/input/synthetic_pointer_action_list_params.h"
+
+#include "base/logging.h"
+
+namespace content {
+
+SyntheticPointerActionListParams::SyntheticPointerActionListParams() {}
+
+SyntheticPointerActionListParams::SyntheticPointerActionListParams(
+ ParamList& param_list) {
+ params.push_back(param_list);
+}
+
+SyntheticPointerActionListParams::SyntheticPointerActionListParams(
+ const SyntheticPointerActionListParams& other)
+ : SyntheticGestureParams(other), params(other.params) {}
+
+SyntheticPointerActionListParams::~SyntheticPointerActionListParams() {}
+
+SyntheticGestureParams::GestureType
+SyntheticPointerActionListParams::GetGestureType() const {
+ return POINTER_ACTION_LIST;
+}
+
+const SyntheticPointerActionListParams* SyntheticPointerActionListParams::Cast(
+ const SyntheticGestureParams* gesture_params) {
+ DCHECK(gesture_params);
+ DCHECK_EQ(POINTER_ACTION_LIST, gesture_params->GetGestureType());
+ return static_cast<const SyntheticPointerActionListParams*>(gesture_params);
+}
+
+void SyntheticPointerActionListParams::PushPointerActionParams(
+ const SyntheticPointerActionParams& param) {
+ ParamList param_list;
+ param_list.push_back(param);
+ params.push_back(param_list);
+}
+
+void SyntheticPointerActionListParams::PushPointerActionParams(
+ int index,
+ const SyntheticPointerActionParams& param) {
Navid Zolghadr 2016/12/06 17:05:38 On way we can get away with this index is to just
lanwei 2016/12/07 19:04:27 You are right, exposing the index is not really sa
+ int size = static_cast<int>(params.size());
+ DCHECK_GE(index, 0);
+ DCHECK_LE(index, size);
+
+ if (size > index) {
Navid Zolghadr 2016/12/06 17:05:38 We might also need to add index >=0.
+ params[index].push_back(param);
+ return;
+ }
+ PushPointerActionParams(param);
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698