| OLD | NEW |
| 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 Loading... |
| 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 // Note: do to the use of static_casts to convert this type to |
| 39 // WebMouseWheelEvent::Phase, and PlatformWheelEventPhase to WheelEventPhase, |
| 40 // the definition that follows must be kept in sync with that used for the |
| 41 // corresponding types. |
| 42 enum WheelEventPhase { |
| 43 WheelEventPhaseNone = 0, |
| 44 WheelEventPhaseBegan = 1 << 0, |
| 45 WheelEventPhaseStationary = 1 << 1, |
| 46 WheelEventPhaseChanged = 1 << 2, |
| 47 WheelEventPhaseEnded = 1 << 3, |
| 48 WheelEventPhaseCancelled = 1 << 4, |
| 49 WheelEventPhaseMayBegin = 1 << 5, |
| 50 }; |
| 51 #endif |
| 52 |
| 37 class CORE_EXPORT WheelEvent final : public MouseEvent { | 53 class CORE_EXPORT WheelEvent final : public MouseEvent { |
| 38 DEFINE_WRAPPERTYPEINFO(); | 54 DEFINE_WRAPPERTYPEINFO(); |
| 39 public: | 55 public: |
| 40 enum { TickMultiplier = 120 }; | 56 enum { TickMultiplier = 120 }; |
| 41 | 57 |
| 42 enum DeltaMode { | 58 enum DeltaMode { |
| 43 kDomDeltaPixel = 0, | 59 kDomDeltaPixel = 0, |
| 44 kDomDeltaLine, | 60 kDomDeltaLine, |
| 45 kDomDeltaPage | 61 kDomDeltaPage |
| 46 }; | 62 }; |
| 47 | 63 |
| 48 static WheelEvent* create() | 64 static WheelEvent* create() |
| 49 { | 65 { |
| 50 return new WheelEvent; | 66 return new WheelEvent; |
| 51 } | 67 } |
| 52 | 68 |
| 53 static WheelEvent* create(const PlatformWheelEvent& platformEvent, AbstractV
iew*); | 69 static WheelEvent* create(const PlatformWheelEvent& platformEvent, AbstractV
iew*); |
| 54 | 70 |
| 55 static WheelEvent* create(const AtomicString& type, const WheelEventInit& in
itializer) | 71 static WheelEvent* create(const AtomicString& type, const WheelEventInit& in
itializer) |
| 56 { | 72 { |
| 57 return new WheelEvent(type, initializer); | 73 return new WheelEvent(type, initializer); |
| 58 } | 74 } |
| 59 | 75 |
| 60 static WheelEvent* create(const FloatPoint& wheelTicks, | 76 static WheelEvent* create(const FloatPoint& wheelTicks, |
| 61 const FloatPoint& rawDelta, unsigned deltaMode, AbstractView* view, | 77 const FloatPoint& rawDelta, unsigned deltaMode, AbstractView* view, |
| 62 const IntPoint& screenLocation, const IntPoint& windowLocation, | 78 const IntPoint& screenLocation, const IntPoint& windowLocation, |
| 63 PlatformEvent::Modifiers modifiers, unsigned short buttons, double platf
ormTimeStamp, | 79 PlatformEvent::Modifiers modifiers, unsigned short buttons, double platf
ormTimeStamp, |
| 64 int resendingPluginId, bool hasPreciseScrollingDeltas, RailsMode railsMo
de, bool cancelable) | 80 int resendingPluginId, bool hasPreciseScrollingDeltas, RailsMode railsMo
de, bool cancelable |
| 81 #if OS(MACOSX) |
| 82 , WheelEventPhase phase, WheelEventPhase momentumPhase, bool canRubberba
ndLeft, bool canRubberbandRight |
| 83 #endif |
| 84 ) |
| 65 { | 85 { |
| 66 return new WheelEvent(wheelTicks, rawDelta, deltaMode, view, | 86 return new WheelEvent(wheelTicks, rawDelta, deltaMode, view, |
| 67 screenLocation, windowLocation, modifiers, buttons, platformTimeStam
p, | 87 screenLocation, windowLocation, modifiers, buttons, platformTimeStam
p, |
| 68 resendingPluginId, hasPreciseScrollingDeltas, railsMode, cancelable)
; | 88 resendingPluginId, hasPreciseScrollingDeltas, railsMode, cancelable |
| 89 #if OS(MACOSX) |
| 90 , phase, momentumPhase, canRubberbandLeft, canRubberbandRight |
| 91 #endif |
| 92 ); |
| 69 } | 93 } |
| 70 | 94 |
| 71 double deltaX() const { return m_deltaX; } // Positive when scrolling right. | 95 double deltaX() const { return m_deltaX; } // Positive when scrolling right. |
| 72 double deltaY() const { return m_deltaY; } // Positive when scrolling down. | 96 double deltaY() const { return m_deltaY; } // Positive when scrolling down. |
| 73 double deltaZ() const { return m_deltaZ; } | 97 double deltaZ() const { return m_deltaZ; } |
| 74 int wheelDelta() const { return wheelDeltaY() ? wheelDeltaY() : wheelDeltaX(
); } // Deprecated. | 98 int wheelDelta() const { return wheelDeltaY() ? wheelDeltaY() : wheelDeltaX(
); } // Deprecated. |
| 75 int wheelDeltaX() const { return m_wheelDelta.x(); } // Deprecated, negative
when scrolling right. | 99 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. | 100 int wheelDeltaY() const { return m_wheelDelta.y(); } // Deprecated, negative
when scrolling down. |
| 77 unsigned deltaMode() const { return m_deltaMode; } | 101 unsigned deltaMode() const { return m_deltaMode; } |
| 78 float ticksX() const { return static_cast<float>(m_wheelDelta.x()) / TickMul
tiplier; } | 102 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; } | 103 float ticksY() const { return static_cast<float>(m_wheelDelta.y()) / TickMul
tiplier; } |
| 80 int resendingPluginId() const { return m_resendingPluginId; } | 104 int resendingPluginId() const { return m_resendingPluginId; } |
| 81 bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas;
} | 105 bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas;
} |
| 82 RailsMode getRailsMode() const { return m_railsMode; } | 106 RailsMode getRailsMode() const { return m_railsMode; } |
| 83 | 107 |
| 84 const AtomicString& interfaceName() const override; | 108 const AtomicString& interfaceName() const override; |
| 85 bool isMouseEvent() const override; | 109 bool isMouseEvent() const override; |
| 86 bool isWheelEvent() const override; | 110 bool isWheelEvent() const override; |
| 87 | 111 |
| 88 EventDispatchMediator* createMediator() override; | 112 EventDispatchMediator* createMediator() override; |
| 89 | 113 |
| 114 #if OS(MACOSX) |
| 115 WheelEventPhase phase() const { return m_phase; } |
| 116 WheelEventPhase momentumPhase() const { return m_momentumPhase; } |
| 117 bool canRubberbandLeft() const { return m_canRubberbandLeft; } |
| 118 bool canRubberbandRight() const { return m_canRubberbandRight; } |
| 119 #endif |
| 120 |
| 90 DECLARE_VIRTUAL_TRACE(); | 121 DECLARE_VIRTUAL_TRACE(); |
| 91 | 122 |
| 92 private: | 123 private: |
| 93 WheelEvent(); | 124 WheelEvent(); |
| 94 WheelEvent(const AtomicString&, const WheelEventInit&); | 125 WheelEvent(const AtomicString&, const WheelEventInit&); |
| 95 WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, | 126 WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, |
| 96 unsigned, AbstractView*, const IntPoint& screenLocation, const IntPoint&
windowLocation, | 127 unsigned, AbstractView*, const IntPoint& screenLocation, const IntPoint&
windowLocation, |
| 97 PlatformEvent::Modifiers, unsigned short buttons, double platformTimeSta
mp, | 128 PlatformEvent::Modifiers, unsigned short buttons, double platformTimeSta
mp, |
| 98 int resendingPluginId, bool hasPreciseScrollingDeltas, RailsMode, bool c
ancelable); | 129 int resendingPluginId, bool hasPreciseScrollingDeltas, RailsMode, bool c
ancelable); |
| 130 #if OS(MACOSX) |
| 131 WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, |
| 132 unsigned, AbstractView*, const IntPoint& screenLocation, const IntPoint&
windowLocation, |
| 133 PlatformEvent::Modifiers, unsigned short buttons, double platformTimeSta
mp, |
| 134 int resendingPluginId, bool hasPreciseScrollingDeltas, RailsMode, bool c
ancelable, |
| 135 WheelEventPhase phase, WheelEventPhase momentumPhase, bool canRubberband
Left, bool canRubberbandRight |
| 136 ); |
| 137 #endif |
| 99 | 138 |
| 100 IntPoint m_wheelDelta; | 139 IntPoint m_wheelDelta; |
| 101 double m_deltaX; | 140 double m_deltaX; |
| 102 double m_deltaY; | 141 double m_deltaY; |
| 103 double m_deltaZ; | 142 double m_deltaZ; |
| 104 unsigned m_deltaMode; | 143 unsigned m_deltaMode; |
| 105 int m_resendingPluginId; | 144 int m_resendingPluginId; |
| 106 bool m_hasPreciseScrollingDeltas; | 145 bool m_hasPreciseScrollingDeltas; |
| 107 RailsMode m_railsMode; | 146 RailsMode m_railsMode; |
| 147 #if OS(MACOSX) |
| 148 WheelEventPhase m_phase; |
| 149 WheelEventPhase m_momentumPhase; |
| 150 bool m_canRubberbandLeft; |
| 151 bool m_canRubberbandRight; |
| 152 #endif |
| 108 }; | 153 }; |
| 109 | 154 |
| 110 DEFINE_EVENT_TYPE_CASTS(WheelEvent); | 155 DEFINE_EVENT_TYPE_CASTS(WheelEvent); |
| 111 | 156 |
| 112 } // namespace blink | 157 } // namespace blink |
| 113 | 158 |
| 114 #endif // WheelEvent_h | 159 #endif // WheelEvent_h |
| OLD | NEW |