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

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

Issue 2227803003: Plumb phase/momentum for WheelEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Non-Mac compile. Created 4 years, 4 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 reserv ed. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 6 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 16 matching lines...) Expand all
27 27
28 #include "core/CoreExport.h" 28 #include "core/CoreExport.h"
29 #include "core/events/MouseEvent.h" 29 #include "core/events/MouseEvent.h"
30 #include "core/events/WheelEventInit.h" 30 #include "core/events/WheelEventInit.h"
31 #include "platform/geometry/FloatPoint.h" 31 #include "platform/geometry/FloatPoint.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 class PlatformWheelEvent; 35 class PlatformWheelEvent;
36 36
37 #if OS(MACOSX)
38 enum WheelEventPhase {
39 WheelEventPhaseNone = 0,
40 WheelEventPhaseBegan = 1 << 0,
41 WheelEventPhaseStationary = 1 << 1,
42 WheelEventPhaseChanged = 1 << 2,
43 WheelEventPhaseEnded = 1 << 3,
44 WheelEventPhaseCancelled = 1 << 4,
45 WheelEventPhaseMayBegin = 1 << 5,
46 };
47 #endif
48
37 class CORE_EXPORT WheelEvent final : public MouseEvent { 49 class CORE_EXPORT WheelEvent final : public MouseEvent {
38 DEFINE_WRAPPERTYPEINFO(); 50 DEFINE_WRAPPERTYPEINFO();
39 public: 51 public:
40 enum { TickMultiplier = 120 }; 52 enum { TickMultiplier = 120 };
41 53
42 enum DeltaMode { 54 enum DeltaMode {
43 kDomDeltaPixel = 0, 55 kDomDeltaPixel = 0,
44 kDomDeltaLine, 56 kDomDeltaLine,
45 kDomDeltaPage 57 kDomDeltaPage
46 }; 58 };
47 59
48 static WheelEvent* create() 60 static WheelEvent* create()
49 { 61 {
50 return new WheelEvent; 62 return new WheelEvent;
51 } 63 }
52 64
53 static WheelEvent* create(const PlatformWheelEvent& platformEvent, AbstractV iew*); 65 static WheelEvent* create(const PlatformWheelEvent& platformEvent, AbstractV iew*);
54 66
55 static WheelEvent* create(const AtomicString& type, const WheelEventInit& in itializer) 67 static WheelEvent* create(const AtomicString& type, const WheelEventInit& in itializer)
56 { 68 {
57 return new WheelEvent(type, initializer); 69 return new WheelEvent(type, initializer);
58 } 70 }
59 71
60 static WheelEvent* create(const FloatPoint& wheelTicks, 72 static WheelEvent* create(const FloatPoint& wheelTicks,
61 const FloatPoint& rawDelta, unsigned deltaMode, AbstractView* view, 73 const FloatPoint& rawDelta, unsigned deltaMode, AbstractView* view,
62 const IntPoint& screenLocation, const IntPoint& windowLocation, 74 const IntPoint& screenLocation, const IntPoint& windowLocation,
63 PlatformEvent::Modifiers modifiers, unsigned short buttons, double platf ormTimeStamp, 75 PlatformEvent::Modifiers modifiers, unsigned short buttons, double platf ormTimeStamp,
64 int resendingPluginId, bool hasPreciseScrollingDeltas, RailsMode railsMo de, bool cancelable) 76 int resendingPluginId, bool hasPreciseScrollingDeltas, RailsMode railsMo de, bool cancelable
77 #if OS(MACOSX)
78 , WheelEventPhase phase, WheelEventPhase momentumPhase
79 #endif
80 )
65 { 81 {
66 return new WheelEvent(wheelTicks, rawDelta, deltaMode, view, 82 return new WheelEvent(wheelTicks, rawDelta, deltaMode, view,
67 screenLocation, windowLocation, modifiers, buttons, platformTimeStam p, 83 screenLocation, windowLocation, modifiers, buttons, platformTimeStam p,
68 resendingPluginId, hasPreciseScrollingDeltas, railsMode, cancelable) ; 84 resendingPluginId, hasPreciseScrollingDeltas, railsMode, cancelable
85 #if OS(MACOSX)
86 , phase, momentumPhase
87 #endif
88 );
69 } 89 }
70 90
71 double deltaX() const { return m_deltaX; } // Positive when scrolling right. 91 double deltaX() const { return m_deltaX; } // Positive when scrolling right.
72 double deltaY() const { return m_deltaY; } // Positive when scrolling down. 92 double deltaY() const { return m_deltaY; } // Positive when scrolling down.
73 double deltaZ() const { return m_deltaZ; } 93 double deltaZ() const { return m_deltaZ; }
74 int wheelDelta() const { return wheelDeltaY() ? wheelDeltaY() : wheelDeltaX( ); } // Deprecated. 94 int wheelDelta() const { return wheelDeltaY() ? wheelDeltaY() : wheelDeltaX( ); } // Deprecated.
75 int wheelDeltaX() const { return m_wheelDelta.x(); } // Deprecated, negative when scrolling right. 95 int wheelDeltaX() const { return m_wheelDelta.x(); } // Deprecated, negative when scrolling right.
76 int wheelDeltaY() const { return m_wheelDelta.y(); } // Deprecated, negative when scrolling down. 96 int wheelDeltaY() const { return m_wheelDelta.y(); } // Deprecated, negative when scrolling down.
77 unsigned deltaMode() const { return m_deltaMode; } 97 unsigned deltaMode() const { return m_deltaMode; }
78 float ticksX() const { return static_cast<float>(m_wheelDelta.x()) / TickMul tiplier; } 98 float ticksX() const { return static_cast<float>(m_wheelDelta.x()) / TickMul tiplier; }
79 float ticksY() const { return static_cast<float>(m_wheelDelta.y()) / TickMul tiplier; } 99 float ticksY() const { return static_cast<float>(m_wheelDelta.y()) / TickMul tiplier; }
80 int resendingPluginId() const { return m_resendingPluginId; } 100 int resendingPluginId() const { return m_resendingPluginId; }
81 bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; } 101 bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
82 RailsMode getRailsMode() const { return m_railsMode; } 102 RailsMode getRailsMode() const { return m_railsMode; }
83 103
84 const AtomicString& interfaceName() const override; 104 const AtomicString& interfaceName() const override;
85 bool isMouseEvent() const override; 105 bool isMouseEvent() const override;
86 bool isWheelEvent() const override; 106 bool isWheelEvent() const override;
87 107
88 EventDispatchMediator* createMediator() override; 108 EventDispatchMediator* createMediator() override;
89 109
110 #if OS(MACOSX)
111 WheelEventPhase phase() const { return m_phase; }
112 WheelEventPhase momentumPhase() const { return m_momentumPhase; }
113 #endif
114
90 DECLARE_VIRTUAL_TRACE(); 115 DECLARE_VIRTUAL_TRACE();
91 116
92 private: 117 private:
93 WheelEvent(); 118 WheelEvent();
94 WheelEvent(const AtomicString&, const WheelEventInit&); 119 WheelEvent(const AtomicString&, const WheelEventInit&);
95 WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, 120 WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
96 unsigned, AbstractView*, const IntPoint& screenLocation, const IntPoint& windowLocation, 121 unsigned, AbstractView*, const IntPoint& screenLocation, const IntPoint& windowLocation,
97 PlatformEvent::Modifiers, unsigned short buttons, double platformTimeSta mp, 122 PlatformEvent::Modifiers, unsigned short buttons, double platformTimeSta mp,
98 int resendingPluginId, bool hasPreciseScrollingDeltas, RailsMode, bool c ancelable); 123 int resendingPluginId, bool hasPreciseScrollingDeltas, RailsMode, bool c ancelable);
124 #if OS(MACOSX)
125 WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
126 unsigned, AbstractView*, const IntPoint& screenLocation, const IntPoint& windowLocation,
127 PlatformEvent::Modifiers, unsigned short buttons, double platformTimeSta mp,
128 int resendingPluginId, bool hasPreciseScrollingDeltas, RailsMode, bool c ancelable,
129 WheelEventPhase phase, WheelEventPhase momentumPhase
130 );
131 #endif
99 132
100 IntPoint m_wheelDelta; 133 IntPoint m_wheelDelta;
101 double m_deltaX; 134 double m_deltaX;
102 double m_deltaY; 135 double m_deltaY;
103 double m_deltaZ; 136 double m_deltaZ;
104 unsigned m_deltaMode; 137 unsigned m_deltaMode;
105 int m_resendingPluginId; 138 int m_resendingPluginId;
106 bool m_hasPreciseScrollingDeltas; 139 bool m_hasPreciseScrollingDeltas;
107 RailsMode m_railsMode; 140 RailsMode m_railsMode;
141 #if OS(MACOSX)
142 WheelEventPhase m_phase;
143 WheelEventPhase m_momentumPhase;
144 #endif
108 }; 145 };
109 146
110 DEFINE_EVENT_TYPE_CASTS(WheelEvent); 147 DEFINE_EVENT_TYPE_CASTS(WheelEvent);
111 148
112 } // namespace blink 149 } // namespace blink
113 150
114 #endif // WheelEvent_h 151 #endif // WheelEvent_h
OLDNEW
« no previous file with comments | « content/public/browser/render_widget_host_view_mac_delegate.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