summaryrefslogtreecommitdiffstats
path: root/ui/base/gestures
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-18 23:44:38 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-18 23:44:38 +0000
commit3b9dc439a6d22327acbfa03a728a2245b1926ab8 (patch)
tree963acdb7e233fd71c2562a9bad065fdb2237ddf2 /ui/base/gestures
parentf053bed071b5de19bdaa560459b02dc219ca75b8 (diff)
downloadchromium_src-3b9dc439a6d22327acbfa03a728a2245b1926ab8.zip
chromium_src-3b9dc439a6d22327acbfa03a728a2245b1926ab8.tar.gz
chromium_src-3b9dc439a6d22327acbfa03a728a2245b1926ab8.tar.bz2
Touch related tweaks for tab dragging. Adds ability to current last
touch point. Makes RunMoveLoop work correctly when initiated from touch. BUG=113279 TEST=none R=sadrul@chromium.org Review URL: https://chromiumcodereview.appspot.com/10566032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142863 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/gestures')
-rw-r--r--ui/base/gestures/gesture_recognizer.h6
-rw-r--r--ui/base/gestures/gesture_recognizer_impl.cc10
-rw-r--r--ui/base/gestures/gesture_recognizer_impl.h2
-rw-r--r--ui/base/gestures/gesture_sequence.cc1
-rw-r--r--ui/base/gestures/gesture_sequence.h5
5 files changed, 24 insertions, 0 deletions
diff --git a/ui/base/gestures/gesture_recognizer.h b/ui/base/gestures/gesture_recognizer.h
index 6a4392b..a820824 100644
--- a/ui/base/gestures/gesture_recognizer.h
+++ b/ui/base/gestures/gesture_recognizer.h
@@ -65,6 +65,12 @@ class UI_EXPORT GestureRecognizer {
// NULL, all targets are cancelled.
virtual void TransferEventsTo(GestureConsumer* current_consumer,
GestureConsumer* new_consumer) = 0;
+
+ // If a gesture is underway for |consumer| |point| is set to the last touch
+ // point and true is returned. If no touch events have been processed for
+ // |consumer| false is returned and |point| is untouched.
+ virtual bool GetLastTouchPointForTarget(GestureConsumer* consumer,
+ gfx::Point* point) = 0;
};
} // namespace ui
diff --git a/ui/base/gestures/gesture_recognizer_impl.cc b/ui/base/gestures/gesture_recognizer_impl.cc
index 350488d..20b88d4 100644
--- a/ui/base/gestures/gesture_recognizer_impl.cc
+++ b/ui/base/gestures/gesture_recognizer_impl.cc
@@ -245,6 +245,16 @@ void GestureRecognizerImpl::TransferEventsTo(GestureConsumer* current_consumer,
}
}
+bool GestureRecognizerImpl::GetLastTouchPointForTarget(
+ GestureConsumer* consumer,
+ gfx::Point* point) {
+ if (consumer_sequence_.count(consumer) == 0)
+ return false;
+
+ *point = consumer_sequence_[consumer]->last_touch_location();
+ return true;
+}
+
////////////////////////////////////////////////////////////////////////////////
// GestureRecognizerImpl, protected:
diff --git a/ui/base/gestures/gesture_recognizer_impl.h b/ui/base/gestures/gesture_recognizer_impl.h
index 18030b7..fbd82d4 100644
--- a/ui/base/gestures/gesture_recognizer_impl.h
+++ b/ui/base/gestures/gesture_recognizer_impl.h
@@ -39,6 +39,8 @@ class UI_EXPORT GestureRecognizerImpl : public GestureRecognizer {
const gfx::Point& location) OVERRIDE;
virtual void TransferEventsTo(GestureConsumer* current_consumer,
GestureConsumer* new_consumer) OVERRIDE;
+ virtual bool GetLastTouchPointForTarget(GestureConsumer* consumer,
+ gfx::Point* point) OVERRIDE;
protected:
virtual GestureSequence* CreateSequence(GestureEventHelper* helper);
diff --git a/ui/base/gestures/gesture_sequence.cc b/ui/base/gestures/gesture_sequence.cc
index 586d792..3dd82d7 100644
--- a/ui/base/gestures/gesture_sequence.cc
+++ b/ui/base/gestures/gesture_sequence.cc
@@ -219,6 +219,7 @@ GestureSequence::~GestureSequence() {
GestureSequence::Gestures* GestureSequence::ProcessTouchEventForGesture(
const TouchEvent& event,
ui::TouchStatus status) {
+ last_touch_location_ = event.GetLocation();
if (status != ui::TOUCH_STATUS_UNKNOWN)
return NULL; // The event was consumed by a touch sequence.
diff --git a/ui/base/gestures/gesture_sequence.h b/ui/base/gestures/gesture_sequence.h
index 07d8cc4..78e9bb1 100644
--- a/ui/base/gestures/gesture_sequence.h
+++ b/ui/base/gestures/gesture_sequence.h
@@ -51,6 +51,8 @@ class UI_EXPORT GestureSequence {
const GesturePoint* points() const { return points_; }
int point_count() const { return point_count_; }
+ const gfx::Point& last_touch_location() const { return last_touch_location_; }
+
protected:
virtual base::OneShotTimer<GestureSequence>* CreateTimer();
base::OneShotTimer<GestureSequence>* long_press_timer() {
@@ -194,6 +196,9 @@ class UI_EXPORT GestureSequence {
GesturePoint points_[kMaxGesturePoints];
int point_count_;
+ // Location of the last touch event.
+ gfx::Point last_touch_location_;
+
GestureEventHelper* helper_;
DISALLOW_COPY_AND_ASSIGN(GestureSequence);