[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9
benm at google.com
benm at google.com
Thu Feb 4 21:21:44 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 22e91bca224331d304d0a5723d3c3ef4295783d8
Author: benm at google.com <benm at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jan 20 15:48:12 2010 +0000
The touchcancel event is not supported.
https://bugs.webkit.org/show_bug.cgi?id=33598
Reviewed by Simon Hausmann.
WebCore:
This change adds support for the touchcancel event in WebCore and adds a test.
Test: fast/events/touch/send-oncancel-event.html
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::processingUserGestureEvent): Considers touchcancel with the other touch events when working out if the event is a user gesture.
* dom/Document.cpp:
(WebCore::Document::addListenerTypeIfNeeded): Adds a check to consider ontouchcancel a touch event listener.
* dom/Document.h: Add the touchcancel attribute event listener.
* dom/Document.idl: ditto.
* dom/Element.h: ditto.
* dom/Element.idl: ditto.
* dom/EventNames.h: Adds touchcancel as an event name.
* html/HTMLAttributeNames.in:Adds touchcancel as an HTML attribute name.
* html/HTMLElement.cpp:
(WebCore::HTMLElement::parseMappedAttribute): Parses the ontouchcancel attribute.
* page/DOMWindow.h: Adds the touchcancel attribute event listener.
* page/DOMWindow.idl: ditto.
* page/EventHandler.cpp:
(WebCore::EventHandler::handleTouchEvent): Add code to detect and dispatch touchcancel events.
* platform/PlatformTouchEvent.h:
(WebCore::): Add TouchCancel as a touch event type.
* platform/PlatformTouchPoint.h:
(WebCore::PlatformTouchPoint::): Add TouchCanceled as a touch point state.
LayoutTests:
Test for the oncancel event.
* fast/events/script-tests/send-oncancel-event.js: Added.
(touchcancelHandler):
* fast/events/touch/send-oncancel-event-expected.txt: Added.
* fast/events/touch/send-oncancel-event.html: Added.
* platform/qt/Skipped: Add send-oncancel-event to the Qt Skipped list as there is not support for that type of event on Qt yet.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53548 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index fa65c78..acb677d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2010-01-20 Ben Murdoch <benm at google.com>
+
+ Reviewed by Simon Hausmann.
+
+ The touchcancel event is not supported.
+ https://bugs.webkit.org/show_bug.cgi?id=33598
+
+ Test for the oncancel event.
+
+ * fast/events/script-tests/send-oncancel-event.js: Added.
+ (touchcancelHandler):
+ * fast/events/touch/send-oncancel-event-expected.txt: Added.
+ * fast/events/touch/send-oncancel-event.html: Added.
+ * platform/qt/Skipped: Add send-oncancel-event to the Qt Skipped list as there is not support for that type of event on Qt yet.
+
2010-01-20 Csaba Osztrogonác <ossy at webkit.org>
[Qt] fast/frames/set-unloaded-frame-location.html timed out on Qt Linux Release Build Bot
diff --git a/LayoutTests/fast/events/script-tests/send-oncancel-event.js b/LayoutTests/fast/events/script-tests/send-oncancel-event.js
new file mode 100644
index 0000000..c83daa4
--- /dev/null
+++ b/LayoutTests/fast/events/script-tests/send-oncancel-event.js
@@ -0,0 +1,32 @@
+description("Tests that the cancel touch event is sent correctly.");
+
+var touchX = 25;
+var touchY = 25;
+
+var cancelEvent = null;
+
+function touchcancelHandler() {
+ shouldBeEqualToString("event.type", "touchcancel");
+ cancelEvent = event.changedTouches[0];
+ shouldBeNonNull("cancelEvent");
+ shouldBe("cancelEvent.pageX", touchX.toString());
+ shouldBe("cancelEvent.pageY", touchY.toString());
+ if (window.layoutTestController) {
+ layoutTestController.notifyDone();
+ isSuccessfullyParsed();
+ }
+}
+
+if (window.layoutTestController)
+ window.layoutTestController.waitUntilDone();
+
+if (window.eventSender) {
+ document.addEventListener("touchcancel", touchcancelHandler, false);
+ eventSender.addTouchPoint(touchX, touchY);
+ eventSender.touchStart();
+ eventSender.cancelTouchPoint(0);
+ eventSender.touchCancel();
+} else
+ debug("This test requires DumpRenderTree.");
+
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/events/touch/send-oncancel-event-expected.txt b/LayoutTests/fast/events/touch/send-oncancel-event-expected.txt
new file mode 100644
index 0000000..75b4cb2
--- /dev/null
+++ b/LayoutTests/fast/events/touch/send-oncancel-event-expected.txt
@@ -0,0 +1,13 @@
+Tests that the cancel touch event is sent correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS event.type is "touchcancel"
+PASS cancelEvent is non-null.
+PASS cancelEvent.pageX is 25
+PASS cancelEvent.pageY is 25
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/events/touch/send-oncancel-event.html b/LayoutTests/fast/events/touch/send-oncancel-event.html
new file mode 100644
index 0000000..c3c977e
--- /dev/null
+++ b/LayoutTests/fast/events/touch/send-oncancel-event.html
@@ -0,0 +1,13 @@
+<!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>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="../script-tests/send-oncancel-event.js"></script>
+<script src="../../js/resources/js-test-post-function.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index 0a22ab4..985601d 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -5098,6 +5098,9 @@ fast/forms/slider-mouse-events.html
# Just needs pixel and rendering results generated by someone with this platform:
fast/css/non-standard-checkbox-size.html
+# eventSender missing touchCancel() and cancelTouchPoint()
+fast/events/touch/send-oncancel-event.html
+
# REGRESSION (r53450) - skipped until fix
# https://bugs.webkit.org/show_bug.cgi?id=33834
css1/box_properties/acid_test.html
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 768adb9..775b0d4 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,35 @@
+2010-01-20 Ben Murdoch <benm at google.com>
+
+ Reviewed by Simon Hausmann.
+
+ The touchcancel event is not supported.
+ https://bugs.webkit.org/show_bug.cgi?id=33598
+
+ This change adds support for the touchcancel event in WebCore and adds a test.
+
+ Test: fast/events/touch/send-oncancel-event.html
+
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::processingUserGestureEvent): Considers touchcancel with the other touch events when working out if the event is a user gesture.
+ * dom/Document.cpp:
+ (WebCore::Document::addListenerTypeIfNeeded): Adds a check to consider ontouchcancel a touch event listener.
+ * dom/Document.h: Add the touchcancel attribute event listener.
+ * dom/Document.idl: ditto.
+ * dom/Element.h: ditto.
+ * dom/Element.idl: ditto.
+ * dom/EventNames.h: Adds touchcancel as an event name.
+ * html/HTMLAttributeNames.in:Adds touchcancel as an HTML attribute name.
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::parseMappedAttribute): Parses the ontouchcancel attribute.
+ * page/DOMWindow.h: Adds the touchcancel attribute event listener.
+ * page/DOMWindow.idl: ditto.
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleTouchEvent): Add code to detect and dispatch touchcancel events.
+ * platform/PlatformTouchEvent.h:
+ (WebCore::): Add TouchCancel as a touch event type.
+ * platform/PlatformTouchPoint.h:
+ (WebCore::PlatformTouchPoint::): Add TouchCanceled as a touch point state.
+
2010-01-20 Tor Arne Vestbø <tor.arne.vestbo at nokia.com>
Reviewed by Simon Hausmann.
diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp
index 995d2d4..698e93a 100644
--- a/WebCore/bindings/js/ScriptController.cpp
+++ b/WebCore/bindings/js/ScriptController.cpp
@@ -247,7 +247,7 @@ bool ScriptController::processingUserGestureEvent() const
#if ENABLE(TOUCH_EVENTS)
// touch events
|| type == eventNames().touchstartEvent || type == eventNames().touchmoveEvent
- || type == eventNames().touchendEvent
+ || type == eventNames().touchendEvent || type == eventNames().touchcancelEvent
#endif
// other accepted events
|| type == eventNames().selectEvent || type == eventNames().changeEvent
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 6e3be84..31c6bae 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -3059,7 +3059,8 @@ void Document::addListenerTypeIfNeeded(const AtomicString& eventType)
addListenerType(BEFORELOAD_LISTENER);
else if (eventType == eventNames().touchstartEvent
|| eventType == eventNames().touchmoveEvent
- || eventType == eventNames().touchendEvent)
+ || eventType == eventNames().touchendEvent
+ || eventType == eventNames().touchcancelEvent)
addListenerType(TOUCH_LISTENER);
}
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index 7ebddf7..31cbaa5 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -273,6 +273,7 @@ public:
DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart);
DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove);
DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel);
#endif
DocumentType* doctype() const { return m_docType.get(); }
diff --git a/WebCore/dom/Document.idl b/WebCore/dom/Document.idl
index 7e51e51..26ed7fd 100644
--- a/WebCore/dom/Document.idl
+++ b/WebCore/dom/Document.idl
@@ -310,6 +310,7 @@ module core {
attribute [DontEnum] EventListener ontouchstart;
attribute [DontEnum] EventListener ontouchmove;
attribute [DontEnum] EventListener ontouchend;
+ attribute [DontEnum] EventListener ontouchcancel;
#endif
#endif
};
diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h
index 1f82538..0141aa7 100644
--- a/WebCore/dom/Element.h
+++ b/WebCore/dom/Element.h
@@ -95,6 +95,7 @@ public:
DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart);
DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove);
DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel);
#endif
const AtomicString& getIDAttribute() const;
diff --git a/WebCore/dom/Element.idl b/WebCore/dom/Element.idl
index c881e3a..e565bc0 100644
--- a/WebCore/dom/Element.idl
+++ b/WebCore/dom/Element.idl
@@ -199,6 +199,7 @@ module core {
attribute [DontEnum] EventListener ontouchstart;
attribute [DontEnum] EventListener ontouchmove;
attribute [DontEnum] EventListener ontouchend;
+ attribute [DontEnum] EventListener ontouchcancel;
#endif
#endif
};
diff --git a/WebCore/dom/EventNames.h b/WebCore/dom/EventNames.h
index 08af753..76e70fd 100644
--- a/WebCore/dom/EventNames.h
+++ b/WebCore/dom/EventNames.h
@@ -149,6 +149,7 @@ namespace WebCore {
macro(touchstart) \
macro(touchmove) \
macro(touchend) \
+ macro(touchcancel) \
\
// end of DOM_EVENT_NAMES_FOR_EACH
diff --git a/WebCore/html/HTMLAttributeNames.in b/WebCore/html/HTMLAttributeNames.in
index 3c4ff40..b2e35fc 100644
--- a/WebCore/html/HTMLAttributeNames.in
+++ b/WebCore/html/HTMLAttributeNames.in
@@ -206,6 +206,7 @@ ontimeupdate
ontouchstart
ontouchmove
ontouchend
+ontouchcancel
onunload
onvolumechange
onwaiting
diff --git a/WebCore/html/HTMLElement.cpp b/WebCore/html/HTMLElement.cpp
index fa28c95..c4253f5 100644
--- a/WebCore/html/HTMLElement.cpp
+++ b/WebCore/html/HTMLElement.cpp
@@ -257,6 +257,8 @@ void HTMLElement::parseMappedAttribute(MappedAttribute *attr)
setAttributeEventListener(eventNames().touchmoveEvent, createAttributeEventListener(this, attr));
} else if (attr->name() == ontouchendAttr) {
setAttributeEventListener(eventNames().touchendEvent, createAttributeEventListener(this, attr));
+ } else if (attr->name() == ontouchcancelAttr) {
+ setAttributeEventListener(eventNames().touchcancelEvent, createAttributeEventListener(this, attr));
}
}
diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h
index ea76898..d6e5ad7 100644
--- a/WebCore/page/DOMWindow.h
+++ b/WebCore/page/DOMWindow.h
@@ -326,6 +326,7 @@ namespace WebCore {
DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart);
DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove);
DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel);
#endif
void captureEvents();
void releaseEvents();
diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl
index ecca3d6..fdb8243 100644
--- a/WebCore/page/DOMWindow.idl
+++ b/WebCore/page/DOMWindow.idl
@@ -293,6 +293,7 @@ module window {
attribute [DontEnum] EventListener ontouchstart;
attribute [DontEnum] EventListener ontouchmove;
attribute [DontEnum] EventListener ontouchend;
+ attribute [DontEnum] EventListener ontouchcancel;
#endif
// EventTarget interface
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp
index e99720e..c907272 100644
--- a/WebCore/page/EventHandler.cpp
+++ b/WebCore/page/EventHandler.cpp
@@ -2549,6 +2549,7 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
RefPtr<TouchList> releasedTouches = TouchList::create();
RefPtr<TouchList> movedTouches = TouchList::create();
RefPtr<TouchList> targetTouches = TouchList::create();
+ RefPtr<TouchList> cancelTouches = TouchList::create();
const Vector<PlatformTouchPoint>& points = event.touchPoints();
AtomicString* eventName = 0;
@@ -2578,6 +2579,8 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
if (point.state() == PlatformTouchPoint::TouchReleased)
releasedTouches->append(touch);
+ else if (point.state() == PlatformTouchPoint::TouchCancelled)
+ cancelTouches->append(touch);
else {
if (point.state() == PlatformTouchPoint::TouchPressed)
pressedTouches->append(touch);
@@ -2596,6 +2599,21 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
bool defaultPrevented = false;
+ if (event.type() == TouchCancel) {
+ eventName = &eventNames().touchcancelEvent;
+ RefPtr<TouchEvent> cancelEv =
+ TouchEvent::create(TouchList::create().get(), TouchList::create().get(), cancelTouches.get(),
+ *eventName, m_touchEventTarget->document()->defaultView(),
+ m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(),
+ m_firstTouchPagePos.x(), m_firstTouchPagePos.y(),
+ event.ctrlKey(), event.altKey(), event.shiftKey(),
+ event.metaKey());
+
+ ExceptionCode ec = 0;
+ m_touchEventTarget->dispatchEvent(cancelEv.get(), ec);
+ defaultPrevented |= cancelEv->defaultPrevented();
+ }
+
if (releasedTouches->length() > 0) {
eventName = &eventNames().touchendEvent;
RefPtr<TouchEvent> endEv =
@@ -2643,7 +2661,7 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
defaultPrevented |= moveEv->defaultPrevented();
}
- if (event.type() == TouchEnd)
+ if (event.type() == TouchEnd || event.type() == TouchCancel)
m_touchEventTarget = 0;
return defaultPrevented;
diff --git a/WebCore/platform/PlatformTouchEvent.h b/WebCore/platform/PlatformTouchEvent.h
index 5c187d5..bdc5fb2 100644
--- a/WebCore/platform/PlatformTouchEvent.h
+++ b/WebCore/platform/PlatformTouchEvent.h
@@ -33,7 +33,12 @@ QT_END_NAMESPACE
namespace WebCore {
-enum TouchEventType { TouchStart, TouchMove, TouchEnd };
+enum TouchEventType {
+ TouchStart
+ , TouchMove
+ , TouchEnd
+ , TouchCancel
+};
class PlatformTouchEvent {
public:
diff --git a/WebCore/platform/PlatformTouchPoint.h b/WebCore/platform/PlatformTouchPoint.h
index 350653d..c39d440 100644
--- a/WebCore/platform/PlatformTouchPoint.h
+++ b/WebCore/platform/PlatformTouchPoint.h
@@ -40,7 +40,8 @@ public:
TouchReleased,
TouchPressed,
TouchMoved,
- TouchStationary
+ TouchStationary,
+ TouchCancelled
};
#if PLATFORM(QT)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list