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 26 matching lines...) Expand all Loading... |
37 , wheelDeltaY(0) | 37 , wheelDeltaY(0) |
38 , deltaMode(WheelEvent::DOM_DELTA_PIXEL) | 38 , deltaMode(WheelEvent::DOM_DELTA_PIXEL) |
39 { | 39 { |
40 } | 40 } |
41 | 41 |
42 WheelEvent::WheelEvent() | 42 WheelEvent::WheelEvent() |
43 : m_deltaX(0) | 43 : m_deltaX(0) |
44 , m_deltaY(0) | 44 , m_deltaY(0) |
45 , m_deltaZ(0) | 45 , m_deltaZ(0) |
46 , m_deltaMode(DOM_DELTA_PIXEL) | 46 , m_deltaMode(DOM_DELTA_PIXEL) |
47 , m_directionInvertedFromDevice(false) | |
48 { | 47 { |
49 ScriptWrappable::init(this); | 48 ScriptWrappable::init(this); |
50 } | 49 } |
51 | 50 |
52 WheelEvent::WheelEvent(const AtomicString& type, const WheelEventInit& initializ
er) | 51 WheelEvent::WheelEvent(const AtomicString& type, const WheelEventInit& initializ
er) |
53 : MouseEvent(type, initializer) | 52 : MouseEvent(type, initializer) |
54 , m_wheelDelta(initializer.wheelDeltaX ? initializer.wheelDeltaX : -initiali
zer.deltaX, initializer.wheelDeltaY ? initializer.wheelDeltaY : -initializer.del
taY) | 53 , m_wheelDelta(initializer.wheelDeltaX ? initializer.wheelDeltaX : -initiali
zer.deltaX, initializer.wheelDeltaY ? initializer.wheelDeltaY : -initializer.del
taY) |
55 , m_deltaX(initializer.deltaX ? initializer.deltaX : -initializer.wheelDelta
X) | 54 , m_deltaX(initializer.deltaX ? initializer.deltaX : -initializer.wheelDelta
X) |
56 , m_deltaY(initializer.deltaY ? initializer.deltaY : -initializer.wheelDelta
Y) | 55 , m_deltaY(initializer.deltaY ? initializer.deltaY : -initializer.wheelDelta
Y) |
57 , m_deltaZ(initializer.deltaZ) | 56 , m_deltaZ(initializer.deltaZ) |
58 , m_deltaMode(initializer.deltaMode) | 57 , m_deltaMode(initializer.deltaMode) |
59 { | 58 { |
60 ScriptWrappable::init(this); | 59 ScriptWrappable::init(this); |
61 } | 60 } |
62 | 61 |
63 WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
unsigned deltaMode, | 62 WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
unsigned deltaMode, |
64 PassRefPtrWillBeRawPtr<AbstractView> view, const IntPoint& screenLocation, c
onst IntPoint& pageLocation, | 63 PassRefPtrWillBeRawPtr<AbstractView> view, const IntPoint& screenLocation, c
onst IntPoint& pageLocation, |
65 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvert
edFromDevice) | 64 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) |
66 : MouseEvent(EventTypeNames::wheel, | 65 : MouseEvent(EventTypeNames::wheel, |
67 true, true, view, 0, screenLocation.x(), screenLocation.y(), | 66 true, true, view, 0, screenLocation.x(), screenLocation.y(), |
68 pageLocation.x(), pageLocation.y(), | 67 pageLocation.x(), pageLocation.y(), |
69 0, 0, | 68 0, 0, |
70 ctrlKey, altKey, shiftKey, metaKey, 0, nullptr, nullptr, false) | 69 ctrlKey, altKey, shiftKey, metaKey, 0, nullptr, nullptr, false) |
71 , m_wheelDelta(wheelTicks.x() * TickMultiplier, wheelTicks.y() * TickMultipl
ier) | 70 , m_wheelDelta(wheelTicks.x() * TickMultiplier, wheelTicks.y() * TickMultipl
ier) |
72 , m_deltaX(-rawDelta.x()) | 71 , m_deltaX(-rawDelta.x()) |
73 , m_deltaY(-rawDelta.y()) | 72 , m_deltaY(-rawDelta.y()) |
74 , m_deltaZ(0) | 73 , m_deltaZ(0) |
75 , m_deltaMode(deltaMode) | 74 , m_deltaMode(deltaMode) |
76 , m_directionInvertedFromDevice(directionInvertedFromDevice) | |
77 { | 75 { |
78 ScriptWrappable::init(this); | 76 ScriptWrappable::init(this); |
79 } | 77 } |
80 | 78 |
81 void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtrWillBeRa
wPtr<AbstractView> view, | 79 void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtrWillBeRa
wPtr<AbstractView> view, |
82 int screenX, int screenY, int pageX, int pageY, | 80 int screenX, int screenY, int pageX, int pageY, |
83 bool ctrlKey, bool altKey, bool shiftKey, bool m
etaKey) | 81 bool ctrlKey, bool altKey, bool shiftKey, bool m
etaKey) |
84 { | 82 { |
85 if (dispatched()) | 83 if (dispatched()) |
86 return; | 84 return; |
87 | 85 |
88 initUIEvent(EventTypeNames::wheel, true, true, view, 0); | 86 initUIEvent(EventTypeNames::wheel, true, true, view, 0); |
89 | 87 |
90 m_screenLocation = IntPoint(screenX, screenY); | 88 m_screenLocation = IntPoint(screenX, screenY); |
91 m_ctrlKey = ctrlKey; | 89 m_ctrlKey = ctrlKey; |
92 m_altKey = altKey; | 90 m_altKey = altKey; |
93 m_shiftKey = shiftKey; | 91 m_shiftKey = shiftKey; |
94 m_metaKey = metaKey; | 92 m_metaKey = metaKey; |
95 | 93 |
96 m_wheelDelta = IntPoint(rawDeltaX * TickMultiplier, rawDeltaY * TickMultipli
er); | 94 m_wheelDelta = IntPoint(rawDeltaX * TickMultiplier, rawDeltaY * TickMultipli
er); |
97 m_deltaX = -rawDeltaX; | 95 m_deltaX = -rawDeltaX; |
98 m_deltaY = -rawDeltaY; | 96 m_deltaY = -rawDeltaY; |
99 m_deltaMode = DOM_DELTA_PIXEL; | 97 m_deltaMode = DOM_DELTA_PIXEL; |
100 m_directionInvertedFromDevice = false; | |
101 | 98 |
102 initCoordinates(IntPoint(pageX, pageY)); | 99 initCoordinates(IntPoint(pageX, pageY)); |
103 } | 100 } |
104 | 101 |
105 void WheelEvent::initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtrWi
llBeRawPtr<AbstractView> view, | 102 void WheelEvent::initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtrWi
llBeRawPtr<AbstractView> view, |
106 int screenX, int screenY, int pageX, int p
ageY, | 103 int screenX, int screenY, int pageX, int p
ageY, |
107 bool ctrlKey, bool altKey, bool shiftKey,
bool metaKey) | 104 bool ctrlKey, bool altKey, bool shiftKey,
bool metaKey) |
108 { | 105 { |
109 initWheelEvent(rawDeltaX, rawDeltaY, view, screenX, screenY, pageX, pageY, | 106 initWheelEvent(rawDeltaX, rawDeltaY, view, screenX, screenY, pageX, pageY, |
110 ctrlKey, altKey, shiftKey, metaKey); | 107 ctrlKey, altKey, shiftKey, metaKey); |
(...skipping 29 matching lines...) Expand all Loading... |
140 return adoptRefWillBeNoop(new WheelEventDispatchMediator(event, view)); | 137 return adoptRefWillBeNoop(new WheelEventDispatchMediator(event, view)); |
141 } | 138 } |
142 | 139 |
143 WheelEventDispatchMediator::WheelEventDispatchMediator(const PlatformWheelEvent&
event, PassRefPtrWillBeRawPtr<AbstractView> view) | 140 WheelEventDispatchMediator::WheelEventDispatchMediator(const PlatformWheelEvent&
event, PassRefPtrWillBeRawPtr<AbstractView> view) |
144 { | 141 { |
145 if (!(event.deltaX() || event.deltaY())) | 142 if (!(event.deltaX() || event.deltaY())) |
146 return; | 143 return; |
147 | 144 |
148 setEvent(WheelEvent::create(FloatPoint(event.wheelTicksX(), event.wheelTicks
Y()), FloatPoint(event.deltaX(), event.deltaY()), | 145 setEvent(WheelEvent::create(FloatPoint(event.wheelTicksX(), event.wheelTicks
Y()), FloatPoint(event.deltaX(), event.deltaY()), |
149 deltaMode(event), view, event.globalPosition(), event.position(), | 146 deltaMode(event), view, event.globalPosition(), event.position(), |
150 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), even
t.directionInvertedFromDevice())); | 147 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey())); |
151 } | 148 } |
152 | 149 |
153 WheelEvent* WheelEventDispatchMediator::event() const | 150 WheelEvent* WheelEventDispatchMediator::event() const |
154 { | 151 { |
155 return toWheelEvent(EventDispatchMediator::event()); | 152 return toWheelEvent(EventDispatchMediator::event()); |
156 } | 153 } |
157 | 154 |
158 bool WheelEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) cons
t | 155 bool WheelEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) cons
t |
159 { | 156 { |
160 ASSERT(event()); | 157 ASSERT(event()); |
161 return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->default
Handled(); | 158 return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->default
Handled(); |
162 } | 159 } |
163 | 160 |
164 } // namespace blink | 161 } // namespace blink |
OLD | NEW |