| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_RENDERER_INPUT_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ | 5 #ifndef UI_EVENTS_BLINK_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ |
| 6 #define CONTENT_RENDERER_INPUT_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ | 6 #define UI_EVENTS_BLINK_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "cc/input/scroll_elasticity_helper.h" | 10 #include "cc/input/scroll_elasticity_helper.h" |
| 11 #include "content/common/content_export.h" | |
| 12 #include "third_party/WebKit/public/web/WebInputEvent.h" | 11 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 13 | 12 |
| 14 // InputScrollElasticityController is based on | 13 // InputScrollElasticityController is based on |
| 15 // WebKit/Source/platform/mac/ScrollElasticityController.h | 14 // WebKit/Source/platform/mac/ScrollElasticityController.h |
| 16 /* | 15 /* |
| 17 * Copyright (C) 2011 Apple Inc. All rights reserved. | 16 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 18 * | 17 * |
| 19 * Redistribution and use in source and binary forms, with or without | 18 * Redistribution and use in source and binary forms, with or without |
| 20 * modification, are permitted provided that the following conditions | 19 * modification, are permitted provided that the following conditions |
| 21 * are met: | 20 * are met: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 36 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 38 * THE POSSIBILITY OF SUCH DAMAGE. | 37 * THE POSSIBILITY OF SUCH DAMAGE. |
| 39 */ | 38 */ |
| 40 | 39 |
| 41 namespace cc { | 40 namespace cc { |
| 42 struct InputHandlerScrollResult; | 41 struct InputHandlerScrollResult; |
| 43 } // namespace cc | 42 } // namespace cc |
| 44 | 43 |
| 45 namespace content { | 44 namespace ui { |
| 46 | 45 |
| 47 class CONTENT_EXPORT InputScrollElasticityController { | 46 class InputScrollElasticityController { |
| 48 public: | 47 public: |
| 49 explicit InputScrollElasticityController(cc::ScrollElasticityHelper* helper); | 48 explicit InputScrollElasticityController(cc::ScrollElasticityHelper* helper); |
| 50 virtual ~InputScrollElasticityController(); | 49 virtual ~InputScrollElasticityController(); |
| 51 | 50 |
| 52 base::WeakPtr<InputScrollElasticityController> GetWeakPtr(); | 51 base::WeakPtr<InputScrollElasticityController> GetWeakPtr(); |
| 53 | 52 |
| 54 // Update the overscroll state based a wheel event that has been processed. | 53 // Update the overscroll state based a wheel event that has been processed. |
| 55 // Note that this assumes that all events are coming from a single input | 54 // Note that this assumes that all events are coming from a single input |
| 56 // device. If the user simultaneously uses multiple input devices, Cocoa may | 55 // device. If the user simultaneously uses multiple input devices, Cocoa may |
| 57 // not correctly pass all the gesture begin and end events. In this case, | 56 // not correctly pass all the gesture begin and end events. In this case, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // This is set in response to a scroll (most likely programmatic) occuring | 135 // This is set in response to a scroll (most likely programmatic) occuring |
| 137 // while animating the momentum phase. In this case, re-set the initial | 136 // while animating the momentum phase. In this case, re-set the initial |
| 138 // velocity, stretch, and start time at the next frame (this is the same | 137 // velocity, stretch, and start time at the next frame (this is the same |
| 139 // behavior as would happen if the scroll were caused by an active scroll). | 138 // behavior as would happen if the scroll were caused by an active scroll). |
| 140 bool momentum_animation_reset_at_next_frame_; | 139 bool momentum_animation_reset_at_next_frame_; |
| 141 | 140 |
| 142 base::WeakPtrFactory<InputScrollElasticityController> weak_factory_; | 141 base::WeakPtrFactory<InputScrollElasticityController> weak_factory_; |
| 143 DISALLOW_COPY_AND_ASSIGN(InputScrollElasticityController); | 142 DISALLOW_COPY_AND_ASSIGN(InputScrollElasticityController); |
| 144 }; | 143 }; |
| 145 | 144 |
| 146 } // namespace content | 145 } // namespace ui |
| 147 | 146 |
| 148 #endif // CONTENT_RENDERER_INPUT_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ | 147 #endif // UI_EVENTS_BLINK_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ |
| OLD | NEW |