[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 00:32:19 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 27c15777a42bd8d4a892518a7520889167b7506f
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 11 14:07:49 2009 +0000

    2009-12-11  Simon Hausmann  <hausmann at webkit.org>, Kim Grönholm  <kim.gronholm at nomovok.com>
    
            Reviewed by Antti Koivisto.
    
            Added interfaces for touch event support in JavaScript.
    
            https://bugs.webkit.org/show_bug.cgi?id=32114
    
            The Touch, TouchEvent and TouchList interfaces come straight from
            Android's copy of WebKit (eclaire branch).
    
            The PlatformTouchEvent and PlatformTouchPoint code was written by
            us.
    
            No new tests added, we are just adding interfaces
            with this patch.
    
            * WebCore.pro:
            * bindings/js/JSEventCustom.cpp:
            (WebCore::toJS):
            * dom/Document.cpp:
            (WebCore::Document::addListenerTypeIfNeeded):
            * dom/Document.h:
            (WebCore::Document::):
            * dom/Document.idl:
            * dom/Element.h:
            * dom/Element.idl:
            * dom/Event.cpp:
            (WebCore::Event::isTouchEvent):
            * dom/Event.h:
            * dom/EventNames.h:
            * dom/Touch.cpp: Added.
            (WebCore::contentsX):
            (WebCore::contentsY):
            (WebCore::Touch::Touch):
            (WebCore::Touch::updateLocation):
            * dom/Touch.h: Added.
            (WebCore::Touch::create):
            (WebCore::Touch::frame):
            (WebCore::Touch::target):
            (WebCore::Touch::identifier):
            (WebCore::Touch::clientX):
            (WebCore::Touch::clientY):
            (WebCore::Touch::screenX):
            (WebCore::Touch::screenY):
            (WebCore::Touch::pageX):
            (WebCore::Touch::pageY):
            * dom/Touch.idl: Added.
            * dom/TouchEvent.cpp: Added.
            (WebCore::TouchEvent::TouchEvent):
            (WebCore::TouchEvent::initTouchEvent):
            * dom/TouchEvent.h: Added.
            (WebCore::TouchEvent::create):
            (WebCore::TouchEvent::touches):
            (WebCore::TouchEvent::targetTouches):
            (WebCore::TouchEvent::changedTouches):
            (WebCore::TouchEvent::TouchEvent):
            (WebCore::TouchEvent::isTouchEvent):
            * dom/TouchEvent.idl: Added.
            * dom/TouchList.cpp: Added.
            (WebCore::TouchList::item):
            * dom/TouchList.h: Added.
            (WebCore::TouchList::create):
            (WebCore::TouchList::length):
            (WebCore::TouchList::append):
            (WebCore::TouchList::TouchList):
            * dom/TouchList.idl: Added.
            * html/HTMLAttributeNames.in:
            * html/HTMLElement.cpp:
            (WebCore::HTMLElement::parseMappedAttribute):
            * page/DOMWindow.h:
            * page/DOMWindow.idl:
            * platform/PlatformTouchEvent.h: Added.
            (WebCore::PlatformTouchEvent::PlatformTouchEvent):
            (WebCore::PlatformTouchEvent::touchPoints):
            * platform/PlatformTouchPoint.h: Added.
            (WebCore::PlatformTouchPoint::):
            (WebCore::PlatformTouchPoint::id):
            (WebCore::PlatformTouchPoint::state):
            (WebCore::PlatformTouchPoint::screenPos):
            (WebCore::PlatformTouchPoint::pos):
            * platform/qt/PlatformTouchEventQt.cpp: Added.
            (WebCore::PlatformTouchEvent::PlatformTouchEvent):
            * platform/qt/PlatformTouchPointQt.cpp: Added.
            (WebCore::PlatformTouchPoint::PlatformTouchPoint):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51981 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f43f368..73a0bda 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,89 @@
+2009-12-11  Simon Hausmann  <hausmann at webkit.org>, Kim Grönholm  <kim.gronholm at nomovok.com>
+
+        Reviewed by Antti Koivisto.
+
+        Added interfaces for touch event support in JavaScript.
+
+        https://bugs.webkit.org/show_bug.cgi?id=32114
+
+        The Touch, TouchEvent and TouchList interfaces come straight from
+        Android's copy of WebKit (eclaire branch).
+
+        The PlatformTouchEvent and PlatformTouchPoint code was written by
+        us.
+
+        No new tests added, we are just adding interfaces
+        with this patch.
+
+        * WebCore.pro:
+        * bindings/js/JSEventCustom.cpp:
+        (WebCore::toJS):
+        * dom/Document.cpp:
+        (WebCore::Document::addListenerTypeIfNeeded):
+        * dom/Document.h:
+        (WebCore::Document::):
+        * dom/Document.idl:
+        * dom/Element.h:
+        * dom/Element.idl:
+        * dom/Event.cpp:
+        (WebCore::Event::isTouchEvent):
+        * dom/Event.h:
+        * dom/EventNames.h:
+        * dom/Touch.cpp: Added.
+        (WebCore::contentsX):
+        (WebCore::contentsY):
+        (WebCore::Touch::Touch):
+        (WebCore::Touch::updateLocation):
+        * dom/Touch.h: Added.
+        (WebCore::Touch::create):
+        (WebCore::Touch::frame):
+        (WebCore::Touch::target):
+        (WebCore::Touch::identifier):
+        (WebCore::Touch::clientX):
+        (WebCore::Touch::clientY):
+        (WebCore::Touch::screenX):
+        (WebCore::Touch::screenY):
+        (WebCore::Touch::pageX):
+        (WebCore::Touch::pageY):
+        * dom/Touch.idl: Added.
+        * dom/TouchEvent.cpp: Added.
+        (WebCore::TouchEvent::TouchEvent):
+        (WebCore::TouchEvent::initTouchEvent):
+        * dom/TouchEvent.h: Added.
+        (WebCore::TouchEvent::create):
+        (WebCore::TouchEvent::touches):
+        (WebCore::TouchEvent::targetTouches):
+        (WebCore::TouchEvent::changedTouches):
+        (WebCore::TouchEvent::TouchEvent):
+        (WebCore::TouchEvent::isTouchEvent):
+        * dom/TouchEvent.idl: Added.
+        * dom/TouchList.cpp: Added.
+        (WebCore::TouchList::item):
+        * dom/TouchList.h: Added.
+        (WebCore::TouchList::create):
+        (WebCore::TouchList::length):
+        (WebCore::TouchList::append):
+        (WebCore::TouchList::TouchList):
+        * dom/TouchList.idl: Added.
+        * html/HTMLAttributeNames.in:
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::parseMappedAttribute):
+        * page/DOMWindow.h:
+        * page/DOMWindow.idl:
+        * platform/PlatformTouchEvent.h: Added.
+        (WebCore::PlatformTouchEvent::PlatformTouchEvent):
+        (WebCore::PlatformTouchEvent::touchPoints):
+        * platform/PlatformTouchPoint.h: Added.
+        (WebCore::PlatformTouchPoint::):
+        (WebCore::PlatformTouchPoint::id):
+        (WebCore::PlatformTouchPoint::state):
+        (WebCore::PlatformTouchPoint::screenPos):
+        (WebCore::PlatformTouchPoint::pos):
+        * platform/qt/PlatformTouchEventQt.cpp: Added.
+        (WebCore::PlatformTouchEvent::PlatformTouchEvent):
+        * platform/qt/PlatformTouchPointQt.cpp: Added.
+        (WebCore::PlatformTouchPoint::PlatformTouchPoint):
+
 2009-12-11  Grace Kloba  <klobag at gmail.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index bfeee61..d8fd0b2 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -181,6 +181,9 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) {
 
 DEFINES += WTF_CHANGES=1
 
+# Enable touch event support with Qt 4.6
+!lessThan(QT_MINOR_VERSION, 6): DEFINES += ENABLE_TOUCH_EVENTS=1
+
 # Used to compute defaults for the build-webkit script
 CONFIG(compute_defaults) {
     message($$DEFINES)
@@ -367,6 +370,9 @@ IDL_BINDINGS += \
     dom/Range.idl \
     dom/Text.idl \
     dom/TextEvent.idl \
+    dom/Touch.idl \
+    dom/TouchEvent.idl \
+    dom/TouchList.idl \
     dom/TreeWalker.idl \
     dom/UIEvent.idl \
     dom/WebKitAnimationEvent.idl \
@@ -921,6 +927,9 @@ SOURCES += \
     dom/TagNodeList.cpp \
     dom/Text.cpp \
     dom/TextEvent.cpp \
+    dom/Touch.cpp \
+    dom/TouchEvent.cpp \
+    dom/TouchList.cpp \
     dom/Traversal.cpp \
     dom/TreeWalker.cpp \
     dom/UIEvent.cpp \
@@ -1605,6 +1614,9 @@ HEADERS += \
     dom/TagNodeList.h \
     dom/TextEvent.h \
     dom/Text.h \
+    dom/Touch.h \
+    dom/TouchEvent.h \
+    dom/TouchList.h \
     dom/TransformSource.h \
     dom/Traversal.h \
     dom/TreeWalker.h \
@@ -1949,6 +1961,8 @@ HEADERS += \
     platform/network/ResourceHandle.h \
     platform/network/ResourceRequestBase.h \
     platform/network/ResourceResponseBase.h \
+    platform/PlatformTouchEvent.h \
+    platform/PlatformTouchPoint.h \
     platform/qt/ClipboardQt.h \
     platform/qt/QWebPageClient.h \
     platform/qt/QWebPopup.h \
@@ -2407,6 +2421,8 @@ SOURCES += \
     platform/qt/PlatformKeyboardEventQt.cpp \
     platform/qt/PlatformMouseEventQt.cpp \
     platform/qt/PlatformScreenQt.cpp \
+    platform/qt/PlatformTouchEventQt.cpp \
+    platform/qt/PlatformTouchPointQt.cpp \
     platform/qt/PopupMenuQt.cpp \
     platform/qt/QWebPopup.cpp \
     platform/qt/RenderThemeQt.cpp \
@@ -2555,6 +2571,10 @@ contains(DEFINES, ENABLE_EVENTSOURCE=1) {
     FEATURE_DEFINES_JAVASCRIPT += ENABLE_EVENTSOURCE=1
 }
 
+contains(DEFINES, ENABLE_TOUCH_EVENTS=1) {
+    FEATURE_DEFINES_JAVASCRIPT += ENABLE_TOUCH_EVENTS=1
+}
+
 contains(DEFINES, ENABLE_SQLITE=1) {
     !system-sqlite:exists( $${SQLITE3SRCDIR}/sqlite3.c ) {
             # Build sqlite3 into WebCore from source
diff --git a/WebCore/bindings/js/JSEventCustom.cpp b/WebCore/bindings/js/JSEventCustom.cpp
index 85a7a95..04ceec5 100644
--- a/WebCore/bindings/js/JSEventCustom.cpp
+++ b/WebCore/bindings/js/JSEventCustom.cpp
@@ -78,6 +78,11 @@
 #include "SVGZoomEvent.h"
 #endif
 
+#if ENABLE(TOUCH_EVENTS)
+#include "JSTouchEvent.h"
+#include "TouchEvent.h"
+#endif
+
 using namespace JSC;
 
 namespace WebCore {
@@ -113,6 +118,10 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Event* event)
 #endif
         else if (event->isCompositionEvent())
             wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, CompositionEvent, event);
+#if ENABLE(TOUCH_EVENTS)
+        else if (event->isTouchEvent())
+            wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, TouchEvent, event);
+#endif
         else
             wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, UIEvent, event);
     } else if (event->isMutationEvent())
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 428cbd2..9d6af06 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -2977,6 +2977,10 @@ void Document::addListenerTypeIfNeeded(const AtomicString& eventType)
         addListenerType(TRANSITIONEND_LISTENER);
     else if (eventType == eventNames().beforeloadEvent)
         addListenerType(BEFORELOAD_LISTENER);
