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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 static PassRefPtrWillBeRawPtr<WheelEvent> create(const AtomicString& type, c
onst WheelEventInit& initializer) | 63 static PassRefPtrWillBeRawPtr<WheelEvent> create(const AtomicString& type, c
onst WheelEventInit& initializer) |
64 { | 64 { |
65 return adoptRefWillBeNoop(new WheelEvent(type, initializer)); | 65 return adoptRefWillBeNoop(new WheelEvent(type, initializer)); |
66 } | 66 } |
67 | 67 |
68 static PassRefPtrWillBeRawPtr<WheelEvent> create(const FloatPoint& wheelTick
s, | 68 static PassRefPtrWillBeRawPtr<WheelEvent> create(const FloatPoint& wheelTick
s, |
69 const FloatPoint& rawDelta, unsigned deltaMode, PassRefPtrWillBeRawPtr<A
bstractView> view, | 69 const FloatPoint& rawDelta, unsigned deltaMode, PassRefPtrWillBeRawPtr<A
bstractView> view, |
70 const IntPoint& screenLocation, const IntPoint& pageLocation, | 70 const IntPoint& screenLocation, const IntPoint& pageLocation, |
71 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) | 71 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool canScroll) |
72 { | 72 { |
73 return adoptRefWillBeNoop(new WheelEvent(wheelTicks, rawDelta, deltaMode
, view, | 73 return adoptRefWillBeNoop(new WheelEvent(wheelTicks, rawDelta, deltaMode
, view, |
74 screenLocation, pageLocation, ctrlKey, altKey, shiftKey, metaKey)); | 74 screenLocation, pageLocation, ctrlKey, altKey, shiftKey, metaKey, canScr
oll)); |
75 } | 75 } |
76 | 76 |
77 double deltaX() const { return m_deltaX; } // Positive when scrolling right. | 77 double deltaX() const { return m_deltaX; } // Positive when scrolling right. |
78 double deltaY() const { return m_deltaY; } // Positive when scrolling down. | 78 double deltaY() const { return m_deltaY; } // Positive when scrolling down. |
79 double deltaZ() const { return m_deltaZ; } | 79 double deltaZ() const { return m_deltaZ; } |
80 int wheelDelta() const { return wheelDeltaY() ? wheelDeltaY() : wheelDeltaX(
); } // Deprecated. | 80 int wheelDelta() const { return wheelDeltaY() ? wheelDeltaY() : wheelDeltaX(
); } // Deprecated. |
81 int wheelDeltaX() const { return m_wheelDelta.x(); } // Deprecated, negative
when scrolling right. | 81 int wheelDeltaX() const { return m_wheelDelta.x(); } // Deprecated, negative
when scrolling right. |
82 int wheelDeltaY() const { return m_wheelDelta.y(); } // Deprecated, negative
when scrolling down. | 82 int wheelDeltaY() const { return m_wheelDelta.y(); } // Deprecated, negative
when scrolling down. |
83 unsigned deltaMode() const { return m_deltaMode; } | 83 unsigned deltaMode() const { return m_deltaMode; } |
84 float ticksX() const { return static_cast<float>(m_wheelDelta.x()) / TickMul
tiplier; } | 84 float ticksX() const { return static_cast<float>(m_wheelDelta.x()) / TickMul
tiplier; } |
85 float ticksY() const { return static_cast<float>(m_wheelDelta.y()) / TickMul
tiplier; } | 85 float ticksY() const { return static_cast<float>(m_wheelDelta.y()) / TickMul
tiplier; } |
| 86 bool canScroll() const { return m_canScroll; } |
86 | 87 |
87 virtual const AtomicString& interfaceName() const override; | 88 virtual const AtomicString& interfaceName() const override; |
88 virtual bool isMouseEvent() const override; | 89 virtual bool isMouseEvent() const override; |
89 virtual bool isWheelEvent() const override; | 90 virtual bool isWheelEvent() const override; |
90 | 91 |
91 virtual void trace(Visitor*) override; | 92 virtual void trace(Visitor*) override; |
92 | 93 |
93 private: | 94 private: |
94 WheelEvent(); | 95 WheelEvent(); |
95 WheelEvent(const AtomicString&, const WheelEventInit&); | 96 WheelEvent(const AtomicString&, const WheelEventInit&); |
96 WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, | 97 WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, |
97 unsigned, PassRefPtrWillBeRawPtr<AbstractView>, const IntPoint& screenLo
cation, const IntPoint& pageLocation, | 98 unsigned, PassRefPtrWillBeRawPtr<AbstractView>, const IntPoint& screenLo
cation, const IntPoint& pageLocation, |
98 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); | 99 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool canScroll); |
99 | 100 |
100 IntPoint m_wheelDelta; | 101 IntPoint m_wheelDelta; |
101 double m_deltaX; | 102 double m_deltaX; |
102 double m_deltaY; | 103 double m_deltaY; |
103 double m_deltaZ; | 104 double m_deltaZ; |
104 unsigned m_deltaMode; | 105 unsigned m_deltaMode; |
| 106 bool m_canScroll; |
105 }; | 107 }; |
106 | 108 |
107 DEFINE_EVENT_TYPE_CASTS(WheelEvent); | 109 DEFINE_EVENT_TYPE_CASTS(WheelEvent); |
108 | 110 |
109 class WheelEventDispatchMediator final : public EventDispatchMediator { | 111 class WheelEventDispatchMediator final : public EventDispatchMediator { |
110 public: | 112 public: |
111 static PassRefPtrWillBeRawPtr<WheelEventDispatchMediator> create(const Platf
ormWheelEvent&, PassRefPtrWillBeRawPtr<AbstractView>); | 113 static PassRefPtrWillBeRawPtr<WheelEventDispatchMediator> create(const Platf
ormWheelEvent&, PassRefPtrWillBeRawPtr<AbstractView>); |
112 private: | 114 private: |
113 WheelEventDispatchMediator(const PlatformWheelEvent&, PassRefPtrWillBeRawPtr
<AbstractView>); | 115 WheelEventDispatchMediator(const PlatformWheelEvent&, PassRefPtrWillBeRawPtr
<AbstractView>); |
114 WheelEvent* event() const; | 116 WheelEvent* event() const; |
115 virtual bool dispatchEvent(EventDispatcher*) const override; | 117 virtual bool dispatchEvent(EventDispatcher*) const override; |
116 }; | 118 }; |
117 | 119 |
118 } // namespace blink | 120 } // namespace blink |
119 | 121 |
120 #endif // WheelEvent_h | 122 #endif // WheelEvent_h |
OLD | NEW |