| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/compositor/overscroll/ui_scroll_input_manager.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "ui/compositor/overscroll/ui_input_handler.h" |
| 9 #include "ui/events/event.h" |
| 10 |
| 11 namespace ui { |
| 12 |
| 13 UIScrollInputManager::UIScrollInputManager( |
| 14 const base::WeakPtr<cc::InputHandler>& input_handler) |
| 15 : input_wrapper_(new UIInputHandler(input_handler)) {} |
| 16 |
| 17 UIScrollInputManager::~UIScrollInputManager() {} |
| 18 |
| 19 void UIScrollInputManager::OnScrollEvent(const ScrollEvent& event) { |
| 20 // On Mac, an event ending the non-fling portion of a scroll can't be |
| 21 // distinguished from an event ending a scroll that won't fling. The start of |
| 22 // the fling is therefore made identifiable by being an an update only (not a |
| 23 // "begin"). But since the InputHandler has already been told of the end, |
| 24 // treat the first momentum fling as a "resume" by holding state. |
| 25 if (!scrolling_) { |
| 26 scrolling_ = true; |
| 27 input_wrapper_->HandleScrollBegin(event); |
| 28 } |
| 29 input_wrapper_->HandleScrollUpdate(event); |
| 30 if (event.momentum_phase() & EM_PHASE_END) { |
| 31 DCHECK(scrolling_); |
| 32 scrolling_ = false; |
| 33 input_wrapper_->HandleScrollEnd(event); |
| 34 } |
| 35 } |
| 36 |
| 37 } // namespace ui |
| OLD | NEW |