+    else if (eventType == eventNames().touchstartEvent
+             || eventType == eventNames().touchmoveEvent
+             || eventType == eventNames().touchendEvent)
+        addListenerType(TOUCH_LISTENER);
 }
 
 CSSStyleDeclaration* Document::getOverrideStyle(Element*, const String&)
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index 37dafc9..0f108e9 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -252,6 +252,11 @@ public:
     DEFINE_ATTRIBUTE_EVENT_LISTENER(reset);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(search);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(selectstart);
+#if ENABLE(TOUCH_EVENTS)
+    DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart);
+    DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove);
+    DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend);
+#endif
 
     DocumentType* doctype() const { return m_docType.get(); }
 
@@ -620,7 +625,8 @@ public:
         ANIMATIONSTART_LISTENER              = 0x200,
         ANIMATIONITERATION_LISTENER          = 0x400,
         TRANSITIONEND_LISTENER               = 0x800,
-        BEFORELOAD_LISTENER                  = 0x1000
+        BEFORELOAD_LISTENER                  = 0x1000,
+        TOUCH_LISTENER                       = 0x2000
     };
 
     bool hasListenerType(ListenerType listenerType) const { return (m_listenerTypes & listenerType); }
diff --git a/WebCore/dom/Document.idl b/WebCore/dom/Document.idl
index 210f5ff..51d0bfe 100644
--- a/WebCore/dom/Document.idl
+++ b/WebCore/dom/Document.idl
@@ -320,6 +320,11 @@ module core {
         attribute [DontEnum] EventListener onreset;
         attribute [DontEnum] EventListener onsearch;
         attribute [DontEnum] EventListener onselectstart;
+#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
+        attribute [DontEnum] EventListener ontouchstart;
+        attribute [DontEnum] EventListener ontouchmove;
+        attribute [DontEnum] EventListener ontouchend;
+#endif
 #endif
 #endif
     };
diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h
index 97d3eb4..1f025e8 100644
--- a/WebCore/dom/Element.h
+++ b/WebCore/dom/Element.h
@@ -88,6 +88,11 @@ public:
     DEFINE_ATTRIBUTE_EVENT_LISTENER(reset);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(search);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(selectstart);
+#if ENABLE(TOUCH_EVENTS)
+    DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart);
+    DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove);
+    DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend);
+#endif
 
     const AtomicString& getIDAttribute() const;
     bool hasAttribute(const QualifiedName&) const;
diff --git a/WebCore/dom/Element.idl b/WebCore/dom/Element.idl
index d90f819..59bf86a 100644
--- a/WebCore/dom/Element.idl
+++ b/WebCore/dom/Element.idl
@@ -203,6 +203,11 @@ module core {
         attribute [DontEnum] EventListener onreset;
         attribute [DontEnum] EventListener onsearch;
         attribute [DontEnum] EventListener onselectstart;
+#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
+        attribute [DontEnum] EventListener ontouchstart;
+        attribute [DontEnum] EventListener ontouchmove;
+        attribute [DontEnum] EventListener ontouchend;
+#endif
 #endif
 #endif
     };
diff --git a/WebCore/dom/Event.cpp b/WebCore/dom/Event.cpp
index ed1140a..be2b37b 100644
--- a/WebCore/dom/Event.cpp
+++ b/WebCore/dom/Event.cpp
@@ -186,7 +186,14 @@ bool Event::isErrorEvent() const
     return false;
 }
 #endif
