Changeset 102062 in webkit


Ignore:
Timestamp:
Dec 5, 2011 4:10:55 PM (12 years ago)
Author:
mario@webkit.org
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.

Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r102059 r102062  
     12011-12-05  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        [GTK] Move emissions of AtkDocument signals down to WebCore
     4        https://bugs.webkit.org/show_bug.cgi?id=73750
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Implement the needed infrastructure to allow notifying
     9        accessibility, in a cross-platform way, when a event related to
     10        the load of a document happens. Added a generic method, which will
     11        be called from the FrameLoader, and platform specific versions of
     12        it so every port has a chance to decide what to do with those
     13        notifications.
     14
     15        This patch doesn't include a new test because the one testing this
     16        functionality is the GTK-specific unit test added along with patch
     17        for bug 73746: testWebkitAtkDocumentLoadingEvents.
     18
     19        * accessibility/AXObjectCache.h:
     20        (WebCore::AXObjectCache::frameLoadingEventNotification): New, called
     21        from the FrameLoader to notify accessibility when an event happens.
     22        (WebCore::AXObjectCache::frameLoadingEventPlatformNotification): New,
     23        platform specific function to let ports decide what to do.
     24        * accessibility/AXObjectCache.cpp:
     25        (WebCore::AXObjectCache::frameLoadingEventNotification): New.
     26        * accessibility/chromium/AXObjectCacheChromium.cpp:
     27        (WebCore::AXObjectCache::frameLoadingEventPlatformNotification): Dummy
     28        implementation of the platform specific function for chromium.
     29        * accessibility/gtk/AXObjectCacheAtk.cpp:
     30        (WebCore::AXObjectCache::frameLoadingEventPlatformNotification):
     31        * accessibility/mac/AXObjectCacheMac.mm:
     32        (WebCore::AXObjectCache::frameLoadingEventPlatformNotification): Dummy
     33        implementation of the platform specific function for the Mac.
     34        * accessibility/win/AXObjectCacheWin.cpp:
     35        (WebCore::AXObjectCache::frameLoadingEventPlatformNotification): Dummy
     36        implementation of the platform specific function for Windows.
     37
     38        * loader/FrameLoader.cpp:
     39        (WebCore::FrameLoader::prepareForLoadStart): Notify accessibility
     40        by calling the new frameLoadingEventNotification() function.
     41        (WebCore::FrameLoader::checkLoadCompleteForThisFrame): Ditto.
     42
    1432011-12-05  Benjamin Poulain  <benjamin@webkit.org>
    244
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r101855 r102062  
    545545    nodeTextChangePlatformNotification(obj, textChange, offset, text);
    546546}
     547
     548void AXObjectCache::frameLoadingEventNotification(Frame* frame, AXLoadingEvent loadingEvent)
     549{
     550    if (!frame)
     551        return;
     552
     553    // Delegate on the right platform
     554    RenderView* contentRenderer = frame->contentRenderer();
     555    if (!contentRenderer)
     556        return;
     557
     558    AccessibilityObject* obj = getOrCreate(contentRenderer);
     559    frameLoadingEventPlatformNotification(obj, loadingEvent);
     560}
    547561#endif
    548562
  • trunk/Source/WebCore/accessibility/AXObjectCache.h

    r101855 r102062  
    150150    void nodeTextChangeNotification(RenderObject*, AXTextChange, unsigned offset, const String&);
    151151
     152    enum AXLoadingEvent {
     153        AXLoadingStarted,
     154        AXLoadingReloaded,
     155        AXLoadingFailed,
     156        AXLoadingFinished
     157    };
     158
     159    void frameLoadingEventNotification(Frame*, AXLoadingEvent);
     160
    152161    bool nodeHasRole(Node*, const AtomicString& role);
    153162
     
    155164    void postPlatformNotification(AccessibilityObject*, AXNotification);
    156165    void nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned offset, const String&);
     166    void frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent);
    157167
    158168private:
     
    190200inline void AXObjectCache::nodeTextChangeNotification(RenderObject*, AXTextChange, unsigned, const String&) { }
    191201inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&) { }
     202inline void AXObjectCache::frameLoadingEventNotification(Frame*, AXLoadingEvent) { }
     203inline void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent) { }
    192204inline void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject*) { }
    193205inline void AXObjectCache::handleScrolledToAnchor(const Node*) { }
  • trunk/Source/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp

    r101349 r102062  
    108108}
    109109
     110void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent)
     111{
     112}
     113
    110114void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject* newFocusedRenderer)
    111115{
  • trunk/Source/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp

    r101349 r102062  
    182182void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject* object, AXTextChange textChange, unsigned offset, const String& text)
    183183{
    184     // Sanity check
    185184    if (!object || !object->isAccessibilityRenderObject() || text.isEmpty())
    186185        return;
     
    189188    RefPtr<Range> range = Range::create(node->document(), node->parentNode(), 0, node, 0);
    190189    emitTextChanged(object, textChange, offset + TextIterator::rangeLength(range.get()), text);
     190}
     191
     192void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject* object, AXLoadingEvent loadingEvent)
     193{
     194    if (!object)
     195        return;
     196
     197    AtkObject* axObject = object->wrapper();
     198    if (!axObject || !ATK_IS_DOCUMENT(axObject))
     199        return;
     200
     201    switch (loadingEvent) {
     202    case AXObjectCache::AXLoadingStarted:
     203        g_signal_emit_by_name(axObject, "state-change", "busy", true);
     204        break;
     205    case AXObjectCache::AXLoadingReloaded:
     206        g_signal_emit_by_name(axObject, "state-change", "busy", true);
     207        g_signal_emit_by_name(axObject, "reload");
     208        break;
     209    case AXObjectCache::AXLoadingFailed:
     210        g_signal_emit_by_name(axObject, "load-stopped");
     211        g_signal_emit_by_name(axObject, "state-change", "busy", false);
     212        break;
     213    case AXObjectCache::AXLoadingFinished:
     214        g_signal_emit_by_name(axObject, "load-complete");
     215        g_signal_emit_by_name(axObject, "state-change", "busy", false);
     216        break;
     217    }
    191218}
    192219
  • trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm

    r101349 r102062  
    133133}
    134134
     135void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent)
     136{
     137}
     138
    135139void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject*)
    136140{
  • trunk/Source/WebCore/accessibility/win/AXObjectCacheWin.cpp

    r101349 r102062  
    112112}
    113113
     114void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent)
     115{
     116}
     117
    114118AXID AXObjectCache::platformGenerateAXID() const
    115119{
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r101486 r102062  
    3636#include "FrameLoader.h"
    3737
     38#include "AXObjectCache.h"
    3839#include "ApplicationCacheHost.h"
    3940#include "BackForwardController.h"
     
    11151116        page->progress()->progressStarted(m_frame);
    11161117    m_client->dispatchDidStartProvisionalLoad();
     1118
     1119    // Notify accessibility.
     1120    if (AXObjectCache::accessibilityEnabled()) {
     1121        AXObjectCache::AXLoadingEvent loadingEvent = loadType() == FrameLoadTypeReload ? AXObjectCache::AXLoadingReloaded : AXObjectCache::AXLoadingStarted;
     1122        m_frame->document()->axObjectCache()->frameLoadingEventNotification(m_frame, loadingEvent);
     1123    }
    11171124}
    11181125
     
    22702277
    22712278            const ResourceError& error = dl->mainDocumentError();
    2272             if (!error.isNull())
     2279
     2280            AXObjectCache::AXLoadingEvent loadingEvent;
     2281            if (!error.isNull()) {
    22732282                m_client->dispatchDidFailLoad(error);
    2274             else
     2283                loadingEvent = AXObjectCache::AXLoadingFailed;
     2284            } else {
    22752285                m_client->dispatchDidFinishLoad();
     2286                loadingEvent = AXObjectCache::AXLoadingFinished;
     2287            }
     2288
     2289            // Notify accessibility.
     2290            if (AXObjectCache::accessibilityEnabled())
     2291                m_frame->document()->axObjectCache()->frameLoadingEventNotification(m_frame, loadingEvent);
    22762292
    22772293            return;
  • trunk/Source/WebKit/gtk/ChangeLog

    r101960 r102062  
     12011-12-05  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        [GTK] Move emissions of AtkDocument signals down to WebCore
     4        https://bugs.webkit.org/show_bug.cgi?id=73750
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Removed code for emission of AtkDocument signals.
     9
     10        * WebCoreSupport/FrameLoaderClientGtk.cpp:
     11        (WebKit::notifyStatus): Removed no longer used code.
     12
    1132011-12-04  Mario Sanchez Prada  <msanchez@igalia.com>
    214
  • trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp

    r101933 r102062  
    2727#include "FrameLoaderClientGtk.h"
    2828
    29 #include "AXObjectCache.h"
    30 #include "AccessibilityObject.h"
    3129#include "ArchiveResource.h"
    3230#include "CachedFrame.h"
     
    125123}
    126124
    127 static void notifyAccessibilityStatus(WebKitWebFrame* frame, WebKitLoadStatus loadStatus)
    128 {
    129     if (loadStatus != WEBKIT_LOAD_PROVISIONAL
    130         && loadStatus != WEBKIT_LOAD_FAILED
    131         && loadStatus != WEBKIT_LOAD_FINISHED)
    132         return;
    133 
    134     WebKitWebFramePrivate* priv = frame->priv;
    135     if (!priv->coreFrame || !priv->coreFrame->document())
    136         return;
    137 
    138     RenderView* contentRenderer = priv->coreFrame->contentRenderer();
    139     if (!contentRenderer)
    140         return;
    141 
    142     AXObjectCache* axObjectCache = priv->coreFrame->document()->axObjectCache();
    143     if (!axObjectCache)
    144         return;
    145 
    146     AccessibilityObject* coreAxObject = axObjectCache->getOrCreate(contentRenderer);
    147     if (!coreAxObject)
    148         return;
    149 
    150     AtkObject* axObject = coreAxObject->wrapper();
    151     if (!axObject || !ATK_IS_DOCUMENT(axObject))
    152         return;
    153 
    154     switch (loadStatus) {
    155     case WEBKIT_LOAD_PROVISIONAL:
    156         g_signal_emit_by_name(axObject, "state-change", "busy", true);
    157         if (core(frame)->loader()->loadType() == FrameLoadTypeReload)
    158             g_signal_emit_by_name(axObject, "reload");
    159         break;
    160     case WEBKIT_LOAD_FAILED:
    161         g_signal_emit_by_name(axObject, "load-stopped");
    162         g_signal_emit_by_name(axObject, "state-change", "busy", false);
    163         break;
    164     case WEBKIT_LOAD_FINISHED:
    165         g_signal_emit_by_name(axObject, "load-complete");
    166         g_signal_emit_by_name(axObject, "state-change", "busy", false);
    167     default:
    168         break;
    169     }
    170 }
    171 
    172125static void notifyStatus(WebKitWebFrame* frame, WebKitLoadStatus loadStatus)
    173126{
     
    179132        webView->priv->loadStatus = loadStatus;
    180133        g_object_notify(G_OBJECT(webView), "load-status");
    181 
    182         if (AXObjectCache::accessibilityEnabled())
    183             notifyAccessibilityStatus(frame, loadStatus);
    184134    }
    185135}
Note: See TracChangeset for help on using the changeset viewer.