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 13 matching lines...) Expand all Loading... |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 | 28 |
29 #include "core/events/TouchEvent.h" | 29 #include "core/events/TouchEvent.h" |
30 | 30 |
31 #include "core/events/EventDispatcher.h" | 31 #include "core/events/EventDispatcher.h" |
32 #include "core/frame/FrameConsole.h" | 32 #include "core/frame/FrameConsole.h" |
33 #include "core/frame/LocalFrame.h" | 33 #include "core/frame/LocalFrame.h" |
| 34 #include "core/inspector/ConsoleMessage.h" |
34 | 35 |
35 namespace WebCore { | 36 namespace WebCore { |
36 | 37 |
37 TouchEvent::TouchEvent() | 38 TouchEvent::TouchEvent() |
38 { | 39 { |
39 ScriptWrappable::init(this); | 40 ScriptWrappable::init(this); |
40 } | 41 } |
41 | 42 |
42 TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches, | 43 TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches, |
43 TouchList* changedTouches, const AtomicString& type, | 44 TouchList* changedTouches, const AtomicString& type, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 92 } |
92 | 93 |
93 void TouchEvent::preventDefault() | 94 void TouchEvent::preventDefault() |
94 { | 95 { |
95 UIEventWithKeyState::preventDefault(); | 96 UIEventWithKeyState::preventDefault(); |
96 | 97 |
97 // A common developer error is to wait too long before attempting to stop | 98 // A common developer error is to wait too long before attempting to stop |
98 // scrolling by consuming a touchmove event. Generate a warning if this | 99 // scrolling by consuming a touchmove event. Generate a warning if this |
99 // event is uncancelable. | 100 // event is uncancelable. |
100 if (!cancelable() && view() && view()->frame()) { | 101 if (!cancelable() && view() && view()->frame()) { |
101 view()->frame()->console().addMessage(JSMessageSource, WarningMessageLev
el, | 102 view()->frame()->console().addMessage(ConsoleMessage::create(JSMessageSo
urce, WarningMessageLevel, |
102 "Ignored attempt to cancel a " + type() + " event with cancelable=fa
lse, for example because scrolling is in progress and cannot be interrupted."); | 103 "Ignored attempt to cancel a " + type() + " event with cancelable=fa
lse, for example because scrolling is in progress and cannot be interrupted.")); |
103 } | 104 } |
104 } | 105 } |
105 void TouchEvent::trace(Visitor* visitor) | 106 void TouchEvent::trace(Visitor* visitor) |
106 { | 107 { |
107 visitor->trace(m_touches); | 108 visitor->trace(m_touches); |
108 visitor->trace(m_targetTouches); | 109 visitor->trace(m_targetTouches); |
109 visitor->trace(m_changedTouches); | 110 visitor->trace(m_changedTouches); |
110 UIEventWithKeyState::trace(visitor); | 111 UIEventWithKeyState::trace(visitor); |
111 } | 112 } |
112 | 113 |
(...skipping 12 matching lines...) Expand all Loading... |
125 return toTouchEvent(EventDispatchMediator::event()); | 126 return toTouchEvent(EventDispatchMediator::event()); |
126 } | 127 } |
127 | 128 |
128 bool TouchEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) cons
t | 129 bool TouchEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) cons
t |
129 { | 130 { |
130 event()->eventPath().adjustForTouchEvent(dispatcher->node(), *event()); | 131 event()->eventPath().adjustForTouchEvent(dispatcher->node(), *event()); |
131 return dispatcher->dispatch(); | 132 return dispatcher->dispatch(); |
132 } | 133 } |
133 | 134 |
134 } // namespace WebCore | 135 } // namespace WebCore |
OLD | NEW |