2010-05-25 Dirk Pranke <dpranke@chromium.org>
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 May 2010 22:47:51 +0000 (22:47 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 May 2010 22:47:51 +0000 (22:47 +0000)
        Reviewed by Dimitri Glazkov.

        Re-commit r58765 - it had been rolled out to see if it was causing
        a perf regression (in r59787 and r59789), but that does not seem to
        have been the case.

        https://bugs.webkit.org/show_bug.cgi?id=39605

        * fast/notifications/notifications-replace-expected.txt: Added.
        * fast/notifications/notifications-replace.html: Added.
        * fast/notifications/notifications-rtl-expected.txt: Added.
        * fast/notifications/notifications-rtl.html: Added.
2010-05-25  Dirk Pranke  <dpranke@chromium.org>

        Reviewed by Dimitri Glazkov.

        Re-commit r58765 - it had been rolled out to see if it was causing
        a perf regression (in r59787), but that does not seem to have been
        the case.

        Tests: fast/notifications/notifications-replace.html
               fast/notifications/notifications-rtl.html

        https://bugs.webkit.org/show_bug.cgi?id=39605

        * notifications/Notification.h:
        (WebCore::Notification::dir):
        (WebCore::Notification::setDir):
        (WebCore::Notification::replaceId):
        (WebCore::Notification::setReplaceId):
        * notifications/Notification.idl:
2010-05-24  Dirk Pranke  <dpranke@chromium.org>

        Reviewed by Dimitri Glazkov.

        Re-commit r58765 - it had been rolled out to see if it was causing
        a perf regression (in r59787 and r59789), but that does not seem to
        have been the case.

        * public/WebNotification.h:
        * src/WebNotification.cpp:
        (WebKit::WebNotification::dir):
        (WebKit::WebNotification::replaceId):
2010-05-24  Dirk Pranke  <dpranke@chromium.org>

        Reviewed by Dimitri Glazkov.

        Re-commit r58765 - it had been rolled out to see if it was causing
        a perf regression (in r59787 and r59789), but that does not seem to
        have been the case.

        https://bugs.webkit.org/show_bug.cgi?id=39605

        * DumpRenderTree/chromium/NotificationPresenter.cpp:
        (NotificationPresenter::show):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@60193 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/notifications/notifications-replace-expected.txt [new file with mode: 0644]
LayoutTests/fast/notifications/notifications-replace.html [new file with mode: 0644]
LayoutTests/fast/notifications/notifications-rtl-expected.txt [new file with mode: 0644]
LayoutTests/fast/notifications/notifications-rtl.html [new file with mode: 0644]
LayoutTests/platform/chromium/test_expectations.txt
WebCore/ChangeLog
WebCore/notifications/Notification.h
WebCore/notifications/Notification.idl
WebKit/chromium/ChangeLog
WebKit/chromium/public/WebNotification.h
WebKit/chromium/src/WebNotification.cpp
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp

index 9801633..3e2f068 100644 (file)
@@ -1,3 +1,18 @@
+2010-05-25  Dirk Pranke  <dpranke@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Re-commit r58765 - it had been rolled out to see if it was causing
+        a perf regression (in r59787 and r59789), but that does not seem to
+        have been the case.
+
+        https://bugs.webkit.org/show_bug.cgi?id=39605
+
+        * fast/notifications/notifications-replace-expected.txt: Added.
+        * fast/notifications/notifications-replace.html: Added.
+        * fast/notifications/notifications-rtl-expected.txt: Added.
+        * fast/notifications/notifications-rtl.html: Added.
+
 2010-05-25  James Robinson  <jamesr@chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/notifications/notifications-replace-expected.txt b/LayoutTests/fast/notifications/notifications-replace-expected.txt
new file mode 100644 (file)
index 0000000..a4f7fc4
--- /dev/null
@@ -0,0 +1,7 @@
+DESKTOP NOTIFICATION: icon file:///email.png, title New E-mail, text Meet me tonight at 8!
+DESKTOP NOTIFICATION: icon file:///alarm.png, title Alarm, text It's time to wake up!
+REPLACING NOTIFICATION New E-mail
+DESKTOP NOTIFICATION: icon file:///email.png, title New reply, text Correction, 8:15
+Showing notifications with replace ID...
+
+
diff --git a/LayoutTests/fast/notifications/notifications-replace.html b/LayoutTests/fast/notifications/notifications-replace.html
new file mode 100644 (file)
index 0000000..1200cc6
--- /dev/null
@@ -0,0 +1,39 @@
+<!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();
+            }
+
+            if (!window.webkitNotifications) {
+                log("FAIL: No webkitNotifications interface!");
+            }
+            
+            var M = window.webkitNotifications.createNotification("/email.png", "New E-mail", "Meet me tonight at 8!");
+            M.replaceId = "NewMail";
+            M.show();
+            var other = window.webkitNotifications.createNotification("/alarm.png", "Alarm", "It's time to wake up!");
+            other.show();
+            var N = window.webkitNotifications.createNotification("/email.png", "New reply", "Correction, 8:15");
+            N.replaceId = "NewMail";
+            N.show();          
+        }
+    </script>
+</head>
+<body>
+<p>Showing notifications with replace ID...</p>
+<div id="result"></div>
+<script type="text/javascript">
+runTests();
+</script>
+</body>
+</html>
diff --git a/LayoutTests/fast/notifications/notifications-rtl-expected.txt b/LayoutTests/fast/notifications/notifications-rtl-expected.txt
new file mode 100644 (file)
index 0000000..f2b01fc
--- /dev/null
@@ -0,0 +1,4 @@
+DESKTOP NOTIFICATION:(RTL) icon , title New E-mail, text Meet me tonight at 8!
+Showing a notification with direction "rtl"...
+
+
diff --git a/LayoutTests/fast/notifications/notifications-rtl.html b/LayoutTests/fast/notifications/notifications-rtl.html
new file mode 100644 (file)
index 0000000..b7c048b
--- /dev/null
@@ -0,0 +1,37 @@
+<!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();
+            }
+
+            if (!window.webkitNotifications) {
+                log("FAIL: No webkitNotifications interface!");
+            }
+            
+            var M = window.webkitNotifications.createNotification("", "New E-mail", "Meet me tonight at 8!");
+            M.dir = "rtl";
+            M.show();
+        }
+    </script>
+</head>
+<body>
+<p>Showing a notification with direction "rtl"...</p>
+    
+<div id="result"></div>
+   
+<script type="text/javascript">
+runTests();
+</script>
+
+</body>
+</html>
index 37d5b1b..c40bb31 100644 (file)
@@ -2846,3 +2846,9 @@ BUGWK24906 : fast/text/backslash-to-yen-sign.html = FAIL
 BUGWK24906 : fast/text/backslash-to-yen-sign-dynamic.html = FAIL
 
 BUGWK39655 : fast/dom/prototype-property.html = FAIL
