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

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

Issue 2586133003: Remove PlatformWheelEvent and use WebMouseWheelEvent instead (Closed)
Patch Set: Rebase Created 4 years 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) 37 #if OS(MACOSX)
39 enum WheelEventPhase { 38 enum WheelEventPhase {
majidvp 2016/12/20 17:30:14 Can we get rid of this now?
dtapuska 2017/01/03 20:19:14 Done.
40 WheelEventPhaseNone = 0, 39 WheelEventPhaseNone = 0,
41 WheelEventPhaseBegan = 1 << 0, 40 WheelEventPhaseBegan = 1 << 0,
42 WheelEventPhaseStationary = 1 << 1, 41 WheelEventPhaseStationary = 1 << 1,
43 WheelEventPhaseChanged = 1 << 2, 42 WheelEventPhaseChanged = 1 << 2,
44 WheelEventPhaseEnded = 1 << 3, 43 WheelEventPhaseEnded = 1 << 3,
45 WheelEventPhaseCancelled = 1 << 4, 44 WheelEventPhaseCancelled = 1 << 4,
46 WheelEventPhaseMayBegin = 1 << 5, 45 WheelEventPhaseMayBegin = 1 << 5,
47 }; 46 };
48 #endif 47 #endif
49 48
50 class CORE_EXPORT WheelEvent final : public MouseEvent { 49 class CORE_EXPORT WheelEvent final : public MouseEvent {
51 DEFINE_WRAPPERTYPEINFO(); 50 DEFINE_WRAPPERTYPEINFO();
52 51
53 public: 52 public:
54 enum { TickMultiplier = 120 }; 53 enum { TickMultiplier = 120 };
55 54
56 enum DeltaMode { kDomDeltaPixel = 0, kDomDeltaLine, kDomDeltaPage }; 55 enum DeltaMode { kDomDeltaPixel = 0, kDomDeltaLine, kDomDeltaPage };
57 56
58 static WheelEvent* create() { return new WheelEvent; } 57 static WheelEvent* create() { return new WheelEvent; }
59 58
60 static WheelEvent* create(const PlatformWheelEvent& platformEvent, 59 static WheelEvent* create(const WebMouseWheelEvent& platformEvent,
majidvp 2016/12/20 17:30:14 nit: s/platformEvent/nativeEvent/
dtapuska 2017/01/03 20:19:14 Done.
61 AbstractView*); 60 AbstractView*);
62 61
63 static WheelEvent* create(const AtomicString& type, 62 static WheelEvent* create(const AtomicString& type,
64 const WheelEventInit& initializer) { 63 const WheelEventInit& initializer) {
65 return new WheelEvent(type, initializer); 64 return new WheelEvent(type, initializer);
66 } 65 }
67 66
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. 67 double deltaX() const { return m_deltaX; } // Positive when scrolling right.
99 double deltaY() const { return m_deltaY; } // Positive when scrolling down. 68 double deltaY() const { return m_deltaY; } // Positive when scrolling down.
100 double deltaZ() const { return m_deltaZ; } 69 double deltaZ() const { return m_deltaZ; }
101 int wheelDelta() const { 70 int wheelDelta() const {
102 return wheelDeltaY() ? wheelDeltaY() : wheelDeltaX(); 71 return wheelDeltaY() ? wheelDeltaY() : wheelDeltaX();
103 } // Deprecated. 72 } // Deprecated.
104 int wheelDeltaX() const { 73 int wheelDeltaX() const {
105 return m_wheelDelta.x(); 74 return m_wheelDelta.x();
106 } // Deprecated, negative when scrolling right. 75 } // Deprecated, negative when scrolling right.
107 int wheelDeltaY() const { 76 int wheelDeltaY() const {
108 return m_wheelDelta.y(); 77 return m_wheelDelta.y();
109 } // Deprecated, negative when scrolling down. 78 } // Deprecated, negative when scrolling down.
110 unsigned deltaMode() const { return m_deltaMode; } 79 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 80
121 const AtomicString& interfaceName() const override; 81 const AtomicString& interfaceName() const override;
122 bool isMouseEvent() const override; 82 bool isMouseEvent() const override;
123 bool isWheelEvent() const override; 83 bool isWheelEvent() const override;
124 84
125 EventDispatchMediator* createMediator() override; 85 EventDispatchMediator* createMediator() override;
126 86
127 #if OS(MACOSX) 87 const WebMouseWheelEvent& nativeEvent() const { return m_nativeEvent; }
128 WheelEventPhase phase() const { return m_phase; }
129 WheelEventPhase momentumPhase() const { return m_momentumPhase; }
130 #endif
131 88
132 DECLARE_VIRTUAL_TRACE(); 89 DECLARE_VIRTUAL_TRACE();
133 90
134 private: 91 private:
135 WheelEvent(); 92 WheelEvent();
136 WheelEvent(const AtomicString&, const WheelEventInit&); 93 WheelEvent(const AtomicString&, const WheelEventInit&);
137 WheelEvent(const FloatPoint& wheelTicks, 94 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 95
168 IntPoint m_wheelDelta; 96 IntPoint m_wheelDelta;
169 double m_deltaX; 97 double m_deltaX;
170 double m_deltaY; 98 double m_deltaY;
171 double m_deltaZ; 99 double m_deltaZ;
172 unsigned m_deltaMode; 100 unsigned m_deltaMode;
173 int m_resendingPluginId; 101 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 }; 102 };
181 103
182 DEFINE_EVENT_TYPE_CASTS(WheelEvent); 104 DEFINE_EVENT_TYPE_CASTS(WheelEvent);
183 105
184 } // namespace blink 106 } // namespace blink
185 107
186 #endif // WheelEvent_h 108 #endif // WheelEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698