summaryrefslogtreecommitdiffstats
path: root/content/common/input
diff options
context:
space:
mode:
authorjdduke <jdduke@chromium.org>2014-12-15 13:49:06 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-15 21:50:22 +0000
commit11e45a87addf6fa39f6a7d505ff318236b7b82f4 (patch)
tree21a669e92a399bf20523fe72d8f9b5c63368aaec /content/common/input
parent13fbeece908a65fb7264a3ccc3ce522fb62c276f (diff)
downloadchromium_src-11e45a87addf6fa39f6a7d505ff318236b7b82f4.zip
chromium_src-11e45a87addf6fa39f6a7d505ff318236b7b82f4.tar.gz
chromium_src-11e45a87addf6fa39f6a7d505ff318236b7b82f4.tar.bz2
Expose native, desktop and mobile gesture detection defaults
Provide generic desktop and mobile gesture configurations, in addition to the native platform configuration. This will allow devtools touch emulation to more faithfully emulate a particular device. Note that this change involved decoupling the TouchEventQueue from platform-specific slop region constants, afforded by a WebTouchEvent flag indicating whether the event may cause scrolling as a default action. BUG=425586 Review URL: https://codereview.chromium.org/679633005 Cr-Commit-Position: refs/heads/master@{#308429}
Diffstat (limited to 'content/common/input')
-rw-r--r--content/common/input/synthetic_web_input_event_builders.cc13
-rw-r--r--content/common/input/web_input_event_traits.cc1
2 files changed, 11 insertions, 3 deletions
diff --git a/content/common/input/synthetic_web_input_event_builders.cc b/content/common/input/synthetic_web_input_event_builders.cc
index d3addb6..ab2968a 100644
--- a/content/common/input/synthetic_web_input_event_builders.cc
+++ b/content/common/input/synthetic_web_input_event_builders.cc
@@ -163,6 +163,7 @@ void SyntheticWebTouchEvent::ResetPoints() {
}
touchesLength = point;
type = WebInputEvent::Undefined;
+ causesScrollingIfUncanceled = false;
}
int SyntheticWebTouchEvent::PressPoint(float x, float y) {
@@ -181,7 +182,11 @@ int SyntheticWebTouchEvent::PressPoint(float x, float y) {
}
void SyntheticWebTouchEvent::MovePoint(int index, float x, float y) {
- CHECK(index >= 0 && index < touchesLengthCap);
+ CHECK_GE(index, 0);
+ CHECK_LT(index, touchesLengthCap);
+ // Always set this bit to avoid otherwise unexpected touchmove suppression.
+ // The caller can opt-out explicitly, if necessary.
+ causesScrollingIfUncanceled = true;
WebTouchPoint& point = touches[index];
point.position.x = point.screenPosition.x = x;
point.position.y = point.screenPosition.y = y;
@@ -191,14 +196,16 @@ void SyntheticWebTouchEvent::MovePoint(int index, float x, float y) {
}
void SyntheticWebTouchEvent::ReleasePoint(int index) {
- CHECK(index >= 0 && index < touchesLengthCap);
+ CHECK_GE(index, 0);
+ CHECK_LT(index, touchesLengthCap);
touches[index].state = WebTouchPoint::StateReleased;
WebTouchEventTraits::ResetType(
WebInputEvent::TouchEnd, timeStampSeconds, this);
}
void SyntheticWebTouchEvent::CancelPoint(int index) {
- CHECK(index >= 0 && index < touchesLengthCap);
+ CHECK_GE(index, 0);
+ CHECK_LT(index, touchesLengthCap);
touches[index].state = WebTouchPoint::StateCancelled;
WebTouchEventTraits::ResetType(
WebInputEvent::TouchCancel, timeStampSeconds, this);
diff --git a/content/common/input/web_input_event_traits.cc b/content/common/input/web_input_event_traits.cc
index 087cf61..4e9c754 100644
--- a/content/common/input/web_input_event_traits.cc
+++ b/content/common/input/web_input_event_traits.cc
@@ -237,6 +237,7 @@ void Coalesce(const WebTouchEvent& event_to_coalesce, WebTouchEvent* event) {
if (old_event.touches[i_old].state == blink::WebTouchPoint::StateMoved)
event->touches[i].state = blink::WebTouchPoint::StateMoved;
}
+ event->causesScrollingIfUncanceled |= old_event.causesScrollingIfUncanceled;
}
bool CanCoalesce(const WebGestureEvent& event_to_coalesce,