Title: [102062] trunk/Source
Revision
102062
Author
[email protected]
Date
2011-12-05 16:10:55 -0800 (Mon, 05 Dec 2011)

Log Message

[GTK] Move emissions of AtkDocument signals down to WebCore
https://bugs.webkit.org/show_bug.cgi?id=73750

Reviewed by Chris Fleizach.

Source/WebCore:

Implement the needed infrastructure to allow notifying
accessibility, in a cross-platform way, when a event related to
the load of a document happens. Added a generic method, which will
be called from the FrameLoader, and platform specific versions of
it so every port has a chance to decide what to do with those
notifications.

This patch doesn't include a new test because the one testing this
functionality is the GTK-specific unit test added along with patch
for bug 73746: testWebkitAtkDocumentLoadingEvents.

* accessibility/AXObjectCache.h:
(WebCore::AXObjectCache::frameLoadingEventNotification): New, called
from the FrameLoader to notify accessibility when an event happens.
(WebCore::AXObjectCache::frameLoadingEventPlatformNotification): New,
platform specific function to let ports decide what to do.
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::frameLoadingEventNotification): New.
* accessibility/chromium/AXObjectCacheChromium.cpp:
(WebCore::AXObjectCache::frameLoadingEventPlatformNotification): Dummy
implementation of the platform specific function for chromium.
* accessibility/gtk/AXObjectCacheAtk.cpp:
(WebCore::AXObjectCache::frameLoadingEventPlatformNotification):
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::frameLoadingEventPlatformNotification): Dummy
implementation of the platform specific function for the Mac.
* accessibility/win/AXObjectCacheWin.cpp:
(WebCore::AXObjectCache::frameLoadingEventPlatformNotification): Dummy
implementation of the platform specific function for Windows.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::prepareForLoadStart): Notify accessibility
by calling the new frameLoadingEventNotification() function.
(WebCore::FrameLoader::checkLoadCompleteForThisFrame): Ditto.

Source/WebKit/gtk:

Removed code for emission of AtkDocument signals.

* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::notifyStatus): Removed no longer used code.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102061 => 102062)


--- trunk/Source/WebCore/ChangeLog	2011-12-06 00:06:21 UTC (rev 102061)
+++ trunk/Source/WebCore/ChangeLog	2011-12-06 00:10:55 UTC (rev 102062)
@@ -1,3 +1,45 @@
+2011-12-05  Mario Sanchez Prada  <[email protected]>
+
+        [GTK] Move emissions of AtkDocument signals down to WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=73750
+
+        Reviewed by Chris Fleizach.
+
+        Implement the needed infrastructure to allow notifying
+        accessibility, in a cross-platform way, when a event related to
+        the load of a document happens. Added a generic method, which will
+        be called from the FrameLoader, and platform specific versions of
+        it so every port has a chance to decide what to do with those
+        notifications.
+
+        This patch doesn't include a new test because the one testing this
+        functionality is the GTK-specific unit test added along with patch
+        for bug 73746: testWebkitAtkDocumentLoadingEvents.
+
+        * accessibility/AXObjectCache.h:
+        (WebCore::AXObjectCache::frameLoadingEventNotification): New, called
+        from the FrameLoader to notify accessibility when an event happens.
+        (WebCore::AXObjectCache::frameLoadingEventPlatformNotification): New,
+        platform specific function to let ports decide what to do.
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::frameLoadingEventNotification): New.
+        * accessibility/chromium/AXObjectCacheChromium.cpp:
+        (WebCore::AXObjectCache::frameLoadingEventPlatformNotification): Dummy
+        implementation of the platform specific function for chromium.
+        * accessibility/gtk/AXObjectCacheAtk.cpp:
+        (WebCore::AXObjectCache::frameLoadingEventPlatformNotification):
+        * accessibility/mac/AXObjectCacheMac.mm:
+        (WebCore::AXObjectCache::frameLoadingEventPlatformNotification): Dummy
+        implementation of the platform specific function for the Mac.
+        * accessibility/win/AXObjectCacheWin.cpp:
+        (WebCore::AXObjectCache::frameLoadingEventPlatformNotification): Dummy
+        implementation of the platform specific function for Windows.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::prepareForLoadStart): Notify accessibility
+        by calling the new frameLoadingEventNotification() function.
+        (WebCore::FrameLoader::checkLoadCompleteForThisFrame): Ditto.
+
 2011-12-05  Benjamin Poulain  <[email protected]>
 
         Update String::containsOnlyASCII() to handle 8 bits strings

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (102061 => 102062)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2011-12-06 00:06:21 UTC (rev 102061)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2011-12-06 00:10:55 UTC (rev 102062)
@@ -544,6 +544,20 @@
     AccessibilityObject* obj = getOrCreate(renderer);
     nodeTextChangePlatformNotification(obj, textChange, offset, text);
 }
