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

Side by Side Diff: ui/compositor/overscroll/ui_scroll_input_manager.cc

Issue 1680613002: Adding momentum/overscroll to views:: ScrollViews Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Tableview layout. aaaand I think we are done Created 4 years, 4 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
« no previous file with comments | « ui/compositor/overscroll/ui_scroll_input_manager.h ('k') | ui/events/blink/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « ui/compositor/overscroll/ui_scroll_input_manager.h ('k') | ui/events/blink/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698