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

mario at webkit.org mario at webkit.org
Wed Dec 22 16:35:05 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 5464ec5f36be9e4461b5edd8ceda96be455fff3a
Author: mario at webkit.org <mario at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 26 16:18:28 2010 +0000

    2010-11-26  Mario Sanchez Prada  <msanchez at igalia.com>
    
            Reviewed by Xan Lopez.
    
            [GTK] events missing when a document is (re)loaded
            https://bugs.webkit.org/show_bug.cgi?id=25831
    
            Make sure webArea returns a proper name and that a signal
            'state-change::defunct' is emitted when detaching the wrapper.
    
            * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
            (webkit_accessible_get_name): Returns the current document's title
            as fallback mechanism for webArea objects.
            (webkit_accessible_detach): Emit 'state-change::defunct' function
            as soon as the wrapper is detached from the related core object.
    2010-11-26  Mario Sanchez Prada  <msanchez at igalia.com>
    
            Reviewed by Xan Lopez.
    
            [GTK] events missing when a document is (re)loaded
            https://bugs.webkit.org/show_bug.cgi?id=25831
    
            Emit the right signals when reloading a document.
    
            * WebCoreSupport/FrameLoaderClientGtk.cpp:
            (WebKit::notifyAccessibilityStatus): New function, to make sure
            the signals involved in reloading a document are properly emitted.
            (WebKit::notifyStatus): Also notify accessibility if enabled.
    
            New unit test to check the signals are being actually emitted.
    
            * tests/testatk.c:
            (stateChangedCb): Callback for 'state-change' signal emitted by
            the accessible object associated to the webView.
            (documentReloadCb): Callback for 'reload' signal.
            (documentLoadCompleteCb): Callback for 'load-complete' signal.
            (webviewLoadStatusChangedCb): Callback for 'notify::load-status'
            signal, emitted by the WebKitWebView object (not the AtkObject).
            (testWebkitAtkDocumentReloadEvents): New unit test.
            (main): Added the new unit test.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72764 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f3007ed..54c7ab3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-11-26  Mario Sanchez Prada  <msanchez at igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        [GTK] events missing when a document is (re)loaded
+        https://bugs.webkit.org/show_bug.cgi?id=25831
+
+        Make sure webArea returns a proper name and that a signal
+        'state-change::defunct' is emitted when detaching the wrapper.
+
+        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
+        (webkit_accessible_get_name): Returns the current document's title
+        as fallback mechanism for webArea objects.
+        (webkit_accessible_detach): Emit 'state-change::defunct' function
+        as soon as the wrapper is detached from the related core object.
+
 2010-11-26  Sergio Villar Senin  <svillar at igalia.com>
 
         Reviewed by Xan Lopez.
diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
index 3d4345a..3156505 100644
--- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
+++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
@@ -171,7 +171,7 @@ static const gchar* webkit_accessible_get_name(AtkObject* object)
                 return webkit_accessible_text_get_text(ATK_TEXT(atkObject), 0, -1);
         }
 
-        // Try text under the node
+        // Try text under the node.
         String textUnder = renderObject->textUnderElement();
         if (textUnder.length())
             return returnString(textUnder);
@@ -187,6 +187,13 @@ static const gchar* webkit_accessible_get_name(AtkObject* object)
         }
     }
 
+    // Fallback for the webArea object: just return the document's title.
+    if (renderObject->isWebArea()) {
+        Document* document = coreObject->document();
+        if (document)
+            return returnString(document->title());
+    }
+
     return returnString(coreObject->stringValue());
 }
 