+
+void AXObjectCache::frameLoadingEventNotification(Frame* frame, AXLoadingEvent loadingEvent)
+{
+    if (!frame)
+        return;
+
+    // Delegate on the right platform
+    RenderView* contentRenderer = frame->contentRenderer();
+    if (!contentRenderer)
+        return;
+
+    AccessibilityObject* obj = getOrCreate(contentRenderer);
+    frameLoadingEventPlatformNotification(obj, loadingEvent);
+}
 #endif
 
 #if HAVE(ACCESSIBILITY)

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (102061 => 102062)


--- trunk/Source/WebCore/accessibility/AXObjectCache.h	2011-12-06 00:06:21 UTC (rev 102061)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h	2011-12-06 00:10:55 UTC (rev 102062)
@@ -149,11 +149,21 @@
 
     void nodeTextChangeNotification(RenderObject*, AXTextChange, unsigned offset, const String&);
 
+    enum AXLoadingEvent {
+        AXLoadingStarted,
+        AXLoadingReloaded,
+        AXLoadingFailed,
+        AXLoadingFinished
+    };
+
+    void frameLoadingEventNotification(Frame*, AXLoadingEvent);
+
     bool nodeHasRole(Node*, const AtomicString& role);
 
 protected:
     void postPlatformNotification(AccessibilityObject*, AXNotification);
     void nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned offset, const String&);
+    void frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent);
 
 private:
     Document* m_document;
@@ -189,6 +199,8 @@
 inline void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNotification) { }
 inline void AXObjectCache::nodeTextChangeNotification(RenderObject*, AXTextChange, unsigned, const String&) { }
 inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&) { }
+inline void AXObjectCache::frameLoadingEventNotification(Frame*, AXLoadingEvent) { }
+inline void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent) { }
 inline void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject*) { }
 inline void AXObjectCache::handleScrolledToAnchor(const Node*) { }
 inline void AXObjectCache::contentChanged(RenderObject*) { }

Modified: trunk/Source/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp (102061 => 102062)


--- trunk/Source/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp	2011-12-06 00:06:21 UTC (rev 102061)
+++ trunk/Source/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp	2011-12-06 00:10:55 UTC (rev 102062)
@@ -107,6 +107,10 @@
 {
 }
 
+void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent)
+{
+}
+
 void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject* newFocusedRenderer)
 {
     if (!newFocusedRenderer)

Modified: trunk/Source/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp (102061 => 102062)


--- trunk/Source/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp	2011-12-06 00:06:21 UTC (rev 102061)
+++ trunk/Source/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp	2011-12-06 00:10:55 UTC (rev 102062)
@@ -181,7 +181,6 @@
 
 void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject* object, AXTextChange textChange, unsigned offset, const String& text)
 {
-    // Sanity check
     if (!object || !object->isAccessibilityRenderObject() || text.isEmpty())
         return;
 
@@ -190,6 +189,34 @@
     emitTextChanged(object, textChange, offset + TextIterator::rangeLength(range.get()), text);
 }
 
+void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject* object, AXLoadingEvent loadingEvent)
+{
+    if (!object)
+        return;
+
+    AtkObject* axObject = object->wrapper();
+    if (!axObject || !ATK_IS_DOCUMENT(axObject))
+        return;
+
+    switch (loadingEvent) {
+    case AXObjectCache::AXLoadingStarted:
+        g_signal_emit_by_name(axObject, "state-change", "busy", true);
+        break;
+    case AXObjectCache::AXLoadingReloaded:
+        g_signal_emit_by_name(axObject, "state-change", "busy", true);
+        g_signal_emit_by_name(axObject, "reload");
+        break;
+    case AXObjectCache::AXLoadingFailed:
+        g_signal_emit_by_name(axObject, "load-stopped");
+        g_signal_emit_by_name(axObject, "state-change", "busy", false);
+        break;
+    case AXObjectCache::AXLoadingFinished:
+        g_signal_emit_by_name(axObject, "load-complete");
+        g_signal_emit_by_name(axObject, "state-change", "busy", false);
+        break;
+    }
+}
+
 void AXObjectCache::handleFocusedUIElementChanged(RenderObject* oldFocusedRender, RenderObject* newFocusedRender)
 {
     RefPtr<AccessibilityObject> oldObject = getOrCreate(oldFocusedRender);

Modified: trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm (102061 => 102062)


--- trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm	2011-12-06 00:06:21 UTC (rev 102061)
+++ trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm	2011-12-06 00:10:55 UTC (rev 102062)
@@ -132,6 +132,10 @@
 {
 }
 
+void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent)
+{
+}
+
 void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject*)
 {
     wkAccessibilityHandleFocusChanged();

Modified: trunk/Source/WebCore/accessibility/win/AXObjectCacheWin.cpp (102061 => 102062)


--- trunk/Source/WebCore/accessibility/win/AXObjectCacheWin.cpp	2011-12-06 00:06:21 UTC (rev 102061)
+++ trunk/Source/WebCore/accessibility/win/AXObjectCacheWin.cpp	2011-12-06 00:10:55 UTC (rev 102062)
@@ -111,6 +111,10 @@
 {
 }
 
+void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent)
+{
+}
+
 AXID AXObjectCache::platformGenerateAXID() const
 {
     static AXID lastUsedID = 0;

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (102061 => 102062)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2011-12-06 00:06:21 UTC (rev 102061)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2011-12-06 00:10:55 UTC (rev 102062)
@@ -35,6 +35,7 @@
 #include "config.h"
 #include "FrameLoader.h"
 
+#include "AXObjectCache.h"
 #include "ApplicationCacheHost.h"
 #include "BackForwardController.h"
 #include "BeforeUnloadEvent.h"
@@ -1114,6 +1115,12 @@
     if (Page* page = m_frame->page())
         page->progress()->progressStarted(m_frame);
     m_client->dispatchDidStartProvisionalLoad();
+
+    // Notify accessibility.
+    if (AXObjectCache::accessibilityEnabled()) {
+        AXObjectCache::AXLoadingEvent loadingEvent = loadType() == FrameLoadTypeReload ? AXObjectCache::AXLoadingReloaded : AXObjectCache::AXLoadingStarted;
+        m_frame->document()->axObjectCache()->frameLoadingEventNotification(m_frame, loadingEvent);
+    }
 }
 
 void FrameLoader::setupForReplace()
