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 * | 7 * |
7 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
11 * | 12 * |
12 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 16 * Library General Public License for more details. |
(...skipping 12 matching lines...) Expand all Loading... |
28 #include "core/dom/MouseEvent.h" | 29 #include "core/dom/MouseEvent.h" |
29 #include "core/platform/graphics/FloatPoint.h" | 30 #include "core/platform/graphics/FloatPoint.h" |
30 | 31 |
31 namespace WebCore { | 32 namespace WebCore { |
32 | 33 |
33 class PlatformWheelEvent; | 34 class PlatformWheelEvent; |
34 | 35 |
35 struct WheelEventInit : public MouseEventInit { | 36 struct WheelEventInit : public MouseEventInit { |
36 WheelEventInit(); | 37 WheelEventInit(); |
37 | 38 |
38 int wheelDeltaX; | 39 double deltaX; |
39 int wheelDeltaY; | 40 double deltaY; |
| 41 double deltaZ; |
| 42 int wheelDeltaX; // Deprecated. |
| 43 int wheelDeltaY; // Deprecated. |
40 unsigned deltaMode; | 44 unsigned deltaMode; |
41 }; | 45 }; |
42 | 46 |
43 class WheelEvent : public MouseEvent { | 47 class WheelEvent : public MouseEvent { |
44 public: | 48 public: |
45 enum { TickMultiplier = 120 }; | 49 enum { TickMultiplier = 120 }; |
46 | 50 |
47 enum DeltaMode { | 51 enum DeltaMode { |
48 DOM_DELTA_PIXEL = 0, | 52 DOM_DELTA_PIXEL = 0, |
49 DOM_DELTA_LINE, | 53 DOM_DELTA_LINE, |
(...skipping 20 matching lines...) Expand all Loading... |
70 } | 74 } |
71 | 75 |
72 void initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView>, | 76 void initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView>, |
73 int screenX, int screenY, int pageX, int pageY, | 77 int screenX, int screenY, int pageX, int pageY, |
74 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); | 78 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); |
75 | 79 |
76 void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractV
iew>, | 80 void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractV
iew>, |
77 int screenX, int screenY, int pageX, int pageY, | 81 int screenX, int screenY, int pageX, int pageY, |
78 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); | 82 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); |
79 | 83 |
80 int wheelDelta() const { return m_wheelDelta.y() ? m_wheelDelta.y() : m_whee
lDelta.x(); } | 84 double deltaX() const { return m_deltaX; } |
81 int wheelDeltaX() const { return m_wheelDelta.x(); } | 85 double deltaY() const { return m_deltaY; } |
82 int wheelDeltaY() const { return m_wheelDelta.y(); } | 86 double deltaZ() const { return m_deltaZ; } |
| 87 int wheelDelta() const { return m_deltaY ? m_deltaY : m_deltaX; } // Depreca
ted. |
| 88 int wheelDeltaX() const { return m_deltaX; } // Deprecated. |
| 89 int wheelDeltaY() const { return m_deltaY; } // Deprecated. |
83 int rawDeltaX() const { return m_rawDelta.x(); } | 90 int rawDeltaX() const { return m_rawDelta.x(); } |
84 int rawDeltaY() const { return m_rawDelta.y(); } | 91 int rawDeltaY() const { return m_rawDelta.y(); } |
85 unsigned deltaMode() const { return m_deltaMode; } | 92 unsigned deltaMode() const { return m_deltaMode; } |
86 | 93 |
87 bool webkitDirectionInvertedFromDevice() const { return m_directionInvertedF
romDevice; } | 94 bool webkitDirectionInvertedFromDevice() const { return m_directionInvertedF
romDevice; } |
88 | 95 |
89 virtual const AtomicString& interfaceName() const; | 96 virtual const AtomicString& interfaceName() const; |
90 virtual bool isMouseEvent() const; | 97 virtual bool isMouseEvent() const; |
91 | 98 |
92 private: | 99 private: |
93 WheelEvent(); | 100 WheelEvent(); |
94 WheelEvent(const AtomicString&, const WheelEventInit&); | 101 WheelEvent(const AtomicString&, const WheelEventInit&); |
95 WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, | 102 WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, |
96 unsigned, PassRefPtr<AbstractView>, const IntPoint& screenLocation, cons
t IntPoint& pageLocation, | 103 unsigned, PassRefPtr<AbstractView>, const IntPoint& screenLocation, cons
t IntPoint& pageLocation, |
97 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionIn
vertedFromDevice); | 104 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionIn
vertedFromDevice); |
98 | 105 |
99 IntPoint m_wheelDelta; | 106 double m_deltaX; |
| 107 double m_deltaY; |
| 108 double m_deltaZ; |
100 IntPoint m_rawDelta; | 109 IntPoint m_rawDelta; |
101 unsigned m_deltaMode; | 110 unsigned m_deltaMode; |
102 bool m_directionInvertedFromDevice; | 111 bool m_directionInvertedFromDevice; |
103 }; | 112 }; |
104 | 113 |
105 class WheelEventDispatchMediator : public EventDispatchMediator { | 114 class WheelEventDispatchMediator : public EventDispatchMediator { |
106 public: | 115 public: |
107 static PassRefPtr<WheelEventDispatchMediator> create(const PlatformWheelEven
t&, PassRefPtr<AbstractView>); | 116 static PassRefPtr<WheelEventDispatchMediator> create(const PlatformWheelEven
t&, PassRefPtr<AbstractView>); |
108 private: | 117 private: |
109 WheelEventDispatchMediator(const PlatformWheelEvent&, PassRefPtr<AbstractVie
w>); | 118 WheelEventDispatchMediator(const PlatformWheelEvent&, PassRefPtr<AbstractVie
w>); |
110 WheelEvent* event() const; | 119 WheelEvent* event() const; |
111 virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; | 120 virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; |
112 }; | 121 }; |
113 | 122 |
114 } // namespace WebCore | 123 } // namespace WebCore |
115 | 124 |
116 #endif // WheelEvent_h | 125 #endif // WheelEvent_h |
OLD | NEW |