OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ |
| 6 #define CC_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ |
| 7 |
| 8 #include "base/time/time.h" |
| 9 #include "cc/base/cc_export.h" |
| 10 #include "ui/gfx/geometry/vector2d_f.h" |
| 11 |
| 12 namespace cc { |
| 13 |
| 14 class CC_EXPORT ScrollElasticityController { |
| 15 public: |
| 16 virtual void WillShutdown() = 0; |
| 17 virtual void Animate(base::TimeTicks time) = 0; |
| 18 }; |
| 19 |
| 20 // ScrollElasticityControllerClient is based on |
| 21 // WebKit/Source/platform/mac/ScrollElasticityController.h |
| 22 /* |
| 23 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 24 * |
| 25 * Redistribution and use in source and binary forms, with or without |
| 26 * modification, are permitted provided that the following conditions |
| 27 * are met: |
| 28 * 1. Redistributions of source code must retain the above copyright |
| 29 * notice, this list of conditions and the following disclaimer. |
| 30 * 2. Redistributions in binary form must reproduce the above copyright |
| 31 * notice, this list of conditions and the following disclaimer in the |
| 32 * documentation and/or other materials provided with the distribution. |
| 33 * |
| 34 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
| 35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 36 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 37 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
| 38 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 39 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 40 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 41 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 42 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 43 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 44 * THE POSSIBILITY OF SUCH DAMAGE. |
| 45 */ |
| 46 |
| 47 class CC_EXPORT ScrollElasticityControllerClient { |
| 48 public: |
| 49 virtual void BindToController(ScrollElasticityController* controller) = 0; |
| 50 virtual bool AllowsHorizontalStretching() = 0; |
| 51 virtual bool AllowsVerticalStretching() = 0; |
| 52 // The amount that the view is stretched past the normal allowable bounds. |
| 53 // The "overhang" amount. |
| 54 virtual gfx::Vector2dF StretchAmount() = 0; |
| 55 virtual bool PinnedInDirection(const gfx::Vector2dF& direction) = 0; |
| 56 virtual bool CanScrollHorizontally() = 0; |
| 57 virtual bool CanScrollVertically() = 0; |
| 58 |
| 59 // Return the absolute scroll position, not relative to the scroll origin. |
| 60 virtual gfx::Vector2dF AbsoluteScrollPosition() = 0; |
| 61 |
| 62 virtual void ImmediateScrollBy(const gfx::Vector2dF& scroll) = 0; |
| 63 virtual void ImmediateScrollByWithoutContentEdgeConstraints( |
| 64 const gfx::Vector2dF& scroll) = 0; |
| 65 virtual void StartSnapRubberbandTimer() = 0; |
| 66 virtual void StopSnapRubberbandTimer() = 0; |
| 67 |
| 68 // If the current scroll position is within the overhang area, this function |
| 69 // will cause |
| 70 // the page to scroll to the nearest boundary point. |
| 71 virtual void AdjustScrollPositionToBoundsIfNecessary() = 0; |
| 72 }; |
| 73 } // namespace cc |
| 74 |
| 75 #endif // CC_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ |
OLD | NEW |