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

Unified Diff: content/browser/renderer_host/input/synthetic_pointer_action.cc

Issue 1884883005: Prepare SyntheticPointerAction to handle touch actions for multiple fingers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/browser/renderer_host/input/synthetic_pointer_action.cc
diff --git a/content/browser/renderer_host/input/synthetic_pointer_action.cc b/content/browser/renderer_host/input/synthetic_pointer_action.cc
index 6353f342631d0cf7cb7ca49235e5e5311823921b..7210ded4184d94936de8984558dab2c5b3938c06 100644
--- a/content/browser/renderer_host/input/synthetic_pointer_action.cc
+++ b/content/browser/renderer_host/input/synthetic_pointer_action.cc
@@ -10,25 +10,32 @@
namespace content {
+using blink::WebTouchEvent;
+
SyntheticPointerAction::SyntheticPointerAction(
const SyntheticPointerActionParams& params)
: params_(params) {}
SyntheticPointerAction::SyntheticPointerAction(
- const SyntheticPointerActionParams& params,
- SyntheticPointer* synthetic_pointer)
- : params_(params), synthetic_pointer_(synthetic_pointer) {}
+ const std::vector<SyntheticPointerActionParams>& param_list,
+ SyntheticPointer* synthetic_pointer,
+ int* index_map)
+ : param_list_(param_list),
+ synthetic_pointer_(synthetic_pointer),
+ index_map_(index_map) {}
SyntheticPointerAction::~SyntheticPointerAction() {}
SyntheticGesture::Result SyntheticPointerAction::ForwardInputEvents(
const base::TimeTicks& timestamp,
SyntheticGestureTarget* target) {
+ LOG(ERROR) << "SyntheticPointerAction::ForwardInputEvents ";
if (params_.gesture_source_type == SyntheticGestureParams::DEFAULT_INPUT)
params_.gesture_source_type =
target->GetDefaultSyntheticGestureSourceType();
DCHECK_NE(params_.gesture_source_type, SyntheticGestureParams::DEFAULT_INPUT);
+ DCHECK(synthetic_pointer_);
ForwardTouchOrMouseInputEvents(timestamp, target);
return SyntheticGesture::GESTURE_FINISHED;
@@ -37,21 +44,39 @@ SyntheticGesture::Result SyntheticPointerAction::ForwardInputEvents(
void SyntheticPointerAction::ForwardTouchOrMouseInputEvents(
const base::TimeTicks& timestamp,
SyntheticGestureTarget* target) {
- switch (params_.pointer_action_type()) {
- case SyntheticPointerActionParams::PointerActionType::PRESS:
- synthetic_pointer_->Press(params_.position().x(), params_.position().y(),
- target, timestamp);
- break;
- case SyntheticPointerActionParams::PointerActionType::MOVE:
- synthetic_pointer_->Move(params_.index(), params_.position().x(),
- params_.position().y(), target, timestamp);
- break;
- case SyntheticPointerActionParams::PointerActionType::RELEASE:
- synthetic_pointer_->Release(params_.index(), target, timestamp);
- break;
- default:
- NOTREACHED();
- break;
+ LOG(ERROR) << "SyntheticPointerAction::ForwardTouchOrMouseInputEvents "
+ << param_list_.size();
+ if (param_list_.size() == 0)
+ return;
+
+ for (auto iter = param_list_.begin(); iter != param_list_.end(); ++iter) {
+ SyntheticPointerActionParams params = (*iter);
tdresser 2016/04/18 15:24:39 () aren't needed.
+ CHECK_GE(params.index(), 0);
+ CHECK_LT(params.index(), WebTouchEvent::touchesLengthCap);
+ switch (params.pointer_action_type()) {
+ case SyntheticPointerActionParams::PointerActionType::PRESS: {
+ int index = synthetic_pointer_->Press(
+ params.position().x(), params.position().y(), target, timestamp);
+ index_map_[params.index()] = index;
tdresser 2016/04/18 15:24:39 Should we use a vector for index_map_? Somewhere w
lanwei 2016/04/19 19:05:32 Yes, I was thinking about which one to choose, I f
+ break;
+ }
+ case SyntheticPointerActionParams::PointerActionType::MOVE:
+ CHECK_GE(index_map_[params.index()], 0);
+ CHECK_LT(index_map_[params.index()], WebTouchEvent::touchesLengthCap);
+ synthetic_pointer_->Move(index_map_[params.index()],
+ params.position().x(), params.position().y(),
+ target, timestamp);
+ break;
+ case SyntheticPointerActionParams::PointerActionType::RELEASE:
+ CHECK_GE(index_map_[params.index()], 0);
+ CHECK_LT(index_map_[params.index()], WebTouchEvent::touchesLengthCap);
+ synthetic_pointer_->Release(index_map_[params.index()], target,
+ timestamp);
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
}
synthetic_pointer_->DispatchEvent(target, timestamp);
}

Powered by Google App Engine
This is Rietveld 408576698