-    
+
+#if ENABLE(TOUCH_EVENTS)
+bool Event::isTouchEvent() const
+{
+    return false;
+}
+#endif
+
 bool Event::storesResultAsString() const
 {
     return false;
diff --git a/WebCore/dom/Event.h b/WebCore/dom/Event.h
index ec768e9..4624663 100644
--- a/WebCore/dom/Event.h
+++ b/WebCore/dom/Event.h
@@ -126,6 +126,9 @@ namespace WebCore {
 #if ENABLE(WORKERS)
         virtual bool isErrorEvent() const;
 #endif
+#if ENABLE(TOUCH_EVENTS)
+        virtual bool isTouchEvent() const;
+#endif
         
         bool propagationStopped() const { return m_propagationStopped; }
 
diff --git a/WebCore/dom/EventNames.h b/WebCore/dom/EventNames.h
index 8c3e3e4..08af753 100644
--- a/WebCore/dom/EventNames.h
+++ b/WebCore/dom/EventNames.h
@@ -146,6 +146,10 @@ namespace WebCore {
     \
     macro(orientationchange) \
     \
+    macro(touchstart) \
+    macro(touchmove) \
+    macro(touchend) \
+    \
 // end of DOM_EVENT_NAMES_FOR_EACH
 
     class EventNames : public Noncopyable {
diff --git a/WebCore/dom/Touch.cpp b/WebCore/dom/Touch.cpp
new file mode 100644
index 0000000..6dd2b8e
--- /dev/null
+++ b/WebCore/dom/Touch.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include "Touch.h"
+
+#include "FrameView.h"
+
+namespace WebCore {
+
+static int contentsX(Frame* frame)
+{
+    if (!frame)
+        return 0;
+    FrameView* frameView = frame->view();
+    if (!frameView)
+        return 0;
+    return frameView->scrollX();
+}
+
+static int contentsY(Frame* frame)
+{
+    if (!frame)
+        return 0;
+    FrameView* frameView = frame->view();
+    if (!frameView)
+        return 0;
+    return frameView->scrollY();
+}
+
+Touch::Touch(Frame* frame, EventTarget* target, unsigned identifier, 
+        int screenX, int screenY, int pageX, int pageY)
+    : m_frame(frame)
+    , m_target(target)
+    , m_identifier(identifier)
+    , m_clientX(pageX - contentsX(m_frame.get()))
+    , m_clientY(pageY - contentsY(m_frame.get()))
+    , m_screenX(screenX)
+    , m_screenY(screenY)
+    , m_pageX(pageX)
+    , m_pageY(pageY)
+{
+}
+
+void Touch::updateLocation(int screenX, int screenY, int pageX, int pageY)
+{
+    m_clientX = pageX - contentsX(m_frame.get());
+    m_clientY = pageY - contentsY(m_frame.get());
+    m_screenX = screenX;
+    m_screenY = screenY;
+    m_pageX = pageX;
+    m_pageY = pageY;
+}
+
+} // namespace WebCore
+
+#endif
+
diff --git a/WebCore/dom/Touch.h b/WebCore/dom/Touch.h
new file mode 100644
index 0000000..cf39faf
--- /dev/null
+++ b/WebCore/dom/Touch.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TOUCH_H_
+#define TOUCH_H_
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include "EventTarget.h"
+#include "Frame.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class Touch : public RefCounted<Touch> {
+public:
+    static PassRefPtr<Touch> create(Frame* frame, EventTarget* target,
+            unsigned identifier, int screenX, int screenY, int pageX, int pageY)
+    {
+        return adoptRef(new Touch(frame, target, identifier, screenX, 
+                screenY, pageX, pageY));
+    }
+
+    void updateLocation(int screenX, int screenY, int pageX, int pageY);
+
+    Frame* frame() const { return m_frame.get(); }
+    EventTarget* target() const { return m_target.get(); }
+    unsigned identifier() const { return m_identifier; }
+    int clientX() const { return m_clientX; }
+    int clientY() const { return m_clientY; }
+    int screenX() const { return m_screenX; }
+    int screenY() const { return m_screenY; }
+    int pageX() const { return m_pageX; }
+    int pageY() const { return m_pageY; }
+
+private:
+    Touch(Frame* frame, EventTarget* target, unsigned identifier,
+            int screenX, int screenY, int pageX, int pageY);
+
+    RefPtr<Frame> m_frame;
+    RefPtr<EventTarget> m_target;
+    unsigned m_identifier;
+    int m_clientX;
+    int m_clientY;
+    int m_screenX;
+    int m_screenY;
+    int m_pageX;
+    int m_pageY;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(TOUCH_EVENTS)
+
+#endif /* TOUCH_H_ */
diff --git a/WebCore/dom/Touch.idl b/WebCore/dom/Touch.idl
new file mode 100644
index 0000000..29bf18d
--- /dev/null
+++ b/WebCore/dom/Touch.idl
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module events {
+
+    interface [
+        Conditional=TOUCH_EVENTS,
+        GenerateConstructor
+    ] Touch {
+        readonly attribute long             clientX;
+        readonly attribute long             clientY;
+        readonly attribute long             screenX;
+        readonly attribute long             screenY;
+        readonly attribute long             pageX;
+        readonly attribute long             pageY;
+        readonly attribute EventTarget      target;
+        readonly attribute unsigned long    identifier;
+    };
+}
diff --git a/WebCore/dom/TouchEvent.cpp b/WebCore/dom/TouchEvent.cpp
new file mode 100644
index 0000000..54fff1e
--- /dev/null
+++ b/WebCore/dom/TouchEvent.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include "TouchEvent.h"
+
+namespace WebCore {
+
+TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches,
+        TouchList* changedTouches, const AtomicString& type, 
+        PassRefPtr<AbstractView> view, int screenX, int screenY, int pageX, int pageY)
+    : MouseRelatedEvent(type, true, true, view, 0, screenX, screenY, pageX, pageY,
+                        false, false, false, false)
+    , m_touches(touches)
+    , m_targetTouches(targetTouches)
+    , m_changedTouches(changedTouches)
+{
+}
+
+void TouchEvent::initTouchEvent(TouchList* touches, TouchList* targetTouches,
+        TouchList* changedTouches, const AtomicString& type, 
+        PassRefPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY)
+{
+    if (dispatched())
+        return;
+
+    initUIEvent(type, true, true, view, 0);
+
+    m_screenX = screenX;
+    m_screenY = screenY;
+    initCoordinates(clientX, clientY);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(TOUCH_EVENTS)
diff --git a/WebCore/dom/TouchEvent.h b/WebCore/dom/TouchEvent.h
new file mode 100644
index 0000000..c5fcebd
--- /dev/null
+++ b/WebCore/dom/TouchEvent.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TouchEvent_h
+#define TouchEvent_h
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include "MouseRelatedEvent.h"
+#include "TouchList.h"
+
+namespace WebCore {
+
+class TouchEvent : public MouseRelatedEvent {
+public:
+    static PassRefPtr<TouchEvent> create()
+    {
+        return adoptRef(new TouchEvent);
+    }
+    static PassRefPtr<TouchEvent> create(TouchList* touches, 
+            TouchList* targetTouches, TouchList* changedTouches, 
+            const AtomicString& type, PassRefPtr<AbstractView> view,
+            int screenX, int screenY, int pageX, int pageY)
+    {
+        return adoptRef(new TouchEvent(touches, targetTouches, changedTouches,
+                type, view, screenX, screenY, pageX, pageY));
+    }
+
+    void initTouchEvent(TouchList* touches, TouchList* targetTouches,
+            TouchList* changedTouches, const AtomicString& type, 
+            PassRefPtr<AbstractView> view, int screenX, int screenY, 
+            int clientX, int clientY);
+
+    TouchList* touches() const { return m_touches.get(); }
+    TouchList* targetTouches() const { return m_targetTouches.get(); }
+    TouchList* changedTouches() const { return m_changedTouches.get(); }
+
+private:
+    TouchEvent() {}
+    TouchEvent(TouchList* touches, TouchList* targetTouches,
+            TouchList* changedTouches, const AtomicString& type,
+            PassRefPtr<AbstractView>, int screenX, int screenY, int pageX,
+            int pageY);
+
+    virtual bool isTouchEvent() const { return true; }
+
+    RefPtr<TouchList> m_touches;
+    RefPtr<TouchList> m_targetTouches;
+    RefPtr<TouchList> m_changedTouches;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(TOUCH_EVENTS)
+
+#endif // TouchEvent_h
diff --git a/WebCore/dom/TouchEvent.idl b/WebCore/dom/TouchEvent.idl
new file mode 100644
index 0000000..b7148b0
--- /dev/null
+++ b/WebCore/dom/TouchEvent.idl
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module events {
+
+    interface [
+        Conditional=TOUCH_EVENTS,
+        GenerateConstructor
+    ] TouchEvent : UIEvent {
+        readonly attribute TouchList touches;
+        readonly attribute TouchList targetTouches;
+        readonly attribute TouchList changedTouches;
+
+        void initTouchEvent(in TouchList touches,
+                            in TouchList targetTouches,
+                            in TouchList changedTouches,
+                            in DOMString type,
+                            in DOMWindow view,
+                            in long screenX, 
+                            in long screenY, 
+                            in long clientX, 
+                            in long clientY);
+    };
+}
diff --git a/WebCore/dom/TouchList.cpp b/WebCore/dom/TouchList.cpp
new file mode 100644
index 0000000..4167e42
--- /dev/null
+++ b/WebCore/dom/TouchList.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include "TouchList.h"
+
+namespace WebCore {
+
+Touch* TouchList::item(unsigned index)
+{
+    if (index >= m_values.size())
+        return 0;
+    return m_values[index].get();
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/dom/TouchList.h b/WebCore/dom/TouchList.h
new file mode 100644
index 0000000..61350b0
--- /dev/null
+++ b/WebCore/dom/TouchList.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TOUCHLIST_H_
+#define TOUCHLIST_H_
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include "Touch.h"
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class TouchList : public RefCounted<TouchList> {
+public:
+    static PassRefPtr<TouchList> create()
+    {
+        return adoptRef(new TouchList);
+    }
+
+    unsigned length() const { return m_values.size(); }
+
+    Touch* item(unsigned);
+
+    void append(const PassRefPtr<Touch> touch) { m_values.append(touch); }
+
+private:
+    TouchList() {}
+
+    Vector<RefPtr<Touch> > m_values;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(TOUCH_EVENTS)
+
+#endif /* TOUCHLIST_H_ */
diff --git a/WebCore/dom/TouchList.idl b/WebCore/dom/TouchList.idl
new file mode 100644
index 0000000..c2aa58a
--- /dev/null
+++ b/WebCore/dom/TouchList.idl
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module events {
+
+    interface [
+        Conditional=TOUCH_EVENTS,
+        GenerateConstructor,
+        HasIndexGetter
+    ] TouchList {
+        readonly attribute unsigned long length;
+
+        Touch item(in unsigned long index);
+    };
+}
diff --git a/WebCore/html/HTMLAttributeNames.in b/WebCore/html/HTMLAttributeNames.in
index f91adad..420d6a7 100644
--- a/WebCore/html/HTMLAttributeNames.in
+++ b/WebCore/html/HTMLAttributeNames.in
@@ -199,6 +199,9 @@ onstorage
 onsuspend
 onsubmit
 ontimeupdate
+ontouchstart
+ontouchmove
+ontouchend
 onunload
 onvolumechange
 onwaiting
diff --git a/WebCore/html/HTMLElement.cpp b/WebCore/html/HTMLElement.cpp
index df3cb7d..cb6282f 100644
--- a/WebCore/html/HTMLElement.cpp
+++ b/WebCore/html/HTMLElement.cpp
@@ -222,6 +222,12 @@ void HTMLElement::parseMappedAttribute(MappedAttribute *attr)
         setAttributeEventListener(eventNames().inputEvent, createAttributeEventListener(this, attr));
     } else if (attr->name() == oninvalidAttr) {
         setAttributeEventListener(eventNames().invalidEvent, createAttributeEventListener(this, attr));
+    } else if (attr->name() == ontouchstartAttr) {
+        setAttributeEventListener(eventNames().touchstartEvent, createAttributeEventListener(this, attr));
+    } else if (attr->name() == ontouchmoveAttr) {
+        setAttributeEventListener(eventNames().touchmoveEvent, createAttributeEventListener(this, attr));
+    } else if (attr->name() == ontouchendAttr) {
+        setAttributeEventListener(eventNames().touchendEvent, createAttributeEventListener(this, attr));
     }
 }
 
diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h
index 146f390..ebc46fd 100644
--- a/WebCore/page/DOMWindow.h
+++ b/WebCore/page/DOMWindow.h
@@ -322,6 +322,11 @@ namespace WebCore {
         DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, webkitAnimationEnd);
         DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend, webkitTransitionEnd);
 
+#if ENABLE(TOUCH_EVENTS)
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend);
+#endif
         void captureEvents();
         void releaseEvents();
 
diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl
index ea71951..5fa6d00 100644
--- a/WebCore/page/DOMWindow.idl
+++ b/WebCore/page/DOMWindow.idl
@@ -289,6 +289,11 @@ module window {
 #if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS
         attribute EventListener onorientationchange;
 #endif
+ #if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
+        attribute [DontEnum] EventListener ontouchstart;
+        attribute [DontEnum] EventListener ontouchmove;
+        attribute [DontEnum] EventListener ontouchend;
+ #endif
 
         // EventTarget interface
         [Custom] void addEventListener(in DOMString type,
@@ -566,6 +571,10 @@ module window {
 #endif
 #endif
 
+#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
+        attribute TouchEventConstructor TouchEvent;
+#endif
+
 #endif // defined(LANGUAGE_JAVASCRIPT)
 
 #if defined(V8_BINDING) && V8_BINDING
diff --git a/WebCore/platform/PlatformTouchEvent.h b/WebCore/platform/PlatformTouchEvent.h
new file mode 100644
index 0000000..0d38f8a
--- /dev/null
+++ b/WebCore/platform/PlatformTouchEvent.h
@@ -0,0 +1,57 @@
+/*
+    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef PlatformTouchEvent_h
+#define PlatformTouchEvent_h
+
+#include "PlatformTouchPoint.h"
+#include <wtf/Vector.h>
+
+#if ENABLE(TOUCH_EVENTS)
+
+#if PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QTouchEvent;
+QT_END_NAMESPACE
+#endif
+
+namespace WebCore {
+
+enum TouchEventType { TouchStart, TouchMove, TouchEnd };
+
+class PlatformTouchEvent {
+public:
+    PlatformTouchEvent() : m_type(TouchStart) {}
+#if PLATFORM(QT)
+    PlatformTouchEvent(QTouchEvent*);
+#endif
+
+    TouchEventType type() const { return m_type; }
+    const Vector<PlatformTouchPoint>& touchPoints() const { return m_touchPoints; }
+
+private:
+    TouchEventType m_type;
+    Vector<PlatformTouchPoint> m_touchPoints;
+};
+
+}
+
+#endif // ENABLE(TOUCH_EVENTS)
+
+#endif // PlatformTouchEvent_h
diff --git a/WebCore/platform/PlatformTouchPoint.h b/WebCore/platform/PlatformTouchPoint.h
new file mode 100644
index 0000000..350653d
--- /dev/null
+++ b/WebCore/platform/PlatformTouchPoint.h
@@ -0,0 +1,66 @@
+/*
+    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef PlatformTouchPoint_h
+#define PlatformTouchPoint_h
+
+#include "IntPoint.h"
+#include <wtf/Platform.h>
+#include <wtf/Vector.h>
+
+#if ENABLE(TOUCH_EVENTS)
+
+#if PLATFORM(QT)
+#include <QTouchEvent>
+#endif
+
+namespace WebCore {
+
+class PlatformTouchEvent;
+
+class PlatformTouchPoint {
+public:
+    enum State {
+        TouchReleased,
+        TouchPressed,
+        TouchMoved,
+        TouchStationary
+    };
+
+#if PLATFORM(QT)
+    PlatformTouchPoint(const QTouchEvent::TouchPoint&);
+#endif
+
+    int id() const { return m_id; }
+    State state() const { return m_state; }
+    IntPoint screenPos() const { return m_screenPos; }
+    IntPoint pos() const { return m_pos; }
+    
+private:
+    int m_id;
+    State m_state;
+    IntPoint m_screenPos;
+    IntPoint m_pos;
+};
+
+}
+
+#endif // ENABLE(TOUCH_EVENTS)
+
+#endif // PlatformTouchPoint_h
diff --git a/WebCore/platform/qt/PlatformTouchEventQt.cpp b/WebCore/platform/qt/PlatformTouchEventQt.cpp
new file mode 100644
index 0000000..b329b14
--- /dev/null
+++ b/WebCore/platform/qt/PlatformTouchEventQt.cpp
@@ -0,0 +1,44 @@
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "PlatformTouchEvent.h"
+
+#if ENABLE(TOUCH_EVENTS)
+
+namespace WebCore {
+
+PlatformTouchEvent::PlatformTouchEvent(QTouchEvent* event)
+{
+    switch (event->type()) {
+    case QEvent::TouchBegin: m_type = TouchStart; break;
+    case QEvent::TouchUpdate: m_type = TouchMove; break;
+    case QEvent::TouchEnd: m_type = TouchEnd; break;
+    }
+    const QList<QTouchEvent::TouchPoint>& points = event->touchPoints();
+    for (int i = 0; i < points.count(); ++i)
+        m_touchPoints.append(PlatformTouchPoint(points.at(i)));
+}
+
+}
+
+#endif
diff --git a/WebCore/platform/qt/PlatformTouchPointQt.cpp b/WebCore/platform/qt/PlatformTouchPointQt.cpp
new file mode 100644
index 0000000..1788cef
--- /dev/null
+++ b/WebCore/platform/qt/PlatformTouchPointQt.cpp
@@ -0,0 +1,45 @@
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "PlatformTouchPoint.h"
+
+#if ENABLE(TOUCH_EVENTS)
+
+namespace WebCore {
+
+PlatformTouchPoint::PlatformTouchPoint(const QTouchEvent::TouchPoint& point)
+{
+    m_id = point.id();
+    switch (point.state()) {
+    case Qt::TouchPointReleased: m_state = TouchReleased; break;
+    case Qt::TouchPointMoved: m_state = TouchMoved; break;
+    case Qt::TouchPointPressed: m_state = TouchPressed; break;
+    case Qt::TouchPointStationary: m_state = TouchStationary; break;
+    }
+    m_screenPos = point.screenPos().toPoint();
+    m_pos = point.pos().toPoint();
+}
+
+}
+
+#endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list