blob: 74edc8ecbfc4a66c8d2951d2f4eed2531e5a1a0e [file] [log] [blame]
dbates@webkit.orgb8ade582014-01-09 22:59:07 +00001/*
bfulgham@apple.com3cb8c992015-02-21 03:34:09 +00002 * Copyright (C) 2011, 2015 Apple Inc. All rights reserved.
dbates@webkit.orgb8ade582014-01-09 22:59:07 +00003 *
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
33namespace WebCore {
34
35class PlatformTouchEvent;
36
37class ScrollAnimatorIOS : public ScrollAnimator {
38public:
bfulgham@apple.com3cb8c992015-02-21 03:34:09 +000039 ScrollAnimatorIOS(ScrollableArea&);
dbates@webkit.orgb8ade582014-01-09 22:59:07 +000040 virtual ~ScrollAnimatorIOS();
41
42#if ENABLE(TOUCH_EVENTS)
darin@apple.com11ff47c2016-03-04 16:47:55 +000043 bool handleTouchEvent(const PlatformTouchEvent&) override;
dbates@webkit.orgb8ade582014-01-09 22:59:07 +000044#endif
45
46private:
dbates@webkit.org348e5aa2014-09-04 15:42:54 +000047#if ENABLE(TOUCH_EVENTS)
dbates@webkit.orgb8ade582014-01-09 22:59:07 +000048 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.org348e5aa2014-09-04 15:42:54 +000067#endif
dbates@webkit.orgb8ade582014-01-09 22:59:07 +000068};
69
70} // namespace WebCore
71
72#endif // ScrollAnimatorIOS_h