Changeset 48368 in webkit


Ignore:
Timestamp:
Sep 14, 2009 2:25:24 PM (15 years ago)
Author:
jhoneycutt@apple.com
Message:

DRT/test part of
<rdar://problem/7197644> WebKit should broadcast an MSAA event when
jumping to a named anchor

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

Reviewed by Adam Roben.

WebKitTools:

  • DumpRenderTree/AccessibilityController.cpp:

(logScrollingStartEventsCallback):
Turn on logging of scrolling start events.
(AccessibilityController::getJSClass):
Add a "logScrollingStartEvents" to the AccessibilityController's JS
class definition.
(AccessibilityController::resetToConsistentState):
Turn off logging of scrolling start events.

  • DumpRenderTree/AccessibilityController.h:

Declare setLogScrollingStartEvents(). Add a member for the scrolling
start event hook.

  • DumpRenderTree/mac/AccessibilityControllerMac.cpp:

(AccessibilityController::setLogScrollingStartEvents):
Stubbed.

  • DumpRenderTree/win/AccessibilityControllerWin.cpp:

(AccessibilityController::AccessibilityController):
Initialize the handle to 0.
(logEventProc):
Renamed from logFocusEventProc; now logs scrolling start events, too.
Removed the assertion that the event is a focus event. Added a switch
to print a message for focus, scrolling start, and other, unknown
events.
(AccessibilityController::setLogFocusEvents):
Changed to use logEventProc.
(AccessibilityController::setLogScrollingStartEvents):
If turning logging off, unhook the scrolling start event hook, and clear
the member holding the handle. If turning on, query for the root
accessible, so that accessibility is enabled for the WebView, and call
SetWinEventHook to setup an event hook using logEventProc as the
callback function.

LayoutTests:

  • platform/win/accessibility/scroll-to-anchor-expected.txt: Added.
  • platform/win/accessibility/scroll-to-anchor.html:

