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 |
11 * 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. |
12 * | 12 * |
13 * 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, |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
17 * | 17 * |
18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
22 */ | 22 */ |
23 | 23 |
24 #include "core/events/WheelEvent.h" | 24 #include "core/events/WheelEvent.h" |
25 | 25 |
26 #include "core/clipboard/DataTransfer.h" | 26 #include "core/clipboard/DataTransfer.h" |
27 #include "platform/PlatformMouseEvent.h" | |
28 | 27 |
29 namespace blink { | 28 namespace blink { |
30 | 29 |
31 namespace { | 30 namespace { |
32 | 31 |
33 unsigned convertDeltaMode(const WebMouseWheelEvent& event) { | 32 unsigned convertDeltaMode(const WebMouseWheelEvent& event) { |
34 return event.scrollByPage ? WheelEvent::kDomDeltaPage | 33 return event.scrollByPage ? WheelEvent::kDomDeltaPage |
35 : WheelEvent::kDomDeltaPixel; | 34 : WheelEvent::kDomDeltaPixel; |
36 } | 35 } |
37 | 36 |
(...skipping 28 matching lines...) Expand all Loading... |
66 ? initializer.deltaY() | 65 ? initializer.deltaY() |
67 : negateIfPossible(initializer.wheelDeltaY())), | 66 : negateIfPossible(initializer.wheelDeltaY())), |
68 m_deltaZ(initializer.deltaZ()), | 67 m_deltaZ(initializer.deltaZ()), |
69 m_deltaMode(initializer.deltaMode()) {} | 68 m_deltaMode(initializer.deltaMode()) {} |
70 | 69 |
71 WheelEvent::WheelEvent(const WebMouseWheelEvent& event, AbstractView* view) | 70 WheelEvent::WheelEvent(const WebMouseWheelEvent& event, AbstractView* view) |
72 : MouseEvent(EventTypeNames::wheel, | 71 : MouseEvent(EventTypeNames::wheel, |
73 true, | 72 true, |
74 event.isCancelable(), | 73 event.isCancelable(), |
75 view, | 74 view, |
76 PlatformMouseEvent::RealOrIndistinguishable, | 75 event, |
| 76 event.clickCount, |
77 // TODO(zino): Should support canvas hit region because the | 77 // TODO(zino): Should support canvas hit region because the |
78 // wheel event is a kind of mouse event. Please see | 78 // wheel event is a kind of mouse event. Please see |
79 // http://crbug.com/594075 | 79 // http://crbug.com/594075 |
80 String(), | 80 String(), |
81 event), | 81 nullptr), |
82 m_wheelDelta(event.wheelTicksX * TickMultiplier, | 82 m_wheelDelta(event.wheelTicksX * TickMultiplier, |
83 event.wheelTicksY * TickMultiplier), | 83 event.wheelTicksY * TickMultiplier), |
84 m_deltaX(-event.deltaXInRootFrame()), | 84 m_deltaX(-event.deltaXInRootFrame()), |
85 m_deltaY(-event.deltaYInRootFrame()), | 85 m_deltaY(-event.deltaYInRootFrame()), |
86 m_deltaZ(0), | 86 m_deltaZ(0), |
87 m_deltaMode(convertDeltaMode(event)), | 87 m_deltaMode(convertDeltaMode(event)), |
88 m_nativeEvent(event) {} | 88 m_nativeEvent(event) {} |
89 | 89 |
90 const AtomicString& WheelEvent::interfaceName() const { | 90 const AtomicString& WheelEvent::interfaceName() const { |
91 return EventNames::WheelEvent; | 91 return EventNames::WheelEvent; |
92 } | 92 } |
93 | 93 |
94 bool WheelEvent::isMouseEvent() const { | 94 bool WheelEvent::isMouseEvent() const { |
95 return false; | 95 return false; |
96 } | 96 } |
97 | 97 |
98 bool WheelEvent::isWheelEvent() const { | 98 bool WheelEvent::isWheelEvent() const { |
99 return true; | 99 return true; |
100 } | 100 } |
101 | 101 |
102 EventDispatchMediator* WheelEvent::createMediator() { | 102 EventDispatchMediator* WheelEvent::createMediator() { |
103 return EventDispatchMediator::create(this); | 103 return EventDispatchMediator::create(this); |
104 } | 104 } |
105 | 105 |
106 DEFINE_TRACE(WheelEvent) { | 106 DEFINE_TRACE(WheelEvent) { |
107 MouseEvent::trace(visitor); | 107 MouseEvent::trace(visitor); |
108 } | 108 } |
109 | 109 |
110 } // namespace blink | 110 } // namespace blink |
OLD | NEW |