@@ -2296,6 +2303,9 @@ void webkit_accessible_detach(WebKitAccessible* accessible)
 {
     ASSERT(accessible->m_object);
 
+    if (core(accessible)->roleValue() == WebAreaRole)
+        g_signal_emit_by_name(accessible, "state-change", "defunct", true);
+
     // We replace the WebCore AccessibilityObject with a fallback object that
     // provides default implementations to avoid repetitive null-checking after
     // detachment.
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index d608e77..9199e3c 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,29 @@
+2010-11-26  Mario Sanchez Prada  <msanchez at igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        [GTK] events missing when a document is (re)loaded
+        https://bugs.webkit.org/show_bug.cgi?id=25831
+
+        Emit the right signals when reloading a document.
+
+        * WebCoreSupport/FrameLoaderClientGtk.cpp:
+        (WebKit::notifyAccessibilityStatus): New function, to make sure
+        the signals involved in reloading a document are properly emitted.
+        (WebKit::notifyStatus): Also notify accessibility if enabled.
+
+        New unit test to check the signals are being actually emitted.
+
+        * tests/testatk.c:
+        (stateChangedCb): Callback for 'state-change' signal emitted by
+        the accessible object associated to the webView.
+        (documentReloadCb): Callback for 'reload' signal.
+        (documentLoadCompleteCb): Callback for 'load-complete' signal.
+        (webviewLoadStatusChangedCb): Callback for 'notify::load-status'
+        signal, emitted by the WebKitWebView object (not the AtkObject).
+        (testWebkitAtkDocumentReloadEvents): New unit test.
+        (main): Added the new unit test.
+
 2010-11-24  Xan Lopez  <xlopez at igalia.com>
 
         Reviewed by Martin Robinson.
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
index fdef9dc..e7a2457 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
@@ -25,6 +25,7 @@
 #include "config.h"
 #include "FrameLoaderClientGtk.h"
 
+#include "AXObjectCache.h"
 #include "ArchiveResource.h"
 #include "CachedFrame.h"
 #include "Color.h"
@@ -208,6 +209,34 @@ String FrameLoaderClient::userAgent(const KURL& url)
     return String::fromUTF8(webkit_web_settings_get_user_agent(settings));
 }
 
+static void notifyAccessibilityStatus(WebKitWebFrame* frame, WebKitLoadStatus loadStatus)
+{
+    WebKitWebView* webView = getViewFromFrame(frame);
+    if (!webView || frame != webkit_web_view_get_main_frame(webView))
+        return;
+
+    AtkObject* axObject = gtk_widget_get_accessible(GTK_WIDGET(webView));
+    if (!axObject || !ATK_IS_DOCUMENT(axObject))
+        return;
+
+    switch (loadStatus) {
+    case WEBKIT_LOAD_PROVISIONAL:
+        g_signal_emit_by_name(axObject, "state-change", "busy", true);
+        if (core(frame)->loader()->loadType() == FrameLoadTypeReload)
+            g_signal_emit_by_name(axObject, "reload");
+        break;
+    case WEBKIT_LOAD_FAILED:
+        g_signal_emit_by_name(axObject, "load-stopped");
+        g_signal_emit_by_name(axObject, "state-change", "busy", false);
+        break;
+    case WEBKIT_LOAD_FINISHED:
+        g_signal_emit_by_name(axObject, "load-complete");
+        g_signal_emit_by_name(axObject, "state-change", "busy", false);
+    default:
+        break;
+    }
+}
+
 static void notifyStatus(WebKitWebFrame* frame, WebKitLoadStatus loadStatus)
 {
     frame->priv->loadStatus = loadStatus;
@@ -218,6 +247,9 @@ static void notifyStatus(WebKitWebFrame* frame, WebKitLoadStatus loadStatus)
         webView->priv->loadStatus = loadStatus;
         g_object_notify(G_OBJECT(webView), "load-status");
     }
+
+    if (AXObjectCache::accessibilityEnabled())
+        notifyAccessibilityStatus(frame, loadStatus);
 }
 
 static void loadDone(WebKitWebFrame* frame, bool didSucceed)
diff --git a/WebKit/gtk/tests/testatk.c b/WebKit/gtk/tests/testatk.c
index f098f62..94f4a96 100644
--- a/WebKit/gtk/tests/testatk.c
+++ b/WebKit/gtk/tests/testatk.c
@@ -21,6 +21,7 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 #include <gtk/gtk.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <webkit/webkit.h>
 
