OLD | NEW |
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/controls/menu/submenu_view.h" | 5 #include "ui/views/controls/menu/submenu_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "ui/base/accessibility/accessible_view_state.h" | 10 #include "ui/base/accessibility/accessible_view_state.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 handled = OnScroll(0, event->details().scroll_y()); | 274 handled = OnScroll(0, event->details().scroll_y()); |
275 break; | 275 break; |
276 case ui::ET_GESTURE_SCROLL_END: | 276 case ui::ET_GESTURE_SCROLL_END: |
277 break; | 277 break; |
278 case ui::ET_SCROLL_FLING_START: | 278 case ui::ET_SCROLL_FLING_START: |
279 if (event->details().velocity_y() != 0.0f) | 279 if (event->details().velocity_y() != 0.0f) |
280 scroll_animator_->Start(0, event->details().velocity_y()); | 280 scroll_animator_->Start(0, event->details().velocity_y()); |
281 break; | 281 break; |
282 case ui::ET_GESTURE_TAP_DOWN: | 282 case ui::ET_GESTURE_TAP_DOWN: |
283 case ui::ET_SCROLL_FLING_CANCEL: | 283 case ui::ET_SCROLL_FLING_CANCEL: |
284 scroll_animator_->Stop(); | 284 if (scroll_animator_->is_scrolling()) |
| 285 scroll_animator_->Stop(); |
| 286 else |
| 287 handled = false; |
285 break; | 288 break; |
286 default: | 289 default: |
287 handled = false; | 290 handled = false; |
288 break; | 291 break; |
289 } | 292 } |
290 if (handled) | 293 if (handled) |
291 event->SetHandled(); | 294 event->SetHandled(); |
292 } | 295 } |
293 | 296 |
294 bool SubmenuView::IsShowing() { | 297 bool SubmenuView::IsShowing() { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 y = std::max(y, 0); | 459 y = std::max(y, 0); |
457 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); | 460 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); |
458 if (new_vis_bounds != vis_bounds) { | 461 if (new_vis_bounds != vis_bounds) { |
459 ScrollRectToVisible(new_vis_bounds); | 462 ScrollRectToVisible(new_vis_bounds); |
460 return true; | 463 return true; |
461 } | 464 } |
462 return false; | 465 return false; |
463 } | 466 } |
464 | 467 |
465 } // namespace views | 468 } // namespace views |
OLD | NEW |