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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 { | 58 { |
59 return adoptRef(new WheelEvent); | 59 return adoptRef(new WheelEvent); |
60 } | 60 } |
61 | 61 |
62 static PassRefPtr<WheelEvent> create(const AtomicString& type, const WheelEv
entInit& initializer) | 62 static PassRefPtr<WheelEvent> create(const AtomicString& type, const WheelEv
entInit& initializer) |
63 { | 63 { |
64 return adoptRef(new WheelEvent(type, initializer)); | 64 return adoptRef(new WheelEvent(type, initializer)); |
65 } | 65 } |
66 | 66 |
67 static PassRefPtr<WheelEvent> create(const FloatPoint& wheelTicks, | 67 static PassRefPtr<WheelEvent> create(const FloatPoint& wheelTicks, |
68 const FloatPoint& rawDelta, unsigned deltaMode, PassRefPtr<AbstractView>
view, | 68 const FloatPoint& rawDelta, unsigned deltaMode, PassRefPtrWillBeRawPtr<A
bstractView> view, |
69 const IntPoint& screenLocation, const IntPoint& pageLocation, | 69 const IntPoint& screenLocation, const IntPoint& pageLocation, |
70 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionIn
vertedFromDevice) | 70 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionIn
vertedFromDevice) |
71 { | 71 { |
72 return adoptRef(new WheelEvent(wheelTicks, rawDelta, deltaMode, view, | 72 return adoptRef(new WheelEvent(wheelTicks, rawDelta, deltaMode, view, |
73 screenLocation, pageLocation, ctrlKey, altKey, shiftKey, metaKey, direct
ionInvertedFromDevice)); | 73 screenLocation, pageLocation, ctrlKey, altKey, shiftKey, metaKey, direct
ionInvertedFromDevice)); |
74 } | 74 } |
75 | 75 |
76 void initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView>, | 76 void initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtrWillBeRawPtr<Abs
tractView>, |
77 int screenX, int screenY, int pageX, int pageY, | 77 int screenX, int screenY, int pageX, int pageY, |
78 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); | 78 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); |
79 | 79 |
80 void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractV
iew>, | 80 void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtrWillBeRawP
tr<AbstractView>, |
81 int screenX, int screenY, int pageX, int pageY, | 81 int screenX, int screenY, int pageX, int pageY, |
82 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); | 82 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); |
83 | 83 |
84 double deltaX() const { return m_deltaX; } // Positive when scrolling right. | 84 double deltaX() const { return m_deltaX; } // Positive when scrolling right. |
85 double deltaY() const { return m_deltaY; } // Positive when scrolling down. | 85 double deltaY() const { return m_deltaY; } // Positive when scrolling down. |
86 double deltaZ() const { return m_deltaZ; } | 86 double deltaZ() const { return m_deltaZ; } |
87 int wheelDelta() const { return wheelDeltaY() ? wheelDeltaY() : wheelDeltaX(
); } // Deprecated. | 87 int wheelDelta() const { return wheelDeltaY() ? wheelDeltaY() : wheelDeltaX(
); } // Deprecated. |
88 int wheelDeltaX() const { return m_wheelDelta.x(); } // Deprecated, negative
when scrolling right. | 88 int wheelDeltaX() const { return m_wheelDelta.x(); } // Deprecated, negative
when scrolling right. |
89 int wheelDeltaY() const { return m_wheelDelta.y(); } // Deprecated, negative
when scrolling down. | 89 int wheelDeltaY() const { return m_wheelDelta.y(); } // Deprecated, negative
when scrolling down. |
90 unsigned deltaMode() const { return m_deltaMode; } | 90 unsigned deltaMode() const { return m_deltaMode; } |
91 float ticksX() const { return static_cast<float>(m_wheelDelta.x()) / TickMul
tiplier; } | 91 float ticksX() const { return static_cast<float>(m_wheelDelta.x()) / TickMul
tiplier; } |
92 float ticksY() const { return static_cast<float>(m_wheelDelta.y()) / TickMul
tiplier; } | 92 float ticksY() const { return static_cast<float>(m_wheelDelta.y()) / TickMul
tiplier; } |
93 | 93 |
94 bool webkitDirectionInvertedFromDevice() const { return m_directionInvertedF
romDevice; } | 94 bool webkitDirectionInvertedFromDevice() const { return m_directionInvertedF
romDevice; } |
95 | 95 |
96 virtual const AtomicString& interfaceName() const OVERRIDE; | 96 virtual const AtomicString& interfaceName() const OVERRIDE; |
97 virtual bool isMouseEvent() const OVERRIDE; | 97 virtual bool isMouseEvent() const OVERRIDE; |
98 virtual bool isWheelEvent() const OVERRIDE; | 98 virtual bool isWheelEvent() const OVERRIDE; |
99 | 99 |
100 virtual void trace(Visitor*) OVERRIDE; | 100 virtual void trace(Visitor*) OVERRIDE; |
101 | 101 |
102 private: | 102 private: |
103 WheelEvent(); | 103 WheelEvent(); |
104 WheelEvent(const AtomicString&, const WheelEventInit&); | 104 WheelEvent(const AtomicString&, const WheelEventInit&); |
105 WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, | 105 WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, |
106 unsigned, PassRefPtr<AbstractView>, const IntPoint& screenLocation, cons
t IntPoint& pageLocation, | 106 unsigned, PassRefPtrWillBeRawPtr<AbstractView>, const IntPoint& screenLo
cation, const IntPoint& pageLocation, |
107 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionIn
vertedFromDevice); | 107 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionIn
vertedFromDevice); |
108 | 108 |
109 IntPoint m_wheelDelta; | 109 IntPoint m_wheelDelta; |
110 double m_deltaX; | 110 double m_deltaX; |
111 double m_deltaY; | 111 double m_deltaY; |
112 double m_deltaZ; | 112 double m_deltaZ; |
113 unsigned m_deltaMode; | 113 unsigned m_deltaMode; |
114 bool m_directionInvertedFromDevice; | 114 bool m_directionInvertedFromDevice; |
115 }; | 115 }; |
116 | 116 |
117 DEFINE_EVENT_TYPE_CASTS(WheelEvent); | 117 DEFINE_EVENT_TYPE_CASTS(WheelEvent); |
118 | 118 |
119 class WheelEventDispatchMediator FINAL : public EventDispatchMediator { | 119 class WheelEventDispatchMediator FINAL : public EventDispatchMediator { |
120 public: | 120 public: |
121 static PassRefPtr<WheelEventDispatchMediator> create(const PlatformWheelEven
t&, PassRefPtr<AbstractView>); | 121 static PassRefPtr<WheelEventDispatchMediator> create(const PlatformWheelEven
t&, PassRefPtrWillBeRawPtr<AbstractView>); |
122 private: | 122 private: |
123 WheelEventDispatchMediator(const PlatformWheelEvent&, PassRefPtr<AbstractVie
w>); | 123 WheelEventDispatchMediator(const PlatformWheelEvent&, PassRefPtrWillBeRawPtr
<AbstractView>); |
124 WheelEvent* event() const; | 124 WheelEvent* event() const; |
125 virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; | 125 virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; |
126 }; | 126 }; |
127 | 127 |
128 } // namespace WebCore | 128 } // namespace WebCore |
129 | 129 |
130 #endif // WheelEvent_h | 130 #endif // WheelEvent_h |
OLD | NEW |