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

Side by Side Diff: third_party/WebKit/Source/core/events/WheelEvent.h

Issue 2586133003: Remove PlatformWheelEvent and use WebMouseWheelEvent instead (Closed)
Patch Set: Adjust function name Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010 Apple Inc. All rights 5 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 7 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 12 matching lines...) Expand all
23 * 23 *
24 */ 24 */
25 25
26 #ifndef WheelEvent_h 26 #ifndef WheelEvent_h
27 #define WheelEvent_h 27 #define WheelEvent_h
28 28
29 #include "core/CoreExport.h" 29 #include "core/CoreExport.h"
30 #include "core/events/MouseEvent.h" 30 #include "core/events/MouseEvent.h"
31 #include "core/events/WheelEventInit.h" 31 #include "core/events/WheelEventInit.h"
32 #include "platform/geometry/FloatPoint.h" 32 #include "platform/geometry/FloatPoint.h"
33 #include "public/platform/WebMouseWheelEvent.h"
33 34
34 namespace blink { 35 namespace blink {
35 36
36 class PlatformWheelEvent;
37
38 #if OS(MACOSX)
39 enum WheelEventPhase {
40 WheelEventPhaseNone = 0,
41 WheelEventPhaseBegan = 1 << 0,
42 WheelEventPhaseStationary = 1 << 1,
43 WheelEventPhaseChanged = 1 << 2,
44 WheelEventPhaseEnded = 1 << 3,
45 WheelEventPhaseCancelled = 1 << 4,
46 WheelEventPhaseMayBegin = 1 << 5,
47 };
48 #endif
49
50 class CORE_EXPORT WheelEvent final : public MouseEvent { 37 class CORE_EXPORT WheelEvent final : public MouseEvent {
51 DEFINE_WRAPPERTYPEINFO(); 38 DEFINE_WRAPPERTYPEINFO();
52 39
53 public: 40 public:
54 enum { TickMultiplier = 120 }; 41 enum { TickMultiplier = 120 };
55 42
56 enum DeltaMode { kDomDeltaPixel = 0, kDomDeltaLine, kDomDeltaPage }; 43 enum DeltaMode { kDomDeltaPixel = 0, kDomDeltaLine, kDomDeltaPage };
57 44
58 static WheelEvent* create() { return new WheelEvent; } 45 static WheelEvent* create() { return new WheelEvent; }
59 46
60 static WheelEvent* create(const PlatformWheelEvent& platformEvent, 47 static WheelEvent* create(const WebMouseWheelEvent& nativeEvent,
61 AbstractView*); 48 AbstractView*);
62 49
63 static WheelEvent* create(const AtomicString& type, 50 static WheelEvent* create(const AtomicString& type,
64 const WheelEventInit& initializer) { 51 const WheelEventInit& initializer) {
65 return new WheelEvent(type, initializer); 52 return new WheelEvent(type, initializer);
66 } 53 }
67 54
68 static WheelEvent* create(const FloatPoint& wheelTicks,
69 const FloatPoint& rawDelta,
70 unsigned deltaMode,
71 AbstractView* view,
72 const IntPoint& screenLocation,
73 const IntPoint& windowLocation,
74 PlatformEvent::Modifiers modifiers,
75 unsigned short buttons,
76 TimeTicks platformTimeStamp,
77 int resendingPluginId,
78 bool hasPreciseScrollingDeltas,
79 RailsMode railsMode,
80 bool cancelable
81 #if OS(MACOSX)
82 ,
83 WheelEventPhase phase,
84 WheelEventPhase momentumPhase
85 #endif
86 ) {
87 return new WheelEvent(wheelTicks, rawDelta, deltaMode, view, screenLocation,
88 windowLocation, modifiers, buttons, platformTimeStamp,
89 resendingPluginId, hasPreciseScrollingDeltas,
90 railsMode, cancelable
91 #if OS(MACOSX)
92 ,
93 phase, momentumPhase
94 #endif
95 );
96 }
97
98 double deltaX() const { return m_deltaX; } // Positive when scrolling right. 55 double deltaX() const { return m_deltaX; } // Positive when scrolling right.
99 double deltaY() const { return m_deltaY; } // Positive when scrolling down. 56 double deltaY() const { return m_deltaY; } // Positive when scrolling down.
100 double deltaZ() const { return m_deltaZ; } 57 double deltaZ() const { return m_deltaZ; }
101 int wheelDelta() const { 58 int wheelDelta() const {
102 return wheelDeltaY() ? wheelDeltaY() : wheelDeltaX(); 59 return wheelDeltaY() ? wheelDeltaY() : wheelDeltaX();
103 } // Deprecated. 60 } // Deprecated.
104 int wheelDeltaX() const { 61 int wheelDeltaX() const {
105 return m_wheelDelta.x(); 62 return m_wheelDelta.x();
106 } // Deprecated, negative when scrolling right. 63 } // Deprecated, negative when scrolling right.
107 int wheelDeltaY() const { 64 int wheelDeltaY() const {
108 return m_wheelDelta.y(); 65 return m_wheelDelta.y();
109 } // Deprecated, negative when scrolling down. 66 } // Deprecated, negative when scrolling down.
110 unsigned deltaMode() const { return m_deltaMode; } 67 unsigned deltaMode() const { return m_deltaMode; }
111 float ticksX() const {
112 return static_cast<float>(m_wheelDelta.x()) / TickMultiplier;
113 }
114 float ticksY() const {
115 return static_cast<float>(m_wheelDelta.y()) / TickMultiplier;
116 }
117 int resendingPluginId() const { return m_resendingPluginId; }
118 bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
119 RailsMode getRailsMode() const { return m_railsMode; }
120 68
121 const AtomicString& interfaceName() const override; 69 const AtomicString& interfaceName() const override;
122 bool isMouseEvent() const override; 70 bool isMouseEvent() const override;
123 bool isWheelEvent() const override; 71 bool isWheelEvent() const override;
124 72
125 EventDispatchMediator* createMediator() override; 73 EventDispatchMediator* createMediator() override;
126 74
127 #if OS(MACOSX) 75 const WebMouseWheelEvent& nativeEvent() const { return m_nativeEvent; }
128 WheelEventPhase phase() const { return m_phase; }
129 WheelEventPhase momentumPhase() const { return m_momentumPhase; }
130 #endif
131 76
132 DECLARE_VIRTUAL_TRACE(); 77 DECLARE_VIRTUAL_TRACE();
133 78
134 private: 79 private:
135 WheelEvent(); 80 WheelEvent();
136 WheelEvent(const AtomicString&, const WheelEventInit&); 81 WheelEvent(const AtomicString&, const WheelEventInit&);
137 WheelEvent(const FloatPoint& wheelTicks, 82 WheelEvent(const WebMouseWheelEvent&, AbstractView*);
138 const FloatPoint& rawDelta,
139 unsigned,
140 AbstractView*,
141 const IntPoint& screenLocation,
142 const IntPoint& windowLocation,
143 PlatformEvent::Modifiers,
144 unsigned short buttons,
145 TimeTicks platformTimeStamp,
146 int resendingPluginId,
147 bool hasPreciseScrollingDeltas,
148 RailsMode,
149 bool cancelable);
150 #if OS(MACOSX)
151 WheelEvent(const FloatPoint& wheelTicks,
152 const FloatPoint& rawDelta,
153 unsigned,
154 AbstractView*,
155 const IntPoint& screenLocation,
156 const IntPoint& windowLocation,
157 PlatformEvent::Modifiers,
158 unsigned short buttons,
159 TimeTicks platformTimeStamp,
160 int resendingPluginId,
161 bool hasPreciseScrollingDeltas,
162 RailsMode,
163 bool cancelable,
164 WheelEventPhase phase,
165 WheelEventPhase momentumPhase);
166 #endif
167 83
168 IntPoint m_wheelDelta; 84 IntPoint m_wheelDelta;
169 double m_deltaX; 85 double m_deltaX;
170 double m_deltaY; 86 double m_deltaY;
171 double m_deltaZ; 87 double m_deltaZ;
172 unsigned m_deltaMode; 88 unsigned m_deltaMode;
173 int m_resendingPluginId; 89 WebMouseWheelEvent m_nativeEvent;
174 bool m_hasPreciseScrollingDeltas;
175 RailsMode m_railsMode;
176 #if OS(MACOSX)
177 WheelEventPhase m_phase;
178 WheelEventPhase m_momentumPhase;
179 #endif
180 }; 90 };
181 91
182 DEFINE_EVENT_TYPE_CASTS(WheelEvent); 92 DEFINE_EVENT_TYPE_CASTS(WheelEvent);
183 93
184 } // namespace blink 94 } // namespace blink
185 95
186 #endif // WheelEvent_h 96 #endif // WheelEvent_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/UIEventWithKeyState.h ('k') | third_party/WebKit/Source/core/events/WheelEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698