OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008, The Android Open Source Project | 2 * Copyright 2008, The Android Open Source Project |
3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. | 3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above copyright | 10 * * Redistributions in binary form must reproduce the above copyright |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
31 #include "core/events/EventDispatchMediator.h" | 31 #include "core/events/EventDispatchMediator.h" |
32 #include "core/events/MouseRelatedEvent.h" | 32 #include "core/events/MouseRelatedEvent.h" |
33 #include "core/dom/TouchList.h" | 33 #include "core/dom/TouchList.h" |
34 | 34 |
35 namespace blink { | 35 namespace blink { |
36 | 36 |
37 class CORE_EXPORT TouchEvent final : public UIEventWithKeyState { | 37 class CORE_EXPORT TouchEvent final : public UIEventWithKeyState { |
38 DEFINE_WRAPPERTYPEINFO(); | 38 DEFINE_WRAPPERTYPEINFO(); |
39 public: | 39 public: |
40 virtual ~TouchEvent(); | 40 ~TouchEvent() override; |
41 | 41 |
42 // We only initialize sourceDevice when we create TouchEvent from EventHandl
er, null if it is from JavaScript. | 42 // We only initialize sourceDevice when we create TouchEvent from EventHandl
er, null if it is from JavaScript. |
43 static PassRefPtrWillBeRawPtr<TouchEvent> create() | 43 static PassRefPtrWillBeRawPtr<TouchEvent> create() |
44 { | 44 { |
45 return adoptRefWillBeNoop(new TouchEvent); | 45 return adoptRefWillBeNoop(new TouchEvent); |
46 } | 46 } |
47 static PassRefPtrWillBeRawPtr<TouchEvent> create(TouchList* touches, | 47 static PassRefPtrWillBeRawPtr<TouchEvent> create(TouchList* touches, |
48 TouchList* targetTouches, TouchList* changedTouches, | 48 TouchList* targetTouches, TouchList* changedTouches, |
49 const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView> view, | 49 const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView> view, |
50 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool cancelable,
bool causesScrollingIfUncanceled, | 50 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool cancelable,
bool causesScrollingIfUncanceled, |
(...skipping 12 matching lines...) Expand all Loading... |
63 TouchList* touches() const { return m_touches.get(); } | 63 TouchList* touches() const { return m_touches.get(); } |
64 TouchList* targetTouches() const { return m_targetTouches.get(); } | 64 TouchList* targetTouches() const { return m_targetTouches.get(); } |
65 TouchList* changedTouches() const { return m_changedTouches.get(); } | 65 TouchList* changedTouches() const { return m_changedTouches.get(); } |
66 | 66 |
67 void setTouches(PassRefPtrWillBeRawPtr<TouchList> touches) { m_touches = tou
ches; } | 67 void setTouches(PassRefPtrWillBeRawPtr<TouchList> touches) { m_touches = tou
ches; } |
68 void setTargetTouches(PassRefPtrWillBeRawPtr<TouchList> targetTouches) { m_t
argetTouches = targetTouches; } | 68 void setTargetTouches(PassRefPtrWillBeRawPtr<TouchList> targetTouches) { m_t
argetTouches = targetTouches; } |
69 void setChangedTouches(PassRefPtrWillBeRawPtr<TouchList> changedTouches) { m
_changedTouches = changedTouches; } | 69 void setChangedTouches(PassRefPtrWillBeRawPtr<TouchList> changedTouches) { m
_changedTouches = changedTouches; } |
70 | 70 |
71 bool causesScrollingIfUncanceled() const { return m_causesScrollingIfUncance
led; } | 71 bool causesScrollingIfUncanceled() const { return m_causesScrollingIfUncance
led; } |
72 | 72 |
73 virtual bool isTouchEvent() const override; | 73 bool isTouchEvent() const override; |
74 | 74 |
75 virtual const AtomicString& interfaceName() const override; | 75 const AtomicString& interfaceName() const override; |
76 | 76 |
77 virtual void preventDefault() override; | 77 void preventDefault() override; |
78 | 78 |
79 DECLARE_VIRTUAL_TRACE(); | 79 DECLARE_VIRTUAL_TRACE(); |
80 | 80 |
81 private: | 81 private: |
82 TouchEvent(); | 82 TouchEvent(); |
83 TouchEvent(TouchList* touches, TouchList* targetTouches, | 83 TouchEvent(TouchList* touches, TouchList* targetTouches, |
84 TouchList* changedTouches, const AtomicString& type, | 84 TouchList* changedTouches, const AtomicString& type, |
85 PassRefPtrWillBeRawPtr<AbstractView>, | 85 PassRefPtrWillBeRawPtr<AbstractView>, |
86 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool cancela
ble, bool causesScrollingIfUncanceled, | 86 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool cancela
ble, bool causesScrollingIfUncanceled, |
87 double uiCreateTime = 0); | 87 double uiCreateTime = 0); |
88 | 88 |
89 RefPtrWillBeMember<TouchList> m_touches; | 89 RefPtrWillBeMember<TouchList> m_touches; |
90 RefPtrWillBeMember<TouchList> m_targetTouches; | 90 RefPtrWillBeMember<TouchList> m_targetTouches; |
91 RefPtrWillBeMember<TouchList> m_changedTouches; | 91 RefPtrWillBeMember<TouchList> m_changedTouches; |
92 bool m_causesScrollingIfUncanceled; | 92 bool m_causesScrollingIfUncanceled; |
93 }; | 93 }; |
94 | 94 |
95 class TouchEventDispatchMediator final : public EventDispatchMediator { | 95 class TouchEventDispatchMediator final : public EventDispatchMediator { |
96 public: | 96 public: |
97 static PassRefPtrWillBeRawPtr<TouchEventDispatchMediator> create(PassRefPtrW
illBeRawPtr<TouchEvent>); | 97 static PassRefPtrWillBeRawPtr<TouchEventDispatchMediator> create(PassRefPtrW
illBeRawPtr<TouchEvent>); |
98 | 98 |
99 private: | 99 private: |
100 explicit TouchEventDispatchMediator(PassRefPtrWillBeRawPtr<TouchEvent>); | 100 explicit TouchEventDispatchMediator(PassRefPtrWillBeRawPtr<TouchEvent>); |
101 TouchEvent& event() const; | 101 TouchEvent& event() const; |
102 virtual bool dispatchEvent(EventDispatcher&) const override; | 102 bool dispatchEvent(EventDispatcher&) const override; |
103 }; | 103 }; |
104 | 104 |
105 DEFINE_EVENT_TYPE_CASTS(TouchEvent); | 105 DEFINE_EVENT_TYPE_CASTS(TouchEvent); |
106 | 106 |
107 } // namespace blink | 107 } // namespace blink |
108 | 108 |
109 #endif // TouchEvent_h | 109 #endif // TouchEvent_h |
OLD | NEW |