From 5b9b4d4efe739cfa2aa117372879c5c37443e644 Mon Sep 17 00:00:00 2001 From: Grace Kloba Date: Tue, 2 Feb 2010 19:08:37 -0800 Subject: Pass touch event time from Java to WebKit --- WebCore/dom/Event.h | 4 ++++ WebCore/page/EventHandler.cpp | 1 + WebCore/platform/PlatformTouchEvent.h | 5 ++++- WebCore/plugins/android/PluginViewAndroid.cpp | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) (limited to 'WebCore') diff --git a/WebCore/dom/Event.h b/WebCore/dom/Event.h index 7ec85a7..4774ccb 100644 --- a/WebCore/dom/Event.h +++ b/WebCore/dom/Event.h @@ -153,6 +153,10 @@ namespace WebCore { bool createdByDOM() const { return m_createdByDOM; } void setCreatedByDOM(bool createdByDOM) { m_createdByDOM = createdByDOM; } +#if PLATFORM(ANDROID) + void setCreateTime(DOMTimeStamp time) { m_createTime = time; } +#endif + protected: Event(); Event(const AtomicString& type, bool canBubble, bool cancelable); diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index 8b6b602..d0ca86b 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -2659,6 +2659,7 @@ int EventHandler::handleTouchEvent(const PlatformTouchEvent& e) default: return false; } + te->setCreateTime(static_cast(e.eventTime())); ExceptionCode ec = 0; m_touch->target()->dispatchEvent(te.get(), ec); if (type == TouchEventEnd || type == TouchEventCancel) diff --git a/WebCore/platform/PlatformTouchEvent.h b/WebCore/platform/PlatformTouchEvent.h index 6c8629c..320dbbd 100644 --- a/WebCore/platform/PlatformTouchEvent.h +++ b/WebCore/platform/PlatformTouchEvent.h @@ -41,10 +41,11 @@ namespace WebCore { { } - PlatformTouchEvent(const IntPoint& pos, const IntPoint& globalPos, TouchEventType eventType) + PlatformTouchEvent(const IntPoint& pos, const IntPoint& globalPos, TouchEventType eventType, long eventTime) : m_position(pos) , m_globalPosition(globalPos) , m_eventType(eventType) + , m_eventTime(eventTime) { } @@ -54,11 +55,13 @@ namespace WebCore { int globalX() const { return m_globalPosition.x(); } int globalY() const { return m_globalPosition.y(); } TouchEventType eventType() const { return m_eventType; } + long eventTime() const { return m_eventTime; } private: IntPoint m_position; IntPoint m_globalPosition; TouchEventType m_eventType; + long m_eventTime; }; } // namespace WebCore diff --git a/WebCore/plugins/android/PluginViewAndroid.cpp b/WebCore/plugins/android/PluginViewAndroid.cpp index ed7a694..0317ed6 100644 --- a/WebCore/plugins/android/PluginViewAndroid.cpp +++ b/WebCore/plugins/android/PluginViewAndroid.cpp @@ -183,7 +183,7 @@ void PluginView::handleTouchEvent(TouchEvent* event) return; ANPEvent evt; - SkANP::InitEvent(&evt, kTouch_ANPEventType); + SkANP::InitEvent(&evt, kTouch_ANPEventType, event->timeStamp()); bool ignoreRet = false; const AtomicString& type = event->type(); -- cgit v1.1