dbates@webkit.org | b8ade58 | 2014-01-09 22:59:07 +0000 | [diff] [blame] | 1 | /* |
bfulgham@apple.com | 3cb8c99 | 2015-02-21 03:34:09 +0000 | [diff] [blame] | 2 | * Copyright (C) 2011, 2015 Apple Inc. All rights reserved. |
dbates@webkit.org | b8ade58 | 2014-01-09 22:59:07 +0000 | [diff] [blame] | 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
| 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
| 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 23 | * THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
| 26 | #ifndef ScrollAnimatorIOS_h |
| 27 | #define ScrollAnimatorIOS_h |
| 28 | |
| 29 | #include "ScrollAnimator.h" |
| 30 | |
| 31 | #include "IntPoint.h" |
| 32 | |
| 33 | namespace WebCore { |
| 34 | |
| 35 | class PlatformTouchEvent; |
| 36 | |
| 37 | class ScrollAnimatorIOS : public ScrollAnimator { |
| 38 | public: |
bfulgham@apple.com | 3cb8c99 | 2015-02-21 03:34:09 +0000 | [diff] [blame] | 39 | ScrollAnimatorIOS(ScrollableArea&); |
dbates@webkit.org | b8ade58 | 2014-01-09 22:59:07 +0000 | [diff] [blame] | 40 | virtual ~ScrollAnimatorIOS(); |
| 41 | |
| 42 | #if ENABLE(TOUCH_EVENTS) |
darin@apple.com | 11ff47c | 2016-03-04 16:47:55 +0000 | [diff] [blame^] | 43 | bool handleTouchEvent(const PlatformTouchEvent&) override; |
dbates@webkit.org | b8ade58 | 2014-01-09 22:59:07 +0000 | [diff] [blame] | 44 | #endif |
| 45 | |
| 46 | private: |
dbates@webkit.org | 348e5aa | 2014-09-04 15:42:54 +0000 | [diff] [blame] | 47 | #if ENABLE(TOUCH_EVENTS) |
dbates@webkit.org | b8ade58 | 2014-01-09 22:59:07 +0000 | [diff] [blame] | 48 | void determineScrollableAreaForTouchSequence(const IntSize& touchDelta); |
| 49 | |
| 50 | // State for handling sequences of touches in defaultTouchEventHandler. |
| 51 | enum AxisLatch { |
| 52 | AxisLatchNotComputed, |
| 53 | AxisLatchNone, |
| 54 | AxisLatchHorizontal, |
| 55 | AxisLatchVertical |
| 56 | }; |
| 57 | AxisLatch m_touchScrollAxisLatch; |
| 58 | bool m_inTouchSequence; |
| 59 | bool m_committedToScrollAxis; |
| 60 | bool m_startedScroll; |
| 61 | IntPoint m_firstTouchPoint; |
| 62 | IntPoint m_lastTouchPoint; |
| 63 | |
| 64 | // When we're in a touch sequence, this will point to the scrollable area that |
| 65 | // should actually be scrolled during the sequence. |
| 66 | ScrollableArea* m_scrollableAreaForTouchSequence; |
dbates@webkit.org | 348e5aa | 2014-09-04 15:42:54 +0000 | [diff] [blame] | 67 | #endif |
dbates@webkit.org | b8ade58 | 2014-01-09 22:59:07 +0000 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | } // namespace WebCore |
| 71 | |
| 72 | #endif // ScrollAnimatorIOS_h |