| 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 "core/events/GestureEvent.h" | 26 #include "core/events/GestureEvent.h" |
| 27 | 27 |
| 28 #include "core/dom/Element.h" | 28 #include "core/dom/Element.h" |
| 29 #include "wtf/text/AtomicString.h" | 29 #include "wtf/text/AtomicString.h" |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 PassRefPtrWillBeRawPtr<GestureEvent> GestureEvent::create(PassRefPtrWillBeRawPtr
<AbstractView> view, const PlatformGestureEvent& event) | 33 RawPtr<GestureEvent> GestureEvent::create(RawPtr<AbstractView> view, const Platf
ormGestureEvent& 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 float velocityX = 0; | 38 float velocityX = 0; |
| 39 float velocityY = 0; | 39 float velocityY = 0; |
| 40 bool inertial = false; | 40 bool inertial = false; |
| 41 bool synthetic = false; | 41 bool synthetic = false; |
| 42 ScrollGranularity deltaUnits = ScrollGranularity::ScrollByPrecisePixel; | 42 ScrollGranularity deltaUnits = ScrollGranularity::ScrollByPrecisePixel; |
| 43 | 43 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 velocityY = event.velocityY(); | 91 velocityY = event.velocityY(); |
| 92 break; | 92 break; |
| 93 case PlatformEvent::GestureTwoFingerTap: | 93 case PlatformEvent::GestureTwoFingerTap: |
| 94 case PlatformEvent::GesturePinchBegin: | 94 case PlatformEvent::GesturePinchBegin: |
| 95 case PlatformEvent::GesturePinchEnd: | 95 case PlatformEvent::GesturePinchEnd: |
| 96 case PlatformEvent::GesturePinchUpdate: | 96 case PlatformEvent::GesturePinchUpdate: |
| 97 case PlatformEvent::GestureTapDownCancel: | 97 case PlatformEvent::GestureTapDownCancel: |
| 98 default: | 98 default: |
| 99 return nullptr; | 99 return nullptr; |
| 100 } | 100 } |
| 101 return adoptRefWillBeNoop(new GestureEvent(eventType, view, event.globalPosi
tion().x(), event.globalPosition().y(), event.position().x(), event.position().y
(), event.getModifiers(), deltaX, deltaY, velocityX, velocityY, inertial, synthe
tic, deltaUnits, event.timestamp(), event.resendingPluginId(), source)); | 101 return new GestureEvent(eventType, view, event.globalPosition().x(), event.g
lobalPosition().y(), event.position().x(), event.position().y(), event.getModifi
ers(), deltaX, deltaY, velocityX, velocityY, inertial, synthetic, deltaUnits, ev
ent.timestamp(), event.resendingPluginId(), source); |
| 102 } | 102 } |
| 103 | 103 |
| 104 const AtomicString& GestureEvent::interfaceName() const | 104 const AtomicString& GestureEvent::interfaceName() const |
| 105 { | 105 { |
| 106 // FIXME: when a GestureEvent.idl interface is defined, return the string "G
estureEvent". | 106 // FIXME: when a GestureEvent.idl interface is defined, return the string "G
estureEvent". |
| 107 // Until that happens, do not advertise an interface that does not exist, si
nce it will | 107 // Until that happens, do not advertise an interface that does not exist, si
nce it will |
| 108 // trip up the bindings integrity checks. | 108 // trip up the bindings integrity checks. |
| 109 return UIEvent::interfaceName(); | 109 return UIEvent::interfaceName(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool GestureEvent::isGestureEvent() const | 112 bool GestureEvent::isGestureEvent() const |
| 113 { | 113 { |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| 116 | 116 |
| 117 GestureEvent::GestureEvent() | 117 GestureEvent::GestureEvent() |
| 118 : m_deltaX(0) | 118 : m_deltaX(0) |
| 119 , m_deltaY(0) | 119 , m_deltaY(0) |
| 120 , m_velocityX(0) | 120 , m_velocityX(0) |
| 121 , m_velocityY(0) | 121 , m_velocityY(0) |
| 122 , m_inertial(false) | 122 , m_inertial(false) |
| 123 , m_synthetic(false) | 123 , m_synthetic(false) |
| 124 , m_deltaUnits(ScrollGranularity::ScrollByPrecisePixel) | 124 , m_deltaUnits(ScrollGranularity::ScrollByPrecisePixel) |
| 125 , m_source(GestureSourceUninitialized) | 125 , m_source(GestureSourceUninitialized) |
| 126 , m_resendingPluginId(-1) | 126 , m_resendingPluginId(-1) |
| 127 { | 127 { |
| 128 } | 128 } |
| 129 | 129 |
| 130 GestureEvent::GestureEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<Abst
ractView> view, int screenX, int screenY, int clientX, int clientY, PlatformEven
t::Modifiers modifiers, float deltaX, float deltaY, float velocityX, float veloc
ityY, bool inertial, bool synthetic, ScrollGranularity deltaUnits, double platfo
rmTimeStamp, int resendingPluginId, GestureSource source) | 130 GestureEvent::GestureEvent(const AtomicString& type, RawPtr<AbstractView> view,
int screenX, int screenY, int clientX, int clientY, PlatformEvent::Modifiers mod
ifiers, float deltaX, float deltaY, float velocityX, float velocityY, bool inert
ial, bool synthetic, ScrollGranularity deltaUnits, double platformTimeStamp, int
resendingPluginId, GestureSource source) |
| 131 : MouseRelatedEvent(type, true, true, nullptr, view, 0, IntPoint(screenX, sc
reenY), IntPoint(clientX, clientY), IntPoint(0, 0), modifiers, platformTimeStamp
, PositionType::Position) | 131 : MouseRelatedEvent(type, true, true, nullptr, view, 0, IntPoint(screenX, sc
reenY), IntPoint(clientX, clientY), IntPoint(0, 0), modifiers, platformTimeStamp
, PositionType::Position) |
| 132 , m_deltaX(deltaX) | 132 , m_deltaX(deltaX) |
| 133 , m_deltaY(deltaY) | 133 , m_deltaY(deltaY) |
| 134 , m_velocityX(velocityX) | 134 , m_velocityX(velocityX) |
| 135 , m_velocityY(velocityY) | 135 , m_velocityY(velocityY) |
| 136 , m_inertial(inertial) | 136 , m_inertial(inertial) |
| 137 , m_synthetic(synthetic) | 137 , m_synthetic(synthetic) |
| 138 , m_deltaUnits(deltaUnits) | 138 , m_deltaUnits(deltaUnits) |
| 139 , m_source(source) | 139 , m_source(source) |
| 140 , m_resendingPluginId(resendingPluginId) | 140 , m_resendingPluginId(resendingPluginId) |
| 141 { | 141 { |
| 142 } | 142 } |
| 143 | 143 |
| 144 DEFINE_TRACE(GestureEvent) | 144 DEFINE_TRACE(GestureEvent) |
| 145 { | 145 { |
| 146 MouseRelatedEvent::trace(visitor); | 146 MouseRelatedEvent::trace(visitor); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace blink | 149 } // namespace blink |
| OLD | NEW |