+
+// temporarily mark these tests as failing until we can turn the feature
+// on in test_shell
+BUGWK39605 : fast/notifications/notifications-replace.html = FAIL
+BUGWK39605 : fast/notifications/notifications-rtl.html = FAIL
+
index 3c37867..c6f777a 100644 (file)
@@ -1,3 +1,23 @@
+2010-05-25  Dirk Pranke  <dpranke@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Re-commit r58765 - it had been rolled out to see if it was causing
+        a perf regression (in r59787), but that does not seem to have been
+        the case.
+
+        Tests: fast/notifications/notifications-replace.html
+               fast/notifications/notifications-rtl.html
+
+        https://bugs.webkit.org/show_bug.cgi?id=39605
+
+        * notifications/Notification.h:
+        (WebCore::Notification::dir):
+        (WebCore::Notification::setDir):
+        (WebCore::Notification::replaceId):
+        (WebCore::Notification::setReplaceId):
+        * notifications/Notification.idl:
+
 2010-05-22  Jer Noble  <jer.noble@apple.com>
 
         Reviewed by Adam Roben.
index 98cbfdf..47de2a2 100644 (file)
@@ -68,6 +68,11 @@ namespace WebCore {
         KURL iconURL() { return m_contents.icon(); }
         NotificationContents& contents() { return m_contents; }
 
+        String dir() const { return m_direction; }
+        void setDir(const String& dir) { m_direction = dir; }
+        String replaceId() const { return m_replaceId; }
+        void setReplaceId(const String& replaceId) { m_replaceId = replaceId; }
+
         DEFINE_ATTRIBUTE_EVENT_LISTENER(display);
         DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
         DEFINE_ATTRIBUTE_EVENT_LISTENER(close);
@@ -93,6 +98,9 @@ namespace WebCore {
         KURL m_notificationURL;
         NotificationContents m_contents;
 
+        String m_direction;
+        String m_replaceId;
+      
         bool m_isShowing;
 
         NotificationPresenter* m_presenter;
index 7f018b7..5ca84a5 100644 (file)
@@ -42,6 +42,9 @@ module threads {
         attribute EventListener onerror;
         attribute EventListener onclose;
 
+        attribute DOMString dir;
+        attribute DOMString replaceId;
+
         // EventTarget interface
         void addEventListener(in DOMString type, 
                               in EventListener listener, 
index 0a8cb0a..e183f44 100644 (file)
@@ -1,3 +1,16 @@
+2010-05-24  Dirk Pranke  <dpranke@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Re-commit r58765 - it had been rolled out to see if it was causing
+        a perf regression (in r59787 and r59789), but that does not seem to
+        have been the case.
+
+        * public/WebNotification.h:
+        * src/WebNotification.cpp:
+        (WebKit::WebNotification::dir):
+        (WebKit::WebNotification::replaceId):
+
 2010-05-25  Brett Wilson  <brettw@chromium.org>
 
         Reviewed by Darin Fisher.
         (WebKit::WebNotification::dir):
         (WebKit::WebNotification::replaceId):
 
-2010-05-18  Dirk Pranke  <dpranke@chromium.org>
-
-        Reviewed by Dimitri Glazkov.
-
-        Attempt to revert r58765 to see if it was causing a performance
-        regression.
-
-        https://bugs.webkit.org/show_bug.cgi?id=39328
-
-        * public/WebNotification.h:
-        * src/WebNotification.cpp:
-
 2010-05-19  Jian Li  <jianli@chromium.org>
 
         Reviewed by Darin Fisher.
index 9d64e2a..ab747e3 100644 (file)
@@ -75,6 +75,9 @@ public:
     WEBKIT_API WebString title() const;
     WEBKIT_API WebString body() const;
 
+    WEBKIT_API WebString dir() const;
+    WEBKIT_API WebString replaceId() const;
+
     // Called to indicate the notification has been displayed.
     WEBKIT_API void dispatchDisplayEvent();
 
index 5200d17..5ae1557 100644 (file)
@@ -94,6 +94,16 @@ WebString WebNotification::body() const
     return m_private->contents().body();
 }
 
+WebString WebNotification::dir() const
+{
+    return m_private->dir();
+}
+
+WebString WebNotification::replaceId() const
+{
+    return m_private->replaceId();
+}
+
 void WebNotification::dispatchDisplayEvent()
 {
     RefPtr<Event> event = Event::create("display", false, true);
index f7ed706..7368ea2 100644 (file)
@@ -1,3 +1,16 @@
+2010-05-24  Dirk Pranke  <dpranke@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Re-commit r58765 - it had been rolled out to see if it was causing
+        a perf regression (in r59787 and r59789), but that does not seem to
+        have been the case.
+
+        https://bugs.webkit.org/show_bug.cgi?id=39605
+
+        * DumpRenderTree/chromium/NotificationPresenter.cpp:
+        (NotificationPresenter::show):
+
 2010-05-25  Ojan Vafai  <ojan@chromium.org>
 
         Reviewed by Chris Jerdonek.
index 501b513..86903be 100644 (file)
@@ -52,11 +52,23 @@ void NotificationPresenter::grantPermission(const WebString& origin)
 // The output from all these methods matches what DumpRenderTree produces.
 bool NotificationPresenter::show(const WebNotification& notification)
 {
+    if (!notification.replaceId().isEmpty()) {
+        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, String(identifier.data(), identifier.length()));
+    }
+
     if (notification.isHTML()) {
         printf("DESKTOP NOTIFICATION: contents at %s\n",
                notification.url().spec().data());
     } else {
-        printf("DESKTOP NOTIFICATION: icon %s, title %s, text %s\n",
+        printf("DESKTOP NOTIFICATION:%s icon %s, title %s, text %s\n",
+               notification.dir() == "rtl" ? "(RTL)" : "",
                notification.iconURL().isEmpty() ? "" :
                notification.iconURL().spec().data(),
                notification.title().isEmpty() ? "" :