Added. Turns on scrolling start event logging, then jumps to an
anchor at the bottom of the page.

Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r48363 r48368  
     12009-09-11  Jon Honeycutt  <jhoneycutt@apple.com>
     2
     3        DRT/test part of
     4        <rdar://problem/7197644> WebKit should broadcast an MSAA event when
     5        jumping to a named anchor
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=28899
     8
     9        Reviewed by Adam Roben.
     10
     11        * platform/win/accessibility/scroll-to-anchor-expected.txt: Added.
     12        * platform/win/accessibility/scroll-to-anchor.html:
     13        Added. Turns on scrolling start event logging, then jumps to an
     14        anchor at the bottom of the page.
     15
    1162009-09-14  Brady Eidson  <beidson@apple.com>
    217
  • trunk/WebKitTools/ChangeLog

    r48365 r48368  
     12009-09-11  Jon Honeycutt  <jhoneycutt@apple.com>
     2
     3        DRT/test part of
     4        <rdar://problem/7197644> WebKit should broadcast an MSAA event when
     5        jumping to a named anchor
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=28899
     8
     9        Reviewed by Adam Roben.
     10
     11        * DumpRenderTree/AccessibilityController.cpp:
     12        (logScrollingStartEventsCallback):
     13        Turn on logging of scrolling start events.
     14        (AccessibilityController::getJSClass):
     15        Add a "logScrollingStartEvents" to the AccessibilityController's JS
     16        class definition.
     17        (AccessibilityController::resetToConsistentState):
     18        Turn off logging of scrolling start events.
     19
     20        * DumpRenderTree/AccessibilityController.h:
     21        Declare setLogScrollingStartEvents(). Add a member for the scrolling
     22        start event hook.
     23
     24        * DumpRenderTree/mac/AccessibilityControllerMac.cpp:
     25        (AccessibilityController::setLogScrollingStartEvents):
     26        Stubbed.
     27
     28        * DumpRenderTree/win/AccessibilityControllerWin.cpp:
     29        (AccessibilityController::AccessibilityController):
     30        Initialize the handle to 0.
     31        (logEventProc):
     32        Renamed from logFocusEventProc; now logs scrolling start events, too.
     33        Removed the assertion that the event is a focus event. Added a switch
     34        to print a message for focus, scrolling start, and other, unknown
     35        events.
     36        (AccessibilityController::setLogFocusEvents):
     37        Changed to use logEventProc.
     38        (AccessibilityController::setLogScrollingStartEvents):
     39        If turning logging off, unhook the scrolling start event hook, and clear
     40        the member holding the handle. If turning on, query for the root
     41        accessible, so that accessibility is enabled for the WebView, and call
     42        SetWinEventHook to setup an event hook using logEventProc as the
     43        callback function.
     44
    1452009-09-14  Brady Eidson  <beidson@apple.com>
    246
  • trunk/WebKitTools/DumpRenderTree/AccessibilityController.cpp

    r47320 r48368  
    6060}
    6161
     62static JSValueRef logScrollingStartEventsCallback(JSContextRef ctx, JSObjectRef, JSObjectRef thisObject, size_t, const JSValueRef[], JSValueRef*)
     63{
     64    AccessibilityController* controller = static_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject));
     65    controller->setLogScrollingStartEvents(true);
     66    return JSValueMakeUndefined(ctx);
     67}
     68
    6269JSClassRef AccessibilityController::getJSClass()
    6370{
    6471    static JSStaticFunction staticFunctions[] = {
    6572        { "logFocusEvents", logFocusEventsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     73        { "logScrollingStartEvents", logScrollingStartEventsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    6674        { 0, 0, 0 }
    6775    };
     
    8593{
    8694    setLogFocusEvents(false);
     95    setLogScrollingStartEvents(false);
    8796}
  • trunk/WebKitTools/DumpRenderTree/AccessibilityController.h

    r47320 r48368  
    4646
    4747    void setLogFocusEvents(bool);
     48    void setLogScrollingStartEvents(bool);
    4849
    4950    void resetToConsistentState();
     
    5455#if PLATFORM(WIN)
    5556    HWINEVENTHOOK m_focusEventHook;
     57    HWINEVENTHOOK m_scrollingStartEventHook;
    5658#endif
    5759};
  • trunk/WebKitTools/DumpRenderTree/mac/AccessibilityControllerMac.mm

    r47320 r48368  
    5858{
    5959}
     60
     61void AccessibilityController::setLogScrollingStartEvents(bool)
     62{
     63}
     64
  • trunk/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp

    r47320 r48368  
    3939AccessibilityController::AccessibilityController()
    4040    : m_focusEventHook(0)
     41    , m_scrollingStartEventHook(0)
    4142{
    4243}
     
    8990}
    9091
    91 static void CALLBACK logFocusEventProc(HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD, DWORD)
     92static void CALLBACK logEventProc(HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD, DWORD)
    9293{
    93     ASSERT_ARG(event, event == EVENT_OBJECT_FOCUS);
    94 
    9594    // Get the accessible object for this event.
    9695    COMPtr<IAccessible> parentObject;
     
    109108    SysFreeString(nameBSTR);
    110109
    111     printf("Received focus event for object '%S'.\n", name.c_str());
     110    switch (event) {
     111        case EVENT_OBJECT_FOCUS:
     112            printf("Received focus event for object '%S'.\n", name.c_str());
     113            break;
     114
     115        case EVENT_SYSTEM_SCROLLINGSTART:
     116            printf("Received scrolling start event for object '%S'.\n", name.c_str());
     117            break;
     118
     119        default:
     120            printf("Received unknown event for object '%S'.\n", name.c_str());
     121            break;
     122    }
    112123}
    113124
     
    127138    rootElement();
    128139
    129     m_focusEventHook = SetWinEventHook(EVENT_OBJECT_FOCUS, EVENT_OBJECT_FOCUS, GetModuleHandle(0), logFocusEventProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT);
     140    m_focusEventHook = SetWinEventHook(EVENT_OBJECT_FOCUS, EVENT_OBJECT_FOCUS, GetModuleHandle(0), logEventProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT);
    130141
    131142    ASSERT(m_focusEventHook);
    132143}
     144
     145void AccessibilityController::setLogScrollingStartEvents(bool logScrollingStartEvents)
     146{
     147    if (!!m_scrollingStartEventHook == logScrollingStartEvents)
     148        return;
     149
     150    if (!logScrollingStartEvents) {
     151        UnhookWinEvent(m_scrollingStartEventHook);
     152        m_scrollingStartEventHook = 0;
     153        return;
     154    }
     155
     156    // Ensure that accessibility is initialized for the WebView by querying for
     157    // the root accessible object.
     158    rootElement();
     159
     160    m_scrollingStartEventHook = SetWinEventHook(EVENT_SYSTEM_SCROLLINGSTART, EVENT_SYSTEM_SCROLLINGSTART, GetModuleHandle(0), logEventProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT);
     161
     162    ASSERT(m_scrollingStartEventHook);
     163}
Note: See TracChangeset for help on using the changeset viewer.