[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

benm at google.com benm at google.com
Wed Dec 22 14:45:16 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b08424cc68784b955ed03a7c91fe486500f9f5ed
Author: benm at google.com <benm at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 19 11:50:02 2010 +0000

    2010-10-19  Ben Murdoch  <benm at google.com>
    
            Reviewed by Steve Block.
    
            Missing support for document.createTouch and document.createTouchList
            https://bugs.webkit.org/show_bug.cgi?id=47676
    
            Add tests to verify the presence of the APIs and that they work correctly.
    
            * fast/events/touch/document-create-touch-expected.txt: Added.
            * fast/events/touch/document-create-touch-list-expected.txt: Added.
            * fast/events/touch/document-create-touch-list.html: Added.
            * fast/events/touch/document-create-touch.html: Added.
            * fast/events/touch/script-tests/document-create-touch-list.js: Added.
            * fast/events/touch/script-tests/document-create-touch.js: Added.
    2010-10-19  Ben Murdoch  <benm at google.com>
    
            Reviewed by Steve Block.
    
            Missing support for document.createTouch and document.createTouchList
            https://bugs.webkit.org/show_bug.cgi?id=47676
    
            These APIs are used by many sites to detect support for touch events.
    
            Implement the APIs according to the documentation at:
            http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html
    
            Tests: fast/events/touch/document-create-touch-list.html
                   fast/events/touch/document-create-touch.html
    
            * bindings/js/JSBindingsAllInOne.cpp: Add new files to list.
            * bindings/js/JSTouchCustom.cpp: Added.
            (WebCore::toJSNewlyCreated):
            * bindings/js/JSTouchListCustom.cpp: Added.
            (WebCore::toJSNewlyCreated):
            * bindings/scripts/CodeGeneratorJS.pm:
            * dom/Document.cpp:
            (WebCore::Document::createTouch):
            (WebCore::Document::createTouchList):
            * dom/Document.h:
            * dom/Document.idl: Add createTouch and createTouchList functions.
            * Android.jscbindings.mk: Update makefiles.
            * CMakeLists.txt: Ditto.
            * GNUmakefile.am: Ditto.
            * WebCore.gypi: Ditto.
            * WebCore.pro: Ditto.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70047 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b942de0..f61c1d7 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2010-10-19  Ben Murdoch  <benm at google.com>
+
+        Reviewed by Steve Block.
+
+        Missing support for document.createTouch and document.createTouchList
+        https://bugs.webkit.org/show_bug.cgi?id=47676
+
+        Add tests to verify the presence of the APIs and that they work correctly.
+
+        * fast/events/touch/document-create-touch-expected.txt: Added.
+        * fast/events/touch/document-create-touch-list-expected.txt: Added.
+        * fast/events/touch/document-create-touch-list.html: Added.
+        * fast/events/touch/document-create-touch.html: Added.
+        * fast/events/touch/script-tests/document-create-touch-list.js: Added.
+        * fast/events/touch/script-tests/document-create-touch.js: Added.
+
 2010-10-19  Hayato Ito  <hayato at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/events/touch/document-create-touch-expected.txt b/LayoutTests/fast/events/touch/document-create-touch-expected.txt
new file mode 100644
index 0000000..2bf33cb
--- /dev/null
+++ b/LayoutTests/fast/events/touch/document-create-touch-expected.txt
@@ -0,0 +1,31 @@
+This tests support for the document.createTouch API.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS "createTouch" in document is true
+PASS touch is non-null.
+PASS touch.target is box
+PASS touch.identifier is 1
+PASS touch.pageX is 100
+PASS touch.pageY is 101
+PASS touch.screenX is 102
+PASS touch.screenY is 103
+PASS emptyTouch is non-null.
+PASS emptyTouch.target is null
+PASS emptyTouch.identifier is 0
+PASS emptyTouch.pageX is 0
+PASS emptyTouch.pageY is 0
+PASS emptyTouch.screenX is 0
+PASS emptyTouch.screenY is 0
+PASS badParamsTouch is non-null.
+PASS badParamsTouch.target is null
+PASS badParamsTouch.identifier is 0
+PASS badParamsTouch.pageX is 0
+PASS badParamsTouch.pageY is 0
+PASS badParamsTouch.screenX is 0
+PASS badParamsTouch.screenY is 104
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/events/touch/document-create-touch-list-expected.txt b/LayoutTests/fast/events/touch/document-create-touch-list-expected.txt
new file mode 100644
index 0000000..99d578c
--- /dev/null
+++ b/LayoutTests/fast/events/touch/document-create-touch-list-expected.txt
@@ -0,0 +1,14 @@
+This tests support for the document.createTouchList API.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS "createTouchList" in document is true
+PASS touchList is non-null.
+PASS touchList.length is 0
+PASS touchList.item(0) is null
+PASS touchList.item(1) is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/events/touch/document-create-touch-list.html b/LayoutTests/fast/events/touch/document-create-touch-list.html
new file mode 100644
index 0000000..bb81531
--- /dev/null
+++ b/LayoutTests/fast/events/touch/document-create-touch-list.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="../../js/resources/js-test-post-function.js"></script>
+<!--
+  Touch tests that involve the ontouchstart, ontouchmove, ontouchend or ontouchcancel callbacks
+  should be written in an asynchronous fashion so they can be run on mobile platforms like Android.
+  This template will generate an asynchronous style test by using the js-test-post-function script.
+  You will need to invoke isSuccessfullyParsed() in your test script when the test completes.
+-->
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/document-create-touch-list.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/events/touch/document-create-touch.html b/LayoutTests/fast/events/touch/document-create-touch.html
new file mode 100644
index 0000000..ef586fb
--- /dev/null
+++ b/LayoutTests/fast/events/touch/document-create-touch.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="../../js/resources/js-test-post-function.js"></script>
+<!--
+  Touch tests that involve the ontouchstart, ontouchmove, ontouchend or ontouchcancel callbacks
+  should be written in an asynchronous fashion so they can be run on mobile platforms like Android.
+  This template will generate an asynchronous style test by using the js-test-post-function script.
+  You will need to invoke isSuccessfullyParsed() in your test script when the test completes.
+-->
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/document-create-touch.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/events/touch/script-tests/document-create-touch-list.js b/LayoutTests/fast/events/touch/script-tests/document-create-touch-list.js
new file mode 100644
index 0000000..9c87c9a
--- /dev/null
+++ b/LayoutTests/fast/events/touch/script-tests/document-create-touch-list.js
@@ -0,0 +1,12 @@
+description("This tests support for the document.createTouchList API.");
+
+shouldBeTrue('"createTouchList" in document');
+
+var touchList = document.createTouchList();
+shouldBeNonNull("touchList");
+shouldBe("touchList.length", "0");
+shouldBeNull("touchList.item(0)");
+shouldBeNull("touchList.item(1)");
+
+successfullyParsed = true;
+isSuccessfullyParsed();
diff --git a/LayoutTests/fast/events/touch/script-tests/document-create-touch.js b/LayoutTests/fast/events/touch/script-tests/document-create-touch.js
new file mode 100644
index 0000000..c51c7e3
--- /dev/null
+++ b/LayoutTests/fast/events/touch/script-tests/document-create-touch.js
@@ -0,0 +1,41 @@
+description("This tests support for the document.createTouch API.");
+
+shouldBeTrue('"createTouch" in document');
+
+var box = document.createElement("div");
+box.id = "box";
+box.style.width = "100px";
+box.style.height = "100px";
+document.body.appendChild(box);
+
+var target = document.getElementById("box");
+var touch = document.createTouch(window, target, 1, 100, 101, 102, 103);
+shouldBeNonNull("touch");
+shouldBe("touch.target", "box");
+shouldBe("touch.identifier", "1");
+shouldBe("touch.pageX", "100");
+shouldBe("touch.pageY", "101");
+shouldBe("touch.screenX", "102");
+shouldBe("touch.screenY", "103");
+
+var emptyTouch = document.createTouch();
+shouldBeNonNull("emptyTouch");
+shouldBeNull("emptyTouch.target");
+shouldBe("emptyTouch.identifier", "0");
+shouldBe("emptyTouch.pageX", "0");
+shouldBe("emptyTouch.pageY", "0");
+shouldBe("emptyTouch.screenX", "0");
+shouldBe("emptyTouch.screenY", "0");
+
+// Try invoking with incorrect parameter types.
+var badParamsTouch = document.createTouch(function(x) { return x; }, 12, 'a', 'b', 'c', function(x) { return x; }, 104);
+shouldBeNonNull("badParamsTouch");
+shouldBeNull("badParamsTouch.target");
+shouldBe("badParamsTouch.identifier", "0");
+shouldBe("badParamsTouch.pageX", "0");
+shouldBe("badParamsTouch.pageY", "0");
+shouldBe("badParamsTouch.screenX", "0");
+shouldBe("badParamsTouch.screenY", "104");
+
+successfullyParsed = true;
+isSuccessfullyParsed();
diff --git a/WebCore/Android.jscbindings.mk b/WebCore/Android.jscbindings.mk
index 0816113..3288059 100644
--- a/WebCore/Android.jscbindings.mk
+++ b/WebCore/Android.jscbindings.mk
@@ -151,6 +151,8 @@ LOCAL_SRC_FILES += \
 	bindings/js/JSStyleSheetCustom.cpp \
 	bindings/js/JSStyleSheetListCustom.cpp \
 	bindings/js/JSTextCustom.cpp \
+	bindings/js/JSTouchCustom.cpp \
+	bindings/js/JSTouchListCustom.cpp \
 	bindings/js/JSTreeWalkerCustom.cpp \
 	bindings/js/JSWebKitCSSMatrixCustom.cpp \
 	bindings/js/JSWebKitPointCustom.cpp \
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index 2289c2c..b903dd7 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -670,6 +670,8 @@ SET(WebCore_SOURCES
     bindings/js/JSStyleSheetCustom.cpp
     bindings/js/JSStyleSheetListCustom.cpp
     bindings/js/JSTextCustom.cpp
+    bindings/js/JSTouchCustom.cpp
+    bindings/js/JSTouchListCustom.cpp
     bindings/js/JSTreeWalkerCustom.cpp
     bindings/js/JSWebKitCSSMatrixCustom.cpp
     bindings/js/JSWebKitPointCustom.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a981f0a..c0c686b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,36 @@
+2010-10-19  Ben Murdoch  <benm at google.com>
+
+        Reviewed by Steve Block.
+
+        Missing support for document.createTouch and document.createTouchList
+        https://bugs.webkit.org/show_bug.cgi?id=47676
+
+        These APIs are used by many sites to detect support for touch events.
+
+        Implement the APIs according to the documentation at:
+        http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html
+
+        Tests: fast/events/touch/document-create-touch-list.html
+               fast/events/touch/document-create-touch.html
+
+        * bindings/js/JSBindingsAllInOne.cpp: Add new files to list.
+        * bindings/js/JSTouchCustom.cpp: Added.
+        (WebCore::toJSNewlyCreated):
+        * bindings/js/JSTouchListCustom.cpp: Added.
+        (WebCore::toJSNewlyCreated):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        * dom/Document.cpp:
+        (WebCore::Document::createTouch):
+        (WebCore::Document::createTouchList):
+        * dom/Document.h:
+        * dom/Document.idl: Add createTouch and createTouchList functions.
+        * Android.jscbindings.mk: Update makefiles.
+        * CMakeLists.txt: Ditto.
+        * GNUmakefile.am: Ditto.
+        * WebCore.gypi: Ditto.
+        * WebCore.pro: Ditto.
+
+
 2010-10-19  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Yury Semikhatsky.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 151df8e..72eaa90 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -796,6 +796,8 @@ webcore_sources += \
 	WebCore/bindings/js/JSSVGPODListCustom.h \
 	WebCore/bindings/js/JSSVGPODTypeWrapper.h \
 	WebCore/bindings/js/JSTextCustom.cpp \
+	WebCore/bindings/js/JSTouchCustom.cpp \
+	WebCore/bindings/js/JSTouchListCustom.cpp \
 	WebCore/bindings/js/JSTreeWalkerCustom.cpp \
 	WebCore/bindings/js/JSWebKitCSSMatrixCustom.cpp \
 	WebCore/bindings/js/JSWebKitPointCustom.cpp \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 199c24c..af6d1ba 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -678,6 +678,8 @@
             'bindings/js/JSSVGPODListCustom.h',
             'bindings/js/JSSVGPODTypeWrapper.h',
             'bindings/js/JSTextCustom.cpp',
+            'bindings/js/JSTouchCustom.cpp',
+            'bindings/js/JSTouchListCustom.cpp',
             'bindings/js/JSTreeWalkerCustom.cpp',
             'bindings/js/JSWebKitCSSMatrixCustom.cpp',
             'bindings/js/JSWebKitPointCustom.cpp',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 5af5a0a..a964d89 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -551,6 +551,8 @@ v8 {
         bindings/js/JSStyleSheetCustom.cpp \
         bindings/js/JSStyleSheetListCustom.cpp \
         bindings/js/JSTextCustom.cpp \
+        bindings/js/JSTouchCustom.cpp \
+        bindings/js/JSTouchListCustom.cpp \
         bindings/js/JSTreeWalkerCustom.cpp \
         bindings/js/JSWebKitCSSMatrixCustom.cpp \
         bindings/js/JSWebKitPointCustom.cpp \
diff --git a/WebCore/bindings/js/JSBindingsAllInOne.cpp b/WebCore/bindings/js/JSBindingsAllInOne.cpp
index 6e1cc1e..cf08ca9 100644
--- a/WebCore/bindings/js/JSBindingsAllInOne.cpp
+++ b/WebCore/bindings/js/JSBindingsAllInOne.cpp
@@ -124,6 +124,8 @@
 #include "JSStyleSheetCustom.cpp"
 #include "JSStyleSheetListCustom.cpp"
 #include "JSTextCustom.cpp"
+#include "JSTouchCustom.cpp"
+#include "JSTouchListCustom.cpp"
 #include "JSTreeWalkerCustom.cpp"
 #include "JSWebKitCSSMatrixCustom.cpp"
 #include "JSWebKitPointCustom.cpp"
diff --git a/WebCore/bindings/js/JSTouchCustom.cpp b/WebCore/bindings/js/JSTouchCustom.cpp
new file mode 100644
index 0000000..83c2b83
--- /dev/null
+++ b/WebCore/bindings/js/JSTouchCustom.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2010, 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"
+#include "JSTouch.h"
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include "Touch.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+JSValue toJSNewlyCreated(ExecState* exec, JSDOMGlobalObject* globalObject, Touch* touch)
+{
+    if (!touch)
+        return jsNull();
+
+    return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, Touch, touch);
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/bindings/js/JSTouchListCustom.cpp b/WebCore/bindings/js/JSTouchListCustom.cpp
new file mode 100644
index 0000000..22e0f95
--- /dev/null
+++ b/WebCore/bindings/js/JSTouchListCustom.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2010, 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"
+#include "JSTouchList.h"
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include "TouchList.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+JSValue toJSNewlyCreated(ExecState* exec, JSDOMGlobalObject* globalObject, TouchList* touchList)
+{
+    if (!touchList)
+        return jsNull();
+
+    return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, TouchList, touchList);
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 5579a35..fe29b80 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -610,6 +610,15 @@ sub GenerateImplementationContentHeader
     return @implContentHeader;
 }
 
+my %usesToJSNewlyCreated = (
+    "CDATASection" => 1,
+    "Element" => 1,
+    "Node" => 1,
+    "Text" => 1,
+    "Touch" => 1,
+    "TouchList" => 1
+);
+
 sub GenerateHeader
 {
     my $object = shift;
@@ -943,7 +952,7 @@ sub GenerateHeader
             push(@headerContent, "$implClassName* to${interfaceName}(JSC::JSValue);\n");
         }
     }
-    if ($interfaceName eq "Node" or $interfaceName eq "Element" or $interfaceName eq "Text" or $interfaceName eq "CDATASection") {
+    if ($usesToJSNewlyCreated{$interfaceName}) {
         push(@headerContent, "JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, $interfaceName*);\n");
     }
     
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index e8e2dce..e89eb72 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -4773,4 +4773,22 @@ void Document::loadEventDelayTimerFired(Timer<Document>*)
         frame()->loader()->checkCompleted();
 }
 
+#if ENABLE(TOUCH_EVENTS)
+PassRefPtr<Touch> Document::createTouch(DOMWindow* window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, ExceptionCode&) const
+{
+    // FIXME: It's not clear from the documentation at
+    // http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html
+    // when this method should throw and nor is it by inspection of iOS behavior. It would be nice to verify any cases where it throws under iOS
+    // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=47819
+    // Ditto for the createTouchList method below.
+    Frame* frame = window ? window->frame() : this->frame();
+    return Touch::create(frame, target, identifier, screenX, screenY, pageX, pageY);
+}
+
+PassRefPtr<TouchList> Document::createTouchList(ExceptionCode&) const
+{
+    return TouchList::create();
+}
+#endif
+
 } // namespace WebCore
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index 7e9df7c..a98901e 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -136,6 +136,11 @@ class XPathResult;
 struct DashboardRegionValue;
 #endif
 
