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

Side by Side Diff: third_party/WebKit/Source/platform/PlatformWheelEvent.h

Issue 2377703002: Made PlatformWheelEvent a subclass of PlatformMouseEvent. (Closed)
Patch Set: Created 4 years, 2 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 | « third_party/WebKit/Source/platform/PlatformMouseEvent.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef PlatformWheelEvent_h 26 #ifndef PlatformWheelEvent_h
27 #define PlatformWheelEvent_h 27 #define PlatformWheelEvent_h
28 28
29 #include "platform/PlatformEvent.h" 29 #include "platform/PlatformEvent.h"
30 #include "platform/PlatformMouseEvent.h"
30 #include "platform/geometry/IntPoint.h" 31 #include "platform/geometry/IntPoint.h"
31 32
32 namespace blink { 33 namespace blink {
33 34
34 // Wheel events come in two flavors: 35 // Wheel events come in two flavors:
35 // The ScrollByPixelWheelEvent is a fine-grained event that specifies the precis e number of pixels to scroll. It is sent directly by MacBook touchpads on OS X, 36 // The ScrollByPixelWheelEvent is a fine-grained event that specifies the precis e number of pixels to scroll. It is sent directly by MacBook touchpads on OS X,
36 // and synthesized in other cases where platforms generate line-by-line scrollin g events. 37 // and synthesized in other cases where platforms generate line-by-line scrollin g events.
37 // The ScrollByPageWheelEvent indicates that the wheel event should scroll an en tire page. In this case WebCore's built in paging behavior is used to page 38 // The ScrollByPageWheelEvent indicates that the wheel event should scroll an en tire page. In this case WebCore's built in paging behavior is used to page
38 // up and down (you get the same behavior as if the user was clicking in a scrol lbar track to page up or page down). 39 // up and down (you get the same behavior as if the user was clicking in a scrol lbar track to page up or page down).
39 enum PlatformWheelEventGranularity { 40 enum PlatformWheelEventGranularity {
40 ScrollByPageWheelEvent, 41 ScrollByPageWheelEvent,
41 ScrollByPixelWheelEvent, 42 ScrollByPixelWheelEvent,
42 }; 43 };
43 44
44 #if OS(MACOSX) 45 #if OS(MACOSX)
45 enum PlatformWheelEventPhase { 46 enum PlatformWheelEventPhase {
46 PlatformWheelEventPhaseNone = 0, 47 PlatformWheelEventPhaseNone = 0,
47 PlatformWheelEventPhaseBegan = 1 << 0, 48 PlatformWheelEventPhaseBegan = 1 << 0,
48 PlatformWheelEventPhaseStationary = 1 << 1, 49 PlatformWheelEventPhaseStationary = 1 << 1,
49 PlatformWheelEventPhaseChanged = 1 << 2, 50 PlatformWheelEventPhaseChanged = 1 << 2,
50 PlatformWheelEventPhaseEnded = 1 << 3, 51 PlatformWheelEventPhaseEnded = 1 << 3,
51 PlatformWheelEventPhaseCancelled = 1 << 4, 52 PlatformWheelEventPhaseCancelled = 1 << 4,
52 PlatformWheelEventPhaseMayBegin = 1 << 5, 53 PlatformWheelEventPhaseMayBegin = 1 << 5,
53 }; 54 };
54 #endif 55 #endif
55 56
56 class PlatformWheelEvent : public PlatformEvent { 57 class PlatformWheelEvent : public PlatformMouseEvent {
57 public: 58 public:
58 PlatformWheelEvent() 59 PlatformWheelEvent()
59 : PlatformEvent(PlatformEvent::Wheel) 60 : PlatformMouseEvent(PlatformEvent::Wheel)
60 , m_deltaX(0) 61 , m_deltaX(0)
61 , m_deltaY(0) 62 , m_deltaY(0)
62 , m_wheelTicksX(0) 63 , m_wheelTicksX(0)
63 , m_wheelTicksY(0) 64 , m_wheelTicksY(0)
64 , m_granularity(ScrollByPixelWheelEvent) 65 , m_granularity(ScrollByPixelWheelEvent)
65 , m_hasPreciseScrollingDeltas(false) 66 , m_hasPreciseScrollingDeltas(false)
66 , m_resendingPluginId(-1) 67 , m_resendingPluginId(-1)
67 , m_railsMode(RailsModeFree) 68 , m_railsMode(RailsModeFree)
68 , m_dispatchType(Blocking) 69 , m_dispatchType(Blocking)
69 #if OS(MACOSX) 70 #if OS(MACOSX)
70 , m_phase(PlatformWheelEventPhaseNone) 71 , m_phase(PlatformWheelEventPhaseNone)
71 , m_momentumPhase(PlatformWheelEventPhaseNone) 72 , m_momentumPhase(PlatformWheelEventPhaseNone)
72 #endif 73 #endif
73 { 74 {
74 } 75 }
75 76
76 const IntPoint& position() const { return m_position; } // PlatformWindow co ordinates.
77 const IntPoint& globalPosition() const { return m_globalPosition; } // Scree n coordinates.
78
79 float deltaX() const { return m_deltaX; } 77 float deltaX() const { return m_deltaX; }
80 float deltaY() const { return m_deltaY; } 78 float deltaY() const { return m_deltaY; }
81 79
82 float wheelTicksX() const { return m_wheelTicksX; } 80 float wheelTicksX() const { return m_wheelTicksX; }
83 float wheelTicksY() const { return m_wheelTicksY; } 81 float wheelTicksY() const { return m_wheelTicksY; }
84 82
85 PlatformWheelEventGranularity granularity() const { return m_granularity; } 83 PlatformWheelEventGranularity granularity() const { return m_granularity; }
86 84
87 bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; } 85 bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
88 void setHasPreciseScrollingDeltas(bool b) { m_hasPreciseScrollingDeltas = b; } 86 void setHasPreciseScrollingDeltas(bool b) { m_hasPreciseScrollingDeltas = b; }
89 int resendingPluginId() const { return m_resendingPluginId; } 87 int resendingPluginId() const { return m_resendingPluginId; }
90 RailsMode getRailsMode() const { return m_railsMode; } 88 RailsMode getRailsMode() const { return m_railsMode; }
91 DispatchType dispatchType() const { return m_dispatchType; } 89 DispatchType dispatchType() const { return m_dispatchType; }
92 bool cancelable() const { return m_dispatchType == PlatformEvent::Blocking; } 90 bool cancelable() const { return m_dispatchType == PlatformEvent::Blocking; }
93 #if OS(MACOSX) 91 #if OS(MACOSX)
94 PlatformWheelEventPhase phase() const { return m_phase; } 92 PlatformWheelEventPhase phase() const { return m_phase; }
95 PlatformWheelEventPhase momentumPhase() const { return m_momentumPhase; } 93 PlatformWheelEventPhase momentumPhase() const { return m_momentumPhase; }
96 #endif 94 #endif
97 95
98 protected: 96 protected:
99 IntPoint m_position;
100 IntPoint m_globalPosition;
101 float m_deltaX; 97 float m_deltaX;
102 float m_deltaY; 98 float m_deltaY;
103 float m_wheelTicksX; 99 float m_wheelTicksX;
104 float m_wheelTicksY; 100 float m_wheelTicksY;
105 PlatformWheelEventGranularity m_granularity; 101 PlatformWheelEventGranularity m_granularity;
106 bool m_hasPreciseScrollingDeltas; 102 bool m_hasPreciseScrollingDeltas;
107 int m_resendingPluginId; 103 int m_resendingPluginId;
108 RailsMode m_railsMode; 104 RailsMode m_railsMode;
109 DispatchType m_dispatchType; 105 DispatchType m_dispatchType;
110 #if OS(MACOSX) 106 #if OS(MACOSX)
111 PlatformWheelEventPhase m_phase; 107 PlatformWheelEventPhase m_phase;
112 PlatformWheelEventPhase m_momentumPhase; 108 PlatformWheelEventPhase m_momentumPhase;
113 #endif 109 #endif
114 }; 110 };
115 111
116 } // namespace blink 112 } // namespace blink
117 113
118 #endif // PlatformWheelEvent_h 114 #endif // PlatformWheelEvent_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/PlatformMouseEvent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698