[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
johnnyg at google.com
johnnyg at google.com
Wed Dec 22 12:49:54 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit b65e1f460075f4fe4e238776b3743de758798087
Author: johnnyg at google.com <johnnyg at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Aug 31 08:58:28 2010 +0000
2010-08-27 John Gregg <johnnyg at google.com>
Reviewed by David Levin.
Notifications should support a click event
https://bugs.webkit.org/show_bug.cgi?id=44800
* public/WebNotification.h:
* src/WebNotification.cpp:
(WebKit::WebNotification::dispatchClickEvent):
2010-08-27 John Gregg <johnnyg at google.com>
Reviewed by David Levin.
Notifications should support a click event
https://bugs.webkit.org/show_bug.cgi?id=44800
Test: fast/notifications/notifications-click-event.html
* notifications/Notification.h:
* notifications/Notification.idl:
2010-08-27 John Gregg <johnnyg at google.com>
Reviewed by David Levin.
Notifications should support a click event
https://bugs.webkit.org/show_bug.cgi?id=44800
* fast/notifications/notifications-click-event-expected.txt: Added.
* fast/notifications/notifications-click-event.html: Added.
* platform/qt/Skipped:
2010-08-27 John Gregg <johnnyg at google.com>
Reviewed by David Levin.
Notifications should support a click event.
Adds necessary hooks to chromium's DRT so that clicks on desktop notifications
can be simulated during a layout test. Requires storing a list of active
notifications so that they can be referred to later for clicking.
https://bugs.webkit.org/show_bug.cgi?id=44800
* DumpRenderTree/chromium/LayoutTestController.cpp:
(LayoutTestController::LayoutTestController):
(LayoutTestController::simulateDesktopNotificationClick):
* DumpRenderTree/chromium/LayoutTestController.h:
* DumpRenderTree/chromium/NotificationPresenter.cpp:
(NotificationPresenter::simulateClick):
(NotificationPresenter::show):
(NotificationPresenter::cancel):
(NotificationPresenter::objectDestroyed):
* DumpRenderTree/chromium/NotificationPresenter.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66470 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 1f8fbb1..3911a16 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2010-08-27 John Gregg <johnnyg at google.com>
+
+ Reviewed by David Levin.
+
+ Notifications should support a click event
+ https://bugs.webkit.org/show_bug.cgi?id=44800
+
+ * fast/notifications/notifications-click-event-expected.txt: Added.
+ * fast/notifications/notifications-click-event.html: Added.
+ * platform/qt/Skipped:
+
2010-08-31 Alejandro G. Castro <alex at igalia.com>
Unreviewed.
diff --git a/LayoutTests/fast/notifications/notifications-click-event-expected.txt b/LayoutTests/fast/notifications/notifications-click-event-expected.txt
new file mode 100644
index 0000000..720cca0
--- /dev/null
+++ b/LayoutTests/fast/notifications/notifications-click-event-expected.txt
@@ -0,0 +1,7 @@
+DESKTOP NOTIFICATION: icon , title New E-mail, text Meet me tonight at 8!
+DESKTOP NOTIFICATION CLOSED: New E-mail
+Showing notifications.
+
+To exercise manually, grant notification permissions and load this page, then click on the notification. You should see a "PASS" message.
+
+PASS: click event fired.
diff --git a/LayoutTests/fast/notifications/notifications-click-event.html b/LayoutTests/fast/notifications/notifications-click-event.html
new file mode 100644
index 0000000..a44150c
--- /dev/null
+++ b/LayoutTests/fast/notifications/notifications-click-event.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script type="text/javascript">
+ function log(message)
+ {
+ document.getElementById("result").innerHTML += message + "<br>";
+ }
+
+ function runTests()
+ {
+ if (window.layoutTestController) {
+ layoutTestController.grantDesktopNotificationPermission("file://");
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ if (!window.webkitNotifications) {
+ log("FAIL: No webkitNotifications interface!");
+ }
+
+ var N = window.webkitNotifications.createNotification("", "New E-mail", "Meet me tonight at 8!");
+ N.onclick = function() { log("PASS: click event fired."); N.cancel(); }
+ N.show();
+ if (window.layoutTestController) {
+ layoutTestController.simulateDesktopNotificationClick("New E-mail");
+ layoutTestController.notifyDone();
+ }
+ }
+ </script>
+</head>
+<body>
+<p>Showing notifications.</p>
+
+<p>To exercise manually, grant notification permissions and load this page, then click on the notification. You should see a "PASS" message.</p>
+<div id="result"></div>
+
+<script type="text/javascript">
+runTests();
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index 2cca5b7..030bcbe 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -5335,6 +5335,7 @@ svg/W3C-SVG-1.1/filters-light-04-f.svg
# new skipped tests yet to be sorted
# ============================================================================= #
fast/dom/Geolocation/callback-to-remote-context2.html
+fast/notifications/notifications-click-event.html
# Link prefetch is disabled by default
fast/dom/HTMLLinkElement/prefetch.html
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9c0bb61..f1dc423 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-08-27 John Gregg <johnnyg at google.com>
+
+ Reviewed by David Levin.
+
+ Notifications should support a click event
+ https://bugs.webkit.org/show_bug.cgi?id=44800
+
+ Test: fast/notifications/notifications-click-event.html
+
+ * notifications/Notification.h:
+ * notifications/Notification.idl:
+
2010-08-31 Kent Tamura <tkent at chromium.org>
Reviewed by Adam Barth.
diff --git a/WebCore/notifications/Notification.h b/WebCore/notifications/Notification.h
index 35f9cb8..f14a302 100644
--- a/WebCore/notifications/Notification.h
+++ b/WebCore/notifications/Notification.h
@@ -83,6 +83,7 @@ namespace WebCore {
DEFINE_ATTRIBUTE_EVENT_LISTENER(display);
DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
DEFINE_ATTRIBUTE_EVENT_LISTENER(close);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(click);
using RefCounted<Notification>::ref;
using RefCounted<Notification>::deref;
diff --git a/WebCore/notifications/Notification.idl b/WebCore/notifications/Notification.idl
index 5ca84a5..66a1229 100644
--- a/WebCore/notifications/Notification.idl
+++ b/WebCore/notifications/Notification.idl
@@ -41,6 +41,7 @@ module threads {
attribute EventListener ondisplay;
attribute EventListener onerror;
attribute EventListener onclose;
+ attribute EventListener onclick;
attribute DOMString dir;
attribute DOMString replaceId;
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index fe8935d..67fc9aa 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,14 @@
+2010-08-27 John Gregg <johnnyg at google.com>
+
+ Reviewed by David Levin.
+
+ Notifications should support a click event
+ https://bugs.webkit.org/show_bug.cgi?id=44800
+
+ * public/WebNotification.h:
+ * src/WebNotification.cpp:
+ (WebKit::WebNotification::dispatchClickEvent):
+
2010-08-31 Jian Li <jianli at chromium.org>
Reviewed by Darin Fisher.
diff --git a/WebKit/chromium/public/WebNotification.h b/WebKit/chromium/public/WebNotification.h
index 89dff7a..dbbde02 100644
--- a/WebKit/chromium/public/WebNotification.h
+++ b/WebKit/chromium/public/WebNotification.h
@@ -97,6 +97,9 @@ public:
// the byUser parameter will be true.
WEBKIT_API void dispatchCloseEvent(bool byUser);
+ // Called to indicate the notification was clicked on.
+ WEBKIT_API void dispatchClickEvent();
+
#if WEBKIT_IMPLEMENTATION
WebNotification(const WTF::PassRefPtr<WebCore::Notification>&);
WebNotification& operator=(const WTF::PassRefPtr<WebCore::Notification>&);
diff --git a/WebKit/chromium/src/WebNotification.cpp b/WebKit/chromium/src/WebNotification.cpp
index 6aa8439..bfc1bec 100644
--- a/WebKit/chromium/src/WebNotification.cpp
+++ b/WebKit/chromium/src/WebNotification.cpp
@@ -138,6 +138,12 @@ void WebNotification::dispatchCloseEvent(bool /* byUser */)
m_private->dispatchEvent(event.release());
}
+void WebNotification::dispatchClickEvent()
+{
+ RefPtr<Event> event = Event::create(eventNames().clickEvent, false, true);
+ m_private->dispatchEvent(event.release());
+}
+
WebNotification::WebNotification(const WTF::PassRefPtr<Notification>& notification)
: m_private(static_cast<WebNotificationPrivate*>(notification.releaseRef()))
{
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index b992126..7791bbc 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,24 @@
+2010-08-27 John Gregg <johnnyg at google.com>
+
+ Reviewed by David Levin.
+
+ Notifications should support a click event.
+ Adds necessary hooks to chromium's DRT so that clicks on desktop notifications
+ can be simulated during a layout test. Requires storing a list of active
+ notifications so that they can be referred to later for clicking.
+ https://bugs.webkit.org/show_bug.cgi?id=44800
+
+ * DumpRenderTree/chromium/LayoutTestController.cpp:
+ (LayoutTestController::LayoutTestController):
+ (LayoutTestController::simulateDesktopNotificationClick):
+ * DumpRenderTree/chromium/LayoutTestController.h:
+ * DumpRenderTree/chromium/NotificationPresenter.cpp:
+ (NotificationPresenter::simulateClick):
+ (NotificationPresenter::show):
+ (NotificationPresenter::cancel):
+ (NotificationPresenter::objectDestroyed):
+ * DumpRenderTree/chromium/NotificationPresenter.h:
+
2010-08-30 Alice Liu <alice.liu at apple.com>
Reviewed by Darin Adler.
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
index beae21e..eb7d7bb 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
@@ -139,6 +139,7 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindMethod("numberOfPages", &LayoutTestController::numberOfPages);
bindMethod("dumpSelectionRect", &LayoutTestController::dumpSelectionRect);
bindMethod("grantDesktopNotificationPermission", &LayoutTestController::grantDesktopNotificationPermission);
+ bindMethod("simulateDesktopNotificationClick", &LayoutTestController::simulateDesktopNotificationClick);
// The following are stubs.
bindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive);
@@ -942,6 +943,18 @@ void LayoutTestController::grantDesktopNotificationPermission(const CppArgumentL
result->set(true);
}
+void LayoutTestController::simulateDesktopNotificationClick(const CppArgumentList& arguments, CppVariant* result)
+{
+ if (arguments.size() != 1 || !arguments[0].isString()) {
+ result->set(false);
+ return;
+ }
+ if (m_shell->notificationPresenter()->simulateClick(cppVariantToWebString(arguments[0])))
+ result->set(true);
+ else
+ result->set(false);
+}
+
//
// Unimplemented stubs
//
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
index 352e89f..6e0457c 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
@@ -218,6 +218,8 @@ public:
// Grants permission for desktop notifications to an origin
void grantDesktopNotificationPermission(const CppArgumentList&, CppVariant*);
+ // Simulates a click on a desktop notification.
+ void simulateDesktopNotificationClick(const CppArgumentList&, CppVariant*);
void setEditingBehavior(const CppArgumentList&, CppVariant*);
diff --git a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp
index 070df33..1098e38 100644
--- a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp
@@ -44,6 +44,13 @@
using namespace WebKit;
+static WebString identifierForNotification(const WebNotification& notification)
+{
+ if (notification.isHTML())
+ return notification.url().spec().utf16();
+ return notification.title();
+}
+
static void deferredDisplayDispatch(WebNotification notification)
{
notification.dispatchDisplayEvent();
@@ -56,17 +63,28 @@ void NotificationPresenter::grantPermission(const WebString& origin)
m_allowedOrigins.add(WTF::String(url.GetOrigin().spec().c_str()));
}
+bool NotificationPresenter::simulateClick(const WebString& title)
+{
+ WTF::String id(title.data(), title.length());
+ if (m_activeNotifications.find(id) == m_activeNotifications.end())
+ return false;
+
+ const WebNotification& notification = m_activeNotifications.find(id)->second;
+ WebNotification eventTarget(notification);
+ eventTarget.dispatchClickEvent();
+ return true;
+}
+
// The output from all these methods matches what DumpRenderTree produces.
bool NotificationPresenter::show(const WebNotification& notification)
{
+ WebString identifier = identifierForNotification(notification);
if (!notification.replaceId().isEmpty()) {
WTF::String replaceId(notification.replaceId().data(), notification.replaceId().length());
if (m_replacements.find(replaceId) != m_replacements.end())
printf("REPLACING NOTIFICATION %s\n",
m_replacements.find(replaceId)->second.utf8().data());
- WebString identifier = notification.isHTML() ?
- notification.url().spec().utf16() : notification.title();
m_replacements.set(replaceId, WTF::String(identifier.data(), identifier.length()));
}
@@ -84,6 +102,9 @@ bool NotificationPresenter::show(const WebNotification& notification)
notification.body().utf8().data());
}
+ WTF::String id(identifier.data(), identifier.length());
+ m_activeNotifications.set(id, notification);
+
WebNotification eventTarget(notification);
webkit_support::PostTaskFromHere(NewRunnableFunction(&deferredDisplayDispatch, eventTarget));
return true;
@@ -91,20 +112,20 @@ bool NotificationPresenter::show(const WebNotification& notification)
void NotificationPresenter::cancel(const WebNotification& notification)
{
- WebString identifier;
- if (notification.isHTML())
- identifier = notification.url().spec().utf16();
- else
- identifier = notification.title();
-
+ WebString identifier = identifierForNotification(notification);
printf("DESKTOP NOTIFICATION CLOSED: %s\n", identifier.utf8().data());
WebNotification eventTarget(notification);
eventTarget.dispatchCloseEvent(false);
+
+ WTF::String id(identifier.data(), identifier.length());
+ m_activeNotifications.remove(id);
}
void NotificationPresenter::objectDestroyed(const WebKit::WebNotification& notification)
{
- // Nothing to do. Not storing the objects.
+ WebString identifier = identifierForNotification(notification);
+ WTF::String id(identifier.data(), identifier.length());
+ m_activeNotifications.remove(id);
}
WebNotificationPresenter::Permission NotificationPresenter::checkPermission(const WebURL& url)
diff --git a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h
index 5c7a400..896f345 100644
--- a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h
+++ b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h
@@ -31,6 +31,7 @@
#ifndef NotificationPresenter_h
#define NotificationPresenter_h
+#include "public/WebNotification.h"
#include "public/WebNotificationPresenter.h"
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
@@ -47,6 +48,9 @@ public:
// Called by the LayoutTestController to simulate a user granting permission.
void grantPermission(const WebKit::WebString& origin);
+ // Called by the LayoutTestController to simulate a user clicking on a notification.
+ bool simulateClick(const WebKit::WebString& notificationIdentifier);
+
// WebKit::WebNotificationPresenter interface
virtual bool show(const WebKit::WebNotification&);
virtual void cancel(const WebKit::WebNotification&);
@@ -63,6 +67,9 @@ private:
// Set of allowed origins.
HashSet<WTF::String> m_allowedOrigins;
+ // Map of active notifications.
+ HashMap<WTF::String, WebKit::WebNotification> m_activeNotifications;
+
// Map of active replacement IDs to the titles of those notifications
HashMap<WTF::String, WTF::String> m_replacements;
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list