| 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 28 matching lines...) Expand all Loading... |
| 39 DEFINE_WRAPPERTYPEINFO(); | 39 DEFINE_WRAPPERTYPEINFO(); |
| 40 public: | 40 public: |
| 41 enum { TickMultiplier = 120 }; | 41 enum { TickMultiplier = 120 }; |
| 42 | 42 |
| 43 enum DeltaMode { | 43 enum DeltaMode { |
| 44 DOM_DELTA_PIXEL = 0, | 44 DOM_DELTA_PIXEL = 0, |
| 45 DOM_DELTA_LINE, | 45 DOM_DELTA_LINE, |
| 46 DOM_DELTA_PAGE | 46 DOM_DELTA_PAGE |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 static PassRefPtrWillBeRawPtr<WheelEvent> create() | 49 static RawPtr<WheelEvent> create() |
| 50 { | 50 { |
| 51 return adoptRefWillBeNoop(new WheelEvent); | 51 return (new WheelEvent); |
| 52 } | 52 } |
| 53 | 53 |
| 54 static PassRefPtrWillBeRawPtr<WheelEvent> create(const PlatformWheelEvent& p
latformEvent, PassRefPtrWillBeRawPtr<AbstractView>); | 54 static RawPtr<WheelEvent> create(const PlatformWheelEvent& platformEvent, Ra
wPtr<AbstractView>); |
| 55 | 55 |
| 56 static PassRefPtrWillBeRawPtr<WheelEvent> create(const AtomicString& type, c
onst WheelEventInit& initializer) | 56 static RawPtr<WheelEvent> create(const AtomicString& type, const WheelEventI
nit& initializer) |
| 57 { | 57 { |
| 58 return adoptRefWillBeNoop(new WheelEvent(type, initializer)); | 58 return (new WheelEvent(type, initializer)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 static PassRefPtrWillBeRawPtr<WheelEvent> create(const FloatPoint& wheelTick
s, | 61 static RawPtr<WheelEvent> create(const FloatPoint& wheelTicks, |
| 62 const FloatPoint& rawDelta, unsigned deltaMode, PassRefPtrWillBeRawPtr<A
bstractView> view, | 62 const FloatPoint& rawDelta, unsigned deltaMode, RawPtr<AbstractView> vie
w, |
| 63 const IntPoint& screenLocation, const IntPoint& windowLocation, | 63 const IntPoint& screenLocation, const IntPoint& windowLocation, |
| 64 PlatformEvent::Modifiers modifiers, unsigned short buttons, double platf
ormTimeStamp, | 64 PlatformEvent::Modifiers modifiers, unsigned short buttons, double platf
ormTimeStamp, |
| 65 bool canScroll, int resendingPluginId, bool hasPreciseScrollingDeltas, R
ailsMode railsMode) | 65 bool canScroll, int resendingPluginId, bool hasPreciseScrollingDeltas, R
ailsMode railsMode) |
| 66 { | 66 { |
| 67 return adoptRefWillBeNoop(new WheelEvent(wheelTicks, rawDelta, deltaMode
, view, | 67 return (new WheelEvent(wheelTicks, rawDelta, deltaMode, view, |
| 68 screenLocation, windowLocation, modifiers, buttons, platformTimeStam
p, | 68 screenLocation, windowLocation, modifiers, buttons, platformTimeStam
p, |
| 69 canScroll, resendingPluginId, hasPreciseScrollingDeltas, railsMode)
); | 69 canScroll, resendingPluginId, hasPreciseScrollingDeltas, railsMode)
); |
| 70 } | 70 } |
| 71 | 71 |
| 72 double deltaX() const { return m_deltaX; } // Positive when scrolling right. | 72 double deltaX() const { return m_deltaX; } // Positive when scrolling right. |
| 73 double deltaY() const { return m_deltaY; } // Positive when scrolling down. | 73 double deltaY() const { return m_deltaY; } // Positive when scrolling down. |
| 74 double deltaZ() const { return m_deltaZ; } | 74 double deltaZ() const { return m_deltaZ; } |
| 75 int wheelDelta() const { return wheelDeltaY() ? wheelDeltaY() : wheelDeltaX(
); } // Deprecated. | 75 int wheelDelta() const { return wheelDeltaY() ? wheelDeltaY() : wheelDeltaX(
); } // Deprecated. |
| 76 int wheelDeltaX() const { return m_wheelDelta.x(); } // Deprecated, negative
when scrolling right. | 76 int wheelDeltaX() const { return m_wheelDelta.x(); } // Deprecated, negative
when scrolling right. |
| 77 int wheelDeltaY() const { return m_wheelDelta.y(); } // Deprecated, negative
when scrolling down. | 77 int wheelDeltaY() const { return m_wheelDelta.y(); } // Deprecated, negative
when scrolling down. |
| 78 unsigned deltaMode() const { return m_deltaMode; } | 78 unsigned deltaMode() const { return m_deltaMode; } |
| 79 float ticksX() const { return static_cast<float>(m_wheelDelta.x()) / TickMul
tiplier; } | 79 float ticksX() const { return static_cast<float>(m_wheelDelta.x()) / TickMul
tiplier; } |
| 80 float ticksY() const { return static_cast<float>(m_wheelDelta.y()) / TickMul
tiplier; } | 80 float ticksY() const { return static_cast<float>(m_wheelDelta.y()) / TickMul
tiplier; } |
| 81 bool canScroll() const { return m_canScroll; } | 81 bool canScroll() const { return m_canScroll; } |
| 82 int resendingPluginId() const { return m_resendingPluginId; } | 82 int resendingPluginId() const { return m_resendingPluginId; } |
| 83 bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas;
} | 83 bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas;
} |
| 84 RailsMode railsMode() const { return m_railsMode; } | 84 RailsMode railsMode() const { return m_railsMode; } |
| 85 | 85 |
| 86 const AtomicString& interfaceName() const override; | 86 const AtomicString& interfaceName() const override; |
| 87 bool isMouseEvent() const override; | 87 bool isMouseEvent() const override; |
| 88 bool isWheelEvent() const override; | 88 bool isWheelEvent() const override; |
| 89 | 89 |
| 90 PassRefPtrWillBeRawPtr<EventDispatchMediator> createMediator() override; | 90 RawPtr<EventDispatchMediator> createMediator() override; |
| 91 | 91 |
| 92 DECLARE_VIRTUAL_TRACE(); | 92 DECLARE_VIRTUAL_TRACE(); |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 WheelEvent(); | 95 WheelEvent(); |
| 96 WheelEvent(const AtomicString&, const WheelEventInit&); | 96 WheelEvent(const AtomicString&, const WheelEventInit&); |
| 97 WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, | 97 WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, |
| 98 unsigned, PassRefPtrWillBeRawPtr<AbstractView>, const IntPoint& screenLo
cation, const IntPoint& windowLocation, | 98 unsigned, RawPtr<AbstractView>, const IntPoint& screenLocation, const In
tPoint& windowLocation, |
| 99 PlatformEvent::Modifiers, unsigned short buttons, double platformTimeSta
mp, | 99 PlatformEvent::Modifiers, unsigned short buttons, double platformTimeSta
mp, |
| 100 bool canScroll, int resendingPluginId, bool hasPreciseScrollingDeltas, R
ailsMode); | 100 bool canScroll, int resendingPluginId, bool hasPreciseScrollingDeltas, R
ailsMode); |
| 101 | 101 |
| 102 IntPoint m_wheelDelta; | 102 IntPoint m_wheelDelta; |
| 103 double m_deltaX; | 103 double m_deltaX; |
| 104 double m_deltaY; | 104 double m_deltaY; |
| 105 double m_deltaZ; | 105 double m_deltaZ; |
| 106 unsigned m_deltaMode; | 106 unsigned m_deltaMode; |
| 107 bool m_canScroll; | 107 bool m_canScroll; |
| 108 int m_resendingPluginId; | 108 int m_resendingPluginId; |
| 109 bool m_hasPreciseScrollingDeltas; | 109 bool m_hasPreciseScrollingDeltas; |
| 110 RailsMode m_railsMode; | 110 RailsMode m_railsMode; |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 DEFINE_EVENT_TYPE_CASTS(WheelEvent); | 113 DEFINE_EVENT_TYPE_CASTS(WheelEvent); |
| 114 | 114 |
| 115 class WheelEventDispatchMediator final : public EventDispatchMediator { | 115 class WheelEventDispatchMediator final : public EventDispatchMediator { |
| 116 public: | 116 public: |
| 117 static PassRefPtrWillBeRawPtr<WheelEventDispatchMediator> create(PassRefPtrW
illBeRawPtr<WheelEvent>); | 117 static RawPtr<WheelEventDispatchMediator> create(RawPtr<WheelEvent>); |
| 118 | 118 |
| 119 private: | 119 private: |
| 120 explicit WheelEventDispatchMediator(PassRefPtrWillBeRawPtr<WheelEvent>); | 120 explicit WheelEventDispatchMediator(RawPtr<WheelEvent>); |
| 121 WheelEvent& event() const; | 121 WheelEvent& event() const; |
| 122 bool dispatchEvent(EventDispatcher&) const override; | 122 bool dispatchEvent(EventDispatcher&) const override; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 } // namespace blink | 125 } // namespace blink |
| 126 | 126 |
| 127 #endif // WheelEvent_h | 127 #endif // WheelEvent_h |
| OLD | NEW |