+#if ENABLE(TOUCH_EVENTS)
+class Touch;
+class TouchList;
+#endif
+
 typedef int ExceptionCode;
 
 class FormElementKey {
@@ -1033,6 +1038,11 @@ public:
     void decrementLoadEventDelayCount();
     bool isDelayingLoadEvent() const { return m_loadEventDelayCount; }
 
+#if ENABLE(TOUCH_EVENTS)
+    PassRefPtr<Touch> createTouch(DOMWindow*, EventTarget*, int identifier, int pageX, int pageY, int screenX, int screenY, ExceptionCode&) const;
+    PassRefPtr<TouchList> createTouchList(ExceptionCode&) const;
+#endif
+
 protected:
     Document(Frame*, const KURL& url, bool isXHTML, bool isHTML, const KURL& baseURL = KURL());
 
diff --git a/WebCore/dom/Document.idl b/WebCore/dom/Document.idl
index 426e9cf..4a37acc 100644
--- a/WebCore/dom/Document.idl
+++ b/WebCore/dom/Document.idl
@@ -324,6 +324,19 @@ module core {
         attribute [DontEnum, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenchange;
 #endif
 
+#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
+        [ReturnsNew] Touch createTouch(in DOMWindow window,
+                                       in EventTarget target,
+                                       in long identifier,
+                                       in long pageX,
+                                       in long pageY,
+                                       in long ScreenX,
+                                       in long screenY)
+            raises (DOMException);
+        [ReturnsNew] TouchList createTouchList()
+            raises (DOMException);
+#endif
+
 #if defined(LANGUAGE_CPP) && LANGUAGE_CPP
         // Extra WebCore methods exposed to allow compile-time casting in C++
         boolean isHTMLDocument();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list