summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2013-11-14 05:11:07 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-11-14 05:11:09 +0000
commit1aaaebb25db3ae24e6a55f89a1b9e19a8d6c0b99 (patch)
treee680c7e5cd88034edb0f491c40facf8b7269d057
parent4723946312b1d8771464a111d7e766d0affe60d4 (diff)
parent29cbcb0f746cb081dea0e1d0ff911e3d67adf878 (diff)
downloadWebKit-kitkat-mr1-release.tar.gz
-rw-r--r--Source/core/dom/Event.cpp5
-rw-r--r--Source/core/dom/Event.h1
-rw-r--r--Source/core/dom/GestureEvent.cpp7
-rw-r--r--Source/core/dom/GestureEvent.h8
-rw-r--r--Source/web/WebPluginContainerImpl.cpp4
5 files changed, 22 insertions, 3 deletions
diff --git a/Source/core/dom/Event.cpp b/Source/core/dom/Event.cpp
index 1b714f753..f066f56c6 100644
--- a/Source/core/dom/Event.cpp
+++ b/Source/core/dom/Event.cpp
@@ -138,6 +138,11 @@ bool Event::isTouchEvent() const
return false;
}
+bool Event::isGestureEvent() const
+{
+ return false;
+}
+
bool Event::isDragEvent() const
{
return false;
diff --git a/Source/core/dom/Event.h b/Source/core/dom/Event.h
index 7875b1e23..3d4695fd9 100644
--- a/Source/core/dom/Event.h
+++ b/Source/core/dom/Event.h
@@ -126,6 +126,7 @@ public:
virtual bool isFocusEvent() const;
virtual bool isKeyboardEvent() const;
virtual bool isTouchEvent() const;
+ virtual bool isGestureEvent() const;
// Drag events are a subset of mouse events.
virtual bool isDragEvent() const;
diff --git a/Source/core/dom/GestureEvent.cpp b/Source/core/dom/GestureEvent.cpp
index a4f5cf8f5..735036eaf 100644
--- a/Source/core/dom/GestureEvent.cpp
+++ b/Source/core/dom/GestureEvent.cpp
@@ -90,6 +90,11 @@ const AtomicString& GestureEvent::interfaceName() const
return UIEvent::interfaceName();
}
+bool GestureEvent::isGestureEvent() const
+{
+ return true;
+}
+
GestureEvent::GestureEvent()
: m_deltaX(0)
, m_deltaY(0)
@@ -110,7 +115,7 @@ GestureEventDispatchMediator::GestureEventDispatchMediator(PassRefPtr<GestureEve
GestureEvent* GestureEventDispatchMediator::event() const
{
- return static_cast<GestureEvent*>(EventDispatchMediator::event());
+ return toGestureEvent(EventDispatchMediator::event());
}
bool GestureEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
diff --git a/Source/core/dom/GestureEvent.h b/Source/core/dom/GestureEvent.h
index a0d6f2edd..b630ae934 100644
--- a/Source/core/dom/GestureEvent.h
+++ b/Source/core/dom/GestureEvent.h
@@ -41,6 +41,8 @@ public:
void initGestureEvent(const AtomicString& type, PassRefPtr<AbstractView>, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY);
+ virtual bool isGestureEvent() const OVERRIDE;
+
virtual const AtomicString& interfaceName() const;
float deltaX() const { return m_deltaX; }
@@ -69,6 +71,12 @@ private:
virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
};
+inline GestureEvent* toGestureEvent(Event* event)
+{
+ ASSERT(event && event->isGestureEvent());
+ return static_cast<GestureEvent*>(event);
+}
+
} // namespace WebCore
#endif // GestureEvent_h
diff --git a/Source/web/WebPluginContainerImpl.cpp b/Source/web/WebPluginContainerImpl.cpp
index 1b86221c8..beaf7dd85 100644
--- a/Source/web/WebPluginContainerImpl.cpp
+++ b/Source/web/WebPluginContainerImpl.cpp
@@ -194,8 +194,8 @@ void WebPluginContainerImpl::handleEvent(Event* event)
handleKeyboardEvent(toKeyboardEvent(event));
else if (event->isTouchEvent())
handleTouchEvent(static_cast<TouchEvent*>(event));
- else if (eventNames().isGestureEventType(event->type()))
- handleGestureEvent(static_cast<GestureEvent*>(event));
+ else if (event->isGestureEvent())
+ handleGestureEvent(toGestureEvent(event));
// FIXME: it would be cleaner if Widget::handleEvent returned true/false and
// HTMLPluginElement called setDefaultHandled or defaultEventHandler.