summaryrefslogtreecommitdiffstats
path: root/ui/views/widget
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-22 04:29:31 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-22 04:29:31 +0000
commit6b28dd277bf26851288a4e435e67f88af24d0da2 (patch)
tree9253a38debce2d89cc8effa624fe12de36ad283b /ui/views/widget
parentff51c40874d8df74882a615781887eeb5f29a404 (diff)
downloadchromium_src-6b28dd277bf26851288a4e435e67f88af24d0da2.zip
chromium_src-6b28dd277bf26851288a4e435e67f88af24d0da2.tar.gz
chromium_src-6b28dd277bf26851288a4e435e67f88af24d0da2.tar.bz2
Wire ScrollEvent to views and handle it in app list.
- Pass ScrollEvent to views system; - Add a OnScrollEvent to View; - Forward ScrollEvent to RootView in Widget; - RootView dispatches ScrollEvent to view under where event happens and if not processed, pass it to the parent; - Handle ScrollEvent to switch pages in app list; BUG=131075 TEST=Verify two-finger scroll on touch pad switches pages in app list; Review URL: https://chromiumcodereview.appspot.com/10577045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143531 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/widget')
-rw-r--r--ui/views/widget/root_view.cc9
-rw-r--r--ui/views/widget/root_view.h1
-rw-r--r--ui/views/widget/widget.cc3
3 files changed, 13 insertions, 0 deletions
diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc
index 515fa23..5d2aba3 100644
--- a/ui/views/widget/root_view.cc
+++ b/ui/views/widget/root_view.cc
@@ -381,6 +381,15 @@ bool RootView::OnMouseWheel(const MouseWheelEvent& event) {
return consumed;
}
+bool RootView::OnScrollEvent(const ScrollEvent& event) {
+ ScrollEvent e(event, this);
+ bool consumed = false;
+ for (View* v = GetEventHandlerForPoint(e.location());
+ v && v != this && !consumed; v = v->parent())
+ consumed = v->OnScrollEvent(e);
+ return consumed;
+}
+
ui::TouchStatus RootView::OnTouchEvent(const TouchEvent& event) {
// TODO: this looks all wrong. On a TOUCH_PRESSED we should figure out the
// view and target that view with all touches with the same id until the
diff --git a/ui/views/widget/root_view.h b/ui/views/widget/root_view.h
index 9ffd601..2db8a91 100644
--- a/ui/views/widget/root_view.h
+++ b/ui/views/widget/root_view.h
@@ -105,6 +105,7 @@ class VIEWS_EXPORT RootView : public View, public FocusTraversable {
virtual void OnMouseMoved(const MouseEvent& event) OVERRIDE;
virtual void OnMouseExited(const MouseEvent& event) OVERRIDE;
virtual bool OnMouseWheel(const MouseWheelEvent& event) OVERRIDE;
+ virtual bool OnScrollEvent(const ScrollEvent& event) OVERRIDE;
virtual ui::TouchStatus OnTouchEvent(const TouchEvent& event) OVERRIDE;
virtual ui::GestureStatus OnGestureEvent(const GestureEvent& event) OVERRIDE;
virtual void SetMouseHandler(View* new_mouse_handler) OVERRIDE;
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 31748ed..21c6735 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -1116,6 +1116,9 @@ bool Widget::OnMouseEvent(const MouseEvent& event) {
case ui::ET_MOUSEWHEEL:
return GetRootView()->OnMouseWheel(
reinterpret_cast<const MouseWheelEvent&>(event));
+ case ui::ET_SCROLL:
+ return GetRootView()->OnScrollEvent(
+ reinterpret_cast<const ScrollEvent&>(event));
default:
return false;
}