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, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved. |
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 , m_wheelDelta(initializer.wheelDeltaX ? initializer.wheelDeltaX : -initiali
zer.deltaX, initializer.wheelDeltaY ? initializer.wheelDeltaY : -initializer.del
taY) | 55 , m_wheelDelta(initializer.wheelDeltaX ? initializer.wheelDeltaX : -initiali
zer.deltaX, initializer.wheelDeltaY ? initializer.wheelDeltaY : -initializer.del
taY) |
56 , m_deltaX(initializer.deltaX ? initializer.deltaX : -initializer.wheelDelta
X) | 56 , m_deltaX(initializer.deltaX ? initializer.deltaX : -initializer.wheelDelta
X) |
57 , m_deltaY(initializer.deltaY ? initializer.deltaY : -initializer.wheelDelta
Y) | 57 , m_deltaY(initializer.deltaY ? initializer.deltaY : -initializer.wheelDelta
Y) |
58 , m_deltaZ(initializer.deltaZ) | 58 , m_deltaZ(initializer.deltaZ) |
59 , m_deltaMode(initializer.deltaMode) | 59 , m_deltaMode(initializer.deltaMode) |
60 { | 60 { |
61 ScriptWrappable::init(this); | 61 ScriptWrappable::init(this); |
62 } | 62 } |
63 | 63 |
64 WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
unsigned deltaMode, | 64 WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
unsigned deltaMode, |
65 PassRefPtr<AbstractView> view, const IntPoint& screenLocation, const IntPoin
t& pageLocation, | 65 PassRefPtrWillBeRawPtr<AbstractView> view, const IntPoint& screenLocation, c
onst IntPoint& pageLocation, |
66 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvert
edFromDevice) | 66 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvert
edFromDevice) |
67 : MouseEvent(EventTypeNames::wheel, | 67 : MouseEvent(EventTypeNames::wheel, |
68 true, true, view, 0, screenLocation.x(), screenLocation.y(), | 68 true, true, view, 0, screenLocation.x(), screenLocation.y(), |
69 pageLocation.x(), pageLocation.y(), | 69 pageLocation.x(), pageLocation.y(), |
70 0, 0, | 70 0, 0, |
71 ctrlKey, altKey, shiftKey, metaKey, 0, nullptr, nullptr, false) | 71 ctrlKey, altKey, shiftKey, metaKey, 0, nullptr, nullptr, false) |
72 , m_wheelDelta(wheelTicks.x() * TickMultiplier, wheelTicks.y() * TickMultipl
ier) | 72 , m_wheelDelta(wheelTicks.x() * TickMultiplier, wheelTicks.y() * TickMultipl
ier) |
73 , m_deltaX(-rawDelta.x()) | 73 , m_deltaX(-rawDelta.x()) |
74 , m_deltaY(-rawDelta.y()) | 74 , m_deltaY(-rawDelta.y()) |
75 , m_deltaZ(0) | 75 , m_deltaZ(0) |
76 , m_deltaMode(deltaMode) | 76 , m_deltaMode(deltaMode) |
77 , m_directionInvertedFromDevice(directionInvertedFromDevice) | 77 , m_directionInvertedFromDevice(directionInvertedFromDevice) |
78 { | 78 { |
79 ScriptWrappable::init(this); | 79 ScriptWrappable::init(this); |
80 } | 80 } |
81 | 81 |
82 void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<Abstrac
tView> view, | 82 void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtrWillBeRa
wPtr<AbstractView> view, |
83 int screenX, int screenY, int pageX, int pageY, | 83 int screenX, int screenY, int pageX, int pageY, |
84 bool ctrlKey, bool altKey, bool shiftKey, bool m
etaKey) | 84 bool ctrlKey, bool altKey, bool shiftKey, bool m
etaKey) |
85 { | 85 { |
86 if (dispatched()) | 86 if (dispatched()) |
87 return; | 87 return; |
88 | 88 |
89 initUIEvent(EventTypeNames::wheel, true, true, view, 0); | 89 initUIEvent(EventTypeNames::wheel, true, true, view, 0); |
90 | 90 |
91 m_screenLocation = IntPoint(screenX, screenY); | 91 m_screenLocation = IntPoint(screenX, screenY); |
92 m_ctrlKey = ctrlKey; | 92 m_ctrlKey = ctrlKey; |
93 m_altKey = altKey; | 93 m_altKey = altKey; |
94 m_shiftKey = shiftKey; | 94 m_shiftKey = shiftKey; |
95 m_metaKey = metaKey; | 95 m_metaKey = metaKey; |
96 | 96 |
97 m_wheelDelta = IntPoint(rawDeltaX * TickMultiplier, rawDeltaY * TickMultipli
er); | 97 m_wheelDelta = IntPoint(rawDeltaX * TickMultiplier, rawDeltaY * TickMultipli
er); |
98 m_deltaX = -rawDeltaX; | 98 m_deltaX = -rawDeltaX; |
99 m_deltaY = -rawDeltaY; | 99 m_deltaY = -rawDeltaY; |
100 m_deltaMode = DOM_DELTA_PIXEL; | 100 m_deltaMode = DOM_DELTA_PIXEL; |
101 m_directionInvertedFromDevice = false; | 101 m_directionInvertedFromDevice = false; |
102 | 102 |
103 initCoordinates(IntPoint(pageX, pageY)); | 103 initCoordinates(IntPoint(pageX, pageY)); |
104 } | 104 } |
105 | 105 |
106 void WheelEvent::initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<A
bstractView> view, | 106 void WheelEvent::initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtrWi
llBeRawPtr<AbstractView> view, |
107 int screenX, int screenY, int pageX, int p
ageY, | 107 int screenX, int screenY, int pageX, int p
ageY, |
108 bool ctrlKey, bool altKey, bool shiftKey,
bool metaKey) | 108 bool ctrlKey, bool altKey, bool shiftKey,
bool metaKey) |
109 { | 109 { |
110 initWheelEvent(rawDeltaX, rawDeltaY, view, screenX, screenY, pageX, pageY, | 110 initWheelEvent(rawDeltaX, rawDeltaY, view, screenX, screenY, pageX, pageY, |
111 ctrlKey, altKey, shiftKey, metaKey); | 111 ctrlKey, altKey, shiftKey, metaKey); |
112 } | 112 } |
113 | 113 |
114 const AtomicString& WheelEvent::interfaceName() const | 114 const AtomicString& WheelEvent::interfaceName() const |
115 { | 115 { |
116 return EventNames::WheelEvent; | 116 return EventNames::WheelEvent; |
(...skipping 12 matching lines...) Expand all Loading... |
129 void WheelEvent::trace(Visitor* visitor) | 129 void WheelEvent::trace(Visitor* visitor) |
130 { | 130 { |
131 MouseEvent::trace(visitor); | 131 MouseEvent::trace(visitor); |
132 } | 132 } |
133 | 133 |
134 inline static unsigned deltaMode(const PlatformWheelEvent& event) | 134 inline static unsigned deltaMode(const PlatformWheelEvent& event) |
135 { | 135 { |
136 return event.granularity() == ScrollByPageWheelEvent ? WheelEvent::DOM_DELTA
_PAGE : WheelEvent::DOM_DELTA_PIXEL; | 136 return event.granularity() == ScrollByPageWheelEvent ? WheelEvent::DOM_DELTA
_PAGE : WheelEvent::DOM_DELTA_PIXEL; |
137 } | 137 } |
138 | 138 |
139 PassRefPtr<WheelEventDispatchMediator> WheelEventDispatchMediator::create(const
PlatformWheelEvent& event, PassRefPtr<AbstractView> view) | 139 PassRefPtr<WheelEventDispatchMediator> WheelEventDispatchMediator::create(const
PlatformWheelEvent& event, PassRefPtrWillBeRawPtr<AbstractView> view) |
140 { | 140 { |
141 return adoptRef(new WheelEventDispatchMediator(event, view)); | 141 return adoptRef(new WheelEventDispatchMediator(event, view)); |
142 } | 142 } |
143 | 143 |
144 WheelEventDispatchMediator::WheelEventDispatchMediator(const PlatformWheelEvent&
event, PassRefPtr<AbstractView> view) | 144 WheelEventDispatchMediator::WheelEventDispatchMediator(const PlatformWheelEvent&
event, PassRefPtrWillBeRawPtr<AbstractView> view) |
145 { | 145 { |
146 if (!(event.deltaX() || event.deltaY())) | 146 if (!(event.deltaX() || event.deltaY())) |
147 return; | 147 return; |
148 | 148 |
149 setEvent(WheelEvent::create(FloatPoint(event.wheelTicksX(), event.wheelTicks
Y()), FloatPoint(event.deltaX(), event.deltaY()), | 149 setEvent(WheelEvent::create(FloatPoint(event.wheelTicksX(), event.wheelTicks
Y()), FloatPoint(event.deltaX(), event.deltaY()), |
150 deltaMode(event), view, event.globalPosition(), event.position(), | 150 deltaMode(event), view, event.globalPosition(), event.position(), |
151 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), even
t.directionInvertedFromDevice())); | 151 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), even
t.directionInvertedFromDevice())); |
152 } | 152 } |
153 | 153 |
154 WheelEvent* WheelEventDispatchMediator::event() const | 154 WheelEvent* WheelEventDispatchMediator::event() const |
155 { | 155 { |
156 return toWheelEvent(EventDispatchMediator::event()); | 156 return toWheelEvent(EventDispatchMediator::event()); |
157 } | 157 } |
158 | 158 |
159 bool WheelEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) cons
t | 159 bool WheelEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) cons
t |
160 { | 160 { |
161 ASSERT(event()); | 161 ASSERT(event()); |
162 return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->default
Handled(); | 162 return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->default
Handled(); |
163 } | 163 } |
164 | 164 |
165 } // namespace WebCore | 165 } // namespace WebCore |
OLD | NEW |