@@ -221,6 +222,78 @@ static void runGetTextTests(AtkText* textObject)
                         0, "This is a test. This is the second sentence. And this the third.", 0, 64);
 }
 
+static void stateChangedCb(AtkObject* object, gchar* stateName, gboolean stateSet, gpointer unused)
+{
+    /* Only 'defunct' and 'busy' state changes are considered. */
+    if (!g_strcmp0(stateName, "defunct")) {
+        g_print("[defunct]");
+        return;
+    }
+
+    if (!g_strcmp0(stateName, "busy")) {
+        g_print("[busy:%d]", stateSet);
+        /* If 'busy' state is unset, it means we're done. */
+        if (!stateSet)
+            exit(0);
+    }
+}
+
+static void documentReloadCb(AtkDocument* document, gpointer unused)
+{
+    g_print("[reloaded]");
+}
+
+static void documentLoadCompleteCb(AtkDocument* document, gpointer unused)
+{
+    g_print("[load completed]");
+}
+
+static void webviewLoadStatusChangedCb(WebKitWebView* webView, GParamSpec* pspec, gpointer unused)
+{
+    /* We need to explicitly connect here to the signals emitted by
+     * the AtkObject associated to the webView because the AtkObject
+     * iniatially associated at the beginning of the process (when in
+     * the LOAD_PROVISIONAL state) will get destroyed and replaced by
+     * a new one later on, when the LOAD_COMMITED state is reached. */
+    WebKitLoadStatus loadStatus = webkit_web_view_get_load_status(webView);
+    if (loadStatus == WEBKIT_LOAD_PROVISIONAL || loadStatus == WEBKIT_LOAD_COMMITTED) {
+        AtkObject* axWebView = gtk_widget_get_accessible(GTK_WIDGET(webView));
+        g_assert(ATK_IS_DOCUMENT(axWebView));
+
+        g_signal_connect(axWebView, "state-change", G_CALLBACK(stateChangedCb), 0);
+        g_signal_connect(axWebView, "reload", G_CALLBACK(documentReloadCb), 0);
+        g_signal_connect(axWebView, "load-complete", G_CALLBACK(documentLoadCompleteCb), 0);
+    }
+}
+
+static void testWebkitAtkDocumentReloadEvents()
+{
+    WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
+    g_object_ref_sink(webView);
+    GtkAllocation allocation = { 0, 0, 800, 600 };
+    gtk_widget_size_allocate(GTK_WIDGET(webView), &allocation);
+
+    webkit_web_view_load_string(webView, contents, 0, 0, 0);
+
+    /* Wait for the accessible objects to be created. */
+    waitForAccessibleObjects();
+
+    AtkObject* axWebView = gtk_widget_get_accessible(GTK_WIDGET(webView));
+    g_assert(ATK_IS_DOCUMENT(axWebView));
+
+    if (g_test_trap_fork (2000000, G_TEST_TRAP_SILENCE_STDOUT)) {
+        g_signal_connect(webView, "notify::load-status", G_CALLBACK(webviewLoadStatusChangedCb), 0);
+        webkit_web_view_reload(webView);
+    }
+
+    /* Check results. */
+    g_test_trap_assert_passed();
+    g_test_trap_assert_stdout("[busy:1][reloaded][defunct][load completed][busy:0]");
+
+    g_object_unref(webView);
+}
+
+
 static void testWebkitAtkGetTextAtOffsetForms()
 {
     WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
@@ -1211,6 +1284,7 @@ int main(int argc, char** argv)
     gtk_test_init(&argc, &argv, 0);
 
     g_test_bug_base("https://bugs.webkit.org/");
+    g_test_add_func("/webkit/atk/documentReloadEvents", testWebkitAtkDocumentReloadEvents);
     g_test_add_func("/webkit/atk/getTextAtOffset", testWebkitAtkGetTextAtOffset);
     g_test_add_func("/webkit/atk/getTextAtOffsetForms", testWebkitAtkGetTextAtOffsetForms);
     g_test_add_func("/webkit/atk/getTextAtOffsetNewlines", testWebkitAtkGetTextAtOffsetNewlines);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list