| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/inspector/ConsoleMessage.h" | 34 #include "core/inspector/ConsoleMessage.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 TouchEvent::TouchEvent() | 38 TouchEvent::TouchEvent() |
| 39 { | 39 { |
| 40 } | 40 } |
| 41 | 41 |
| 42 TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches, | 42 TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches, |
| 43 TouchList* changedTouches, const AtomicString& type, | 43 TouchList* changedTouches, const AtomicString& type, |
| 44 PassRefPtrWillBeRawPtr<AbstractView> view, | 44 RawPtr<AbstractView> view, |
| 45 PlatformEvent::Modifiers modifiers, bool cancelable, bool causesScrollingIfU
ncanceled, | 45 PlatformEvent::Modifiers modifiers, bool cancelable, bool causesScrollingIfU
ncanceled, |
| 46 double platformTimeStamp) | 46 double platformTimeStamp) |
| 47 // Pass a sourceCapabilities including the ability to fire touchevents when
creating this touchevent, which is always created from input device capabilities
from EventHandler. | 47 // Pass a sourceCapabilities including the ability to fire touchevents when
creating this touchevent, which is always created from input device capabilities
from EventHandler. |
| 48 : UIEventWithKeyState(type, true, cancelable, view, 0, modifiers, platformTi
meStamp, InputDeviceCapabilities::firesTouchEventsSourceCapabilities()), | 48 : UIEventWithKeyState(type, true, cancelable, view, 0, modifiers, platformTi
meStamp, InputDeviceCapabilities::firesTouchEventsSourceCapabilities()), |
| 49 m_touches(touches), m_targetTouches(targetTouches), m_changedTouches(changed
Touches), m_causesScrollingIfUncanceled(causesScrollingIfUncanceled) | 49 m_touches(touches), m_targetTouches(targetTouches), m_changedTouches(changed
Touches), m_causesScrollingIfUncanceled(causesScrollingIfUncanceled) |
| 50 { | 50 { |
| 51 } | 51 } |
| 52 | 52 |
| 53 TouchEvent::TouchEvent(const AtomicString& type, const TouchEventInit& initializ
er) | 53 TouchEvent::TouchEvent(const AtomicString& type, const TouchEventInit& initializ
er) |
| 54 : UIEventWithKeyState(type, initializer) | 54 : UIEventWithKeyState(type, initializer) |
| 55 , m_touches(TouchList::create(initializer.touches())) | 55 , m_touches(TouchList::create(initializer.touches())) |
| 56 , m_targetTouches(TouchList::create(initializer.targetTouches())) | 56 , m_targetTouches(TouchList::create(initializer.targetTouches())) |
| 57 , m_changedTouches(TouchList::create(initializer.changedTouches())) | 57 , m_changedTouches(TouchList::create(initializer.changedTouches())) |
| 58 { | 58 { |
| 59 } | 59 } |
| 60 | 60 |
| 61 TouchEvent::~TouchEvent() | 61 TouchEvent::~TouchEvent() |
| 62 { | 62 { |
| 63 } | 63 } |
| 64 | 64 |
| 65 void TouchEvent::initTouchEvent(ScriptState* scriptState, TouchList* touches, To
uchList* targetTouches, | 65 void TouchEvent::initTouchEvent(ScriptState* scriptState, TouchList* touches, To
uchList* targetTouches, |
| 66 TouchList* changedTouches, const AtomicString& type, | 66 TouchList* changedTouches, const AtomicString& type, |
| 67 PassRefPtrWillBeRawPtr<AbstractView> view, | 67 RawPtr<AbstractView> view, |
| 68 int, int, int, int, | 68 int, int, int, int, |
| 69 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) | 69 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) |
| 70 { | 70 { |
| 71 if (dispatched()) | 71 if (dispatched()) |
| 72 return; | 72 return; |
| 73 | 73 |
| 74 if (scriptState->world().isIsolatedWorld()) | 74 if (scriptState->world().isIsolatedWorld()) |
| 75 UIEventWithKeyState::didCreateEventInIsolatedWorld(ctrlKey, altKey, shif
tKey, metaKey); | 75 UIEventWithKeyState::didCreateEventInIsolatedWorld(ctrlKey, altKey, shif
tKey, metaKey); |
| 76 | 76 |
| 77 bool cancelable = true; | 77 bool cancelable = true; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 102 | 102 |
| 103 // A common developer error is to wait too long before attempting to stop | 103 // A common developer error is to wait too long before attempting to stop |
| 104 // scrolling by consuming a touchmove event. Generate a warning if this | 104 // scrolling by consuming a touchmove event. Generate a warning if this |
| 105 // event is uncancelable. | 105 // event is uncancelable. |
| 106 if (!cancelable() && view() && view()->isLocalDOMWindow() && view()->frame()
) { | 106 if (!cancelable() && view() && view()->isLocalDOMWindow() && view()->frame()
) { |
| 107 toLocalDOMWindow(view())->frame()->console().addMessage(ConsoleMessage::
create(JSMessageSource, WarningMessageLevel, | 107 toLocalDOMWindow(view())->frame()->console().addMessage(ConsoleMessage::
create(JSMessageSource, WarningMessageLevel, |
| 108 "Ignored attempt to cancel a " + type() + " event with cancelable=fa
lse, for example because scrolling is in progress and cannot be interrupted.")); | 108 "Ignored attempt to cancel a " + type() + " event with cancelable=fa
lse, for example because scrolling is in progress and cannot be interrupted.")); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 PassRefPtrWillBeRawPtr<EventDispatchMediator> TouchEvent::createMediator() | 112 RawPtr<EventDispatchMediator> TouchEvent::createMediator() |
| 113 { | 113 { |
| 114 return TouchEventDispatchMediator::create(this); | 114 return TouchEventDispatchMediator::create(this); |
| 115 } | 115 } |
| 116 | 116 |
| 117 DEFINE_TRACE(TouchEvent) | 117 DEFINE_TRACE(TouchEvent) |
| 118 { | 118 { |
| 119 visitor->trace(m_touches); | 119 visitor->trace(m_touches); |
| 120 visitor->trace(m_targetTouches); | 120 visitor->trace(m_targetTouches); |
| 121 visitor->trace(m_changedTouches); | 121 visitor->trace(m_changedTouches); |
| 122 UIEventWithKeyState::trace(visitor); | 122 UIEventWithKeyState::trace(visitor); |
| 123 } | 123 } |
| 124 | 124 |
| 125 PassRefPtrWillBeRawPtr<TouchEventDispatchMediator> TouchEventDispatchMediator::c
reate(PassRefPtrWillBeRawPtr<TouchEvent> touchEvent) | 125 RawPtr<TouchEventDispatchMediator> TouchEventDispatchMediator::create(RawPtr<Tou
chEvent> touchEvent) |
| 126 { | 126 { |
| 127 return adoptRefWillBeNoop(new TouchEventDispatchMediator(touchEvent)); | 127 return new TouchEventDispatchMediator(touchEvent); |
| 128 } | 128 } |
| 129 | 129 |
| 130 TouchEventDispatchMediator::TouchEventDispatchMediator(PassRefPtrWillBeRawPtr<To
uchEvent> touchEvent) | 130 TouchEventDispatchMediator::TouchEventDispatchMediator(RawPtr<TouchEvent> touchE
vent) |
| 131 : EventDispatchMediator(touchEvent) | 131 : EventDispatchMediator(touchEvent) |
| 132 { | 132 { |
| 133 } | 133 } |
| 134 | 134 |
| 135 TouchEvent& TouchEventDispatchMediator::event() const | 135 TouchEvent& TouchEventDispatchMediator::event() const |
| 136 { | 136 { |
| 137 return toTouchEvent(EventDispatchMediator::event()); | 137 return toTouchEvent(EventDispatchMediator::event()); |
| 138 } | 138 } |
| 139 | 139 |
| 140 DispatchEventResult TouchEventDispatchMediator::dispatchEvent(EventDispatcher& d
ispatcher) const | 140 DispatchEventResult TouchEventDispatchMediator::dispatchEvent(EventDispatcher& d
ispatcher) const |
| 141 { | 141 { |
| 142 event().eventPath().adjustForTouchEvent(event()); | 142 event().eventPath().adjustForTouchEvent(event()); |
| 143 return dispatcher.dispatch(); | 143 return dispatcher.dispatch(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace blink | 146 } // namespace blink |
| OLD | NEW |