| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * * Redistributions of source code must retain the above copyright | 7 * * Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * * Redistributions in binary form must reproduce the above copyright | 9 * * Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "core/dom/Element.h" | 27 #include "core/dom/Element.h" |
| 28 #include "core/events/GestureEvent.h" | 28 #include "core/events/GestureEvent.h" |
| 29 #include "wtf/text/AtomicString.h" | 29 #include "wtf/text/AtomicString.h" |
| 30 | 30 |
| 31 namespace WebCore { | 31 namespace WebCore { |
| 32 | 32 |
| 33 PassRefPtr<GestureEvent> GestureEvent::create(PassRefPtr<AbstractView> view, con
st PlatformGestureEvent& event) | 33 PassRefPtrWillBeRawPtr<GestureEvent> GestureEvent::create(PassRefPtr<AbstractVie
w> view, const PlatformGestureEvent& event) |
| 34 { | 34 { |
| 35 AtomicString eventType; | 35 AtomicString eventType; |
| 36 float deltaX = 0; | 36 float deltaX = 0; |
| 37 float deltaY = 0; | 37 float deltaY = 0; |
| 38 switch (event.type()) { | 38 switch (event.type()) { |
| 39 case PlatformEvent::GestureScrollBegin: | 39 case PlatformEvent::GestureScrollBegin: |
| 40 eventType = EventTypeNames::gesturescrollstart; break; | 40 eventType = EventTypeNames::gesturescrollstart; break; |
| 41 case PlatformEvent::GestureScrollEnd: | 41 case PlatformEvent::GestureScrollEnd: |
| 42 eventType = EventTypeNames::gesturescrollend; break; | 42 eventType = EventTypeNames::gesturescrollend; break; |
| 43 case PlatformEvent::GestureScrollUpdate: | 43 case PlatformEvent::GestureScrollUpdate: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 58 eventType = EventTypeNames::gestureshowpress; break; | 58 eventType = EventTypeNames::gestureshowpress; break; |
| 59 case PlatformEvent::GestureTwoFingerTap: | 59 case PlatformEvent::GestureTwoFingerTap: |
| 60 case PlatformEvent::GestureLongPress: | 60 case PlatformEvent::GestureLongPress: |
| 61 case PlatformEvent::GesturePinchBegin: | 61 case PlatformEvent::GesturePinchBegin: |
| 62 case PlatformEvent::GesturePinchEnd: | 62 case PlatformEvent::GesturePinchEnd: |
| 63 case PlatformEvent::GesturePinchUpdate: | 63 case PlatformEvent::GesturePinchUpdate: |
| 64 case PlatformEvent::GestureTapDownCancel: | 64 case PlatformEvent::GestureTapDownCancel: |
| 65 default: | 65 default: |
| 66 return nullptr; | 66 return nullptr; |
| 67 } | 67 } |
| 68 return adoptRef(new GestureEvent(eventType, view, event.globalPosition().x()
, event.globalPosition().y(), event.position().x(), event.position().y(), event.
ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), deltaX, deltaY)); | 68 return adoptRefCountedWillBeRefCountedGarbageCollected(new GestureEvent(even
tType, view, event.globalPosition().x(), event.globalPosition().y(), event.posit
ion().x(), event.position().y(), event.ctrlKey(), event.altKey(), event.shiftKey
(), event.metaKey(), deltaX, deltaY)); |
| 69 } | 69 } |
| 70 | 70 |
| 71 const AtomicString& GestureEvent::interfaceName() const | 71 const AtomicString& GestureEvent::interfaceName() const |
| 72 { | 72 { |
| 73 // FIXME: when a GestureEvent.idl interface is defined, return the string "G
estureEvent". | 73 // FIXME: when a GestureEvent.idl interface is defined, return the string "G
estureEvent". |
| 74 // Until that happens, do not advertise an interface that does not exist, si
nce it will | 74 // Until that happens, do not advertise an interface that does not exist, si
nce it will |
| 75 // trip up the bindings integrity checks. | 75 // trip up the bindings integrity checks. |
| 76 return UIEvent::interfaceName(); | 76 return UIEvent::interfaceName(); |
| 77 } | 77 } |
| 78 | 78 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool GestureEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) co
nst | 112 bool GestureEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) co
nst |
| 113 { | 113 { |
| 114 dispatcher->dispatch(); | 114 dispatcher->dispatch(); |
| 115 ASSERT(!event()->defaultPrevented()); | 115 ASSERT(!event()->defaultPrevented()); |
| 116 return event()->defaultHandled() || event()->defaultPrevented(); | 116 return event()->defaultHandled() || event()->defaultPrevented(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace WebCore | 119 } // namespace WebCore |
| OLD | NEW |