@@ -2269,11 +2276,20 @@
                 page->progress()->progressCompleted(m_frame);
 
             const ResourceError& error = dl->mainDocumentError();
-            if (!error.isNull())
+
+            AXObjectCache::AXLoadingEvent loadingEvent;
+            if (!error.isNull()) {
                 m_client->dispatchDidFailLoad(error);
-            else
+                loadingEvent = AXObjectCache::AXLoadingFailed;
+            } else {
                 m_client->dispatchDidFinishLoad();
+                loadingEvent = AXObjectCache::AXLoadingFinished;
+            }
 
+            // Notify accessibility.
+            if (AXObjectCache::accessibilityEnabled())
+                m_frame->document()->axObjectCache()->frameLoadingEventNotification(m_frame, loadingEvent);
+
             return;
         }
         

Modified: trunk/Source/WebKit/gtk/ChangeLog (102061 => 102062)


--- trunk/Source/WebKit/gtk/ChangeLog	2011-12-06 00:06:21 UTC (rev 102061)
+++ trunk/Source/WebKit/gtk/ChangeLog	2011-12-06 00:10:55 UTC (rev 102062)
@@ -1,3 +1,15 @@
+2011-12-05  Mario Sanchez Prada  <[email protected]>
+
+        [GTK] Move emissions of AtkDocument signals down to WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=73750
+
+        Reviewed by Chris Fleizach.
+
+        Removed code for emission of AtkDocument signals.
+
+        * WebCoreSupport/FrameLoaderClientGtk.cpp:
+        (WebKit::notifyStatus): Removed no longer used code.
+
 2011-12-04  Mario Sanchez Prada  <[email protected]>
 
         [Gtk] Check for the load-complete event only in the unit tests.

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp (102061 => 102062)


--- trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp	2011-12-06 00:06:21 UTC (rev 102061)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp	2011-12-06 00:10:55 UTC (rev 102062)
@@ -26,8 +26,6 @@
 #include "config.h"
 #include "FrameLoaderClientGtk.h"
 
-#include "AXObjectCache.h"
-#include "AccessibilityObject.h"
 #include "ArchiveResource.h"
 #include "CachedFrame.h"
 #include "Color.h"
@@ -124,51 +122,6 @@
     return String::fromUTF8(userAgentString.get());
 }
 
-static void notifyAccessibilityStatus(WebKitWebFrame* frame, WebKitLoadStatus loadStatus)
-{
-    if (loadStatus != WEBKIT_LOAD_PROVISIONAL
-        && loadStatus != WEBKIT_LOAD_FAILED
-        && loadStatus != WEBKIT_LOAD_FINISHED)
-        return;
-
-    WebKitWebFramePrivate* priv = frame->priv;
-    if (!priv->coreFrame || !priv->coreFrame->document())
-        return;
-
-    RenderView* contentRenderer = priv->coreFrame->contentRenderer();
-    if (!contentRenderer)
-        return;
-
-    AXObjectCache* axObjectCache = priv->coreFrame->document()->axObjectCache();
-    if (!axObjectCache)
-        return;
-
-    AccessibilityObject* coreAxObject = axObjectCache->getOrCreate(contentRenderer);
-    if (!coreAxObject)
-        return;
-
-    AtkObject* axObject = coreAxObject->wrapper();
-    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;
@@ -178,9 +131,6 @@
     if (frame == webkit_web_view_get_main_frame(webView)) {
         webView->priv->loadStatus = loadStatus;
         g_object_notify(G_OBJECT(webView), "load-status");
-
-        if (AXObjectCache::accessibilityEnabled())
-            notifyAccessibilityStatus(frame, loadStatus);
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to