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

Side by Side Diff: ui/views/widget/root_view.cc

Issue 11787042: views: Stop dispatching scroll-gesture events if the scroll-begin event wasn't handled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/root_view.h" 5 #include "ui/views/widget/root_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 event->SetHandled(); 281 event->SetHandled();
282 return; 282 return;
283 } 283 }
284 } 284 }
285 scroll_gesture_handler_ = NULL; 285 scroll_gesture_handler_ = NULL;
286 } 286 }
287 287
288 return; 288 return;
289 } 289 }
290 290
291 // If there was no handler for a SCROLL_BEGIN event, then subsequent scroll
292 // events are not dispatched to any views.
293 switch (event->type()) {
294 case ui::ET_GESTURE_SCROLL_UPDATE:
295 case ui::ET_GESTURE_SCROLL_END:
296 case ui::ET_SCROLL_FLING_START:
297 return;
298 default:
299 break;
300 }
301
291 // Walk up the tree until we find a view that wants the gesture event. 302 // Walk up the tree until we find a view that wants the gesture event.
292 for (gesture_handler_ = GetEventHandlerForPoint(event->location()); 303 for (gesture_handler_ = GetEventHandlerForPoint(event->location());
293 gesture_handler_ && (gesture_handler_ != this); 304 gesture_handler_ && (gesture_handler_ != this);
294 gesture_handler_ = gesture_handler_->parent()) { 305 gesture_handler_ = gesture_handler_->parent()) {
295 if (!gesture_handler_->enabled()) { 306 if (!gesture_handler_->enabled()) {
296 // Disabled views eat events but are treated as not handled. 307 // Disabled views eat events but are treated as not handled.
297 return; 308 return;
298 } 309 }
299 310
300 // See if this view wants to handle the Gesture. 311 // See if this view wants to handle the Gesture.
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 } 662 }
652 663
653 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) { 664 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) {
654 last_mouse_event_flags_ = event.flags(); 665 last_mouse_event_flags_ = event.flags();
655 last_mouse_event_x_ = event.x(); 666 last_mouse_event_x_ = event.x();
656 last_mouse_event_y_ = event.y(); 667 last_mouse_event_y_ = event.y();
657 } 668 }
658 669
659 } // namespace internal 670 } // namespace internal
660 } // namespace views 671 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698