Changeset 53567 in webkit


Ignore:
Timestamp:
Jan 20, 2010 2:31:19 PM (14 years ago)
Author:
jhoneycutt@apple.com
Message:

MSAA: accSelect() is not implemented

https://bugs.webkit.org/show_bug.cgi?id=33918
<rdar://problem/7436861>

Reviewed by Darin Adler.

WebCore:

Test: platform/win/accessibility/selection-and-focus.html

  • accessibility/AccessibilityMenuListOption.cpp:

(WebCore::AccessibilityMenuListOption::setSelected):
Return early if the object is not selectable.

WebKit/win:

  • AccessibleBase.cpp:

(AccessibleBase::accSelect):
If there is an invalid combination of state flags, return early. If the
caller passed the "take focus" flag, focus the object. If the "take
selection" flag was passed, check whether the parent object is an
AccessibilityListBox; if so, call the object's setSelectedChildren()
function. If the parent is an AccessibilityMenuListPopup, call the
child object's setSelected() function. Otherwise, if the parent is some
other, unsupported object, return early.
If the selection flags include "add", "remove", or "extend" selection,
and the parent object is not multi-selectable, return early. Otherwise,
set or unset the child's selected flag based on the passed flag.

WebKitTools:

  • DumpRenderTree/AccessibilityUIElement.cpp:

(takeFocusCallback):
Call the object's takeFocus() function.
(takeSelectionCallback):
Call its takeSelection() function.
(addSelectionCallback):
Call its addSelection() function.
(removeSelectionCallback):
Call its removeSelection() function.
(AccessibilityUIElement::getJSClass):
Add new functions to the JS class definition.

  • DumpRenderTree/AccessibilityUIElement.h:

Declare new functions.

  • DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:

(AccessibilityUIElement::takeFocus):
Stubbed.
(AccessibilityUIElement::takeSelection):
Stubbed.
(AccessibilityUIElement::addSelection):
Stubbed.
(AccessibilityUIElement::removeSelection):
Stubbed.

  • DumpRenderTree/mac/AccessibilityUIElementMac.mm:

(AccessibilityUIElement::takeFocus):
Stubbed.
(AccessibilityUIElement::takeSelection):
Stubbed.
(AccessibilityUIElement::addSelection):
Stubbed.
(AccessibilityUIElement::removeSelection):
Stubbed.

  • DumpRenderTree/win/AccessibilityUIElementWin.cpp:

(AccessibilityUIElement::takeFocus):
Call the object's accSelect() function, passing the appropriate flag.
(AccessibilityUIElement::takeSelection):
Ditto.
(AccessibilityUIElement::addSelection):
Ditto.
(AccessibilityUIElement::removeSelection):
Ditto.

LayoutTests:

  • platform/win/accessibility/selection-and-focus-expected.txt: Added.
  • platform/win/accessibility/selection-and-focus.html: Added.
Location:
trunk
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r53564 r53567  
     12010-01-20  Jon Honeycutt  <jhoneycutt@apple.com>
     2
     3        MSAA: accSelect() is not implemented
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=33918
     6        <rdar://problem/7436861>
     7
     8        Reviewed by Darin Adler.
     9
     10        * platform/win/accessibility/selection-and-focus-expected.txt: Added.
     11        * platform/win/accessibility/selection-and-focus.html: Added.
     12
    1132010-01-19  Nikolas Zimmermann  <nzimmermann@rim.com>
    214
  • trunk/WebCore/ChangeLog

    r53566 r53567  
     12010-01-20  Jon Honeycutt  <jhoneycutt@apple.com>
     2
     3        MSAA: accSelect() is not implemented
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=33918
     6        <rdar://problem/7436861>
     7
     8        Reviewed by Darin Adler.
     9
     10        Test: platform/win/accessibility/selection-and-focus.html
     11
     12        * accessibility/AccessibilityMenuListOption.cpp:
     13        (WebCore::AccessibilityMenuListOption::setSelected):
     14        Return early if the object is not selectable.
     15
    1162010-01-20  Nikolas Zimmermann  <nzimmermann@rim.com>
    217
  • trunk/WebCore/accessibility/AccessibilityMenuListOption.cpp

    r53512 r53567  
    8484void AccessibilityMenuListOption::setSelected(bool b)
    8585{
     86    if (!canSetSelectedAttribute())
     87        return;
     88
    8689    static_cast<HTMLOptionElement*>(m_element.get())->setSelected(b);
    8790}
  • trunk/WebKit/win/AccessibleBase.cpp

    r53512 r53567  
    3030#include "AccessibleImage.h"
    3131#include "WebView.h"
     32#include <WebCore/AccessibilityListBox.h>
     33#include <WebCore/AccessibilityMenuListPopup.h>
    3234#include <WebCore/AccessibilityObject.h>
    3335#include <WebCore/AXObjectCache.h>
     
    363365}
    364366
    365 HRESULT STDMETHODCALLTYPE AccessibleBase::accSelect(long, VARIANT)
    366 {
    367     return E_NOTIMPL;
     367HRESULT STDMETHODCALLTYPE AccessibleBase::accSelect(long selectionFlags, VARIANT vChild)
     368{
     369    // According to MSDN, these combinations are invalid.
     370    if (((selectionFlags & (SELFLAG_ADDSELECTION | SELFLAG_REMOVESELECTION)) == (SELFLAG_ADDSELECTION | SELFLAG_REMOVESELECTION)) ||
     371        ((selectionFlags & (SELFLAG_ADDSELECTION | SELFLAG_TAKESELECTION)) == (SELFLAG_ADDSELECTION | SELFLAG_TAKESELECTION)) ||
     372        ((selectionFlags & (SELFLAG_REMOVESELECTION | SELFLAG_TAKESELECTION)) == (SELFLAG_REMOVESELECTION | SELFLAG_TAKESELECTION)) ||
     373        ((selectionFlags & (SELFLAG_EXTENDSELECTION | SELFLAG_TAKESELECTION)) == (SELFLAG_REMOVESELECTION | SELFLAG_TAKESELECTION)))
     374        return E_INVALIDARG;
     375
     376    AccessibilityObject* childObject;
     377    HRESULT hr = getAccessibilityObjectForChild(vChild, childObject);
     378
     379    if (FAILED(hr))
     380        return hr;
     381
     382    if (selectionFlags & SELFLAG_TAKEFOCUS)
     383        childObject->setFocused(true);
     384
     385    AccessibilityObject* parentObject = childObject->parentObject();
     386    if (!parentObject)
     387        return E_INVALIDARG;
     388
     389    if (selectionFlags & SELFLAG_TAKESELECTION) {
     390        if (parentObject->isListBox()) {
     391            Vector<RefPtr<AccessibilityObject> > selectedChildren(1);
     392            selectedChildren[0] = childObject;
     393            static_cast<AccessibilityListBox*>(parentObject)->setSelectedChildren(selectedChildren);
     394        } else if (parentObject->isMenuListPopup())
     395            childObject->setSelected(true);
     396        else
     397            return E_INVALIDARG;
     398    }
     399
     400    // MSDN says that ADD, REMOVE, and EXTENDSELECTION are invalid for
     401    // single-select.
     402    if (!parentObject->isMultiSelectable())
     403        return E_INVALIDARG;
     404
     405    if (selectionFlags & SELFLAG_ADDSELECTION)
     406        childObject->setSelected(true);
     407
     408    if (selectionFlags & SELFLAG_REMOVESELECTION)
     409        childObject->setSelected(false);
     410
     411    // FIXME: Should implement SELFLAG_EXTENDSELECTION. For now, we just return
     412    // S_OK, matching Firefox.
     413
     414    return S_OK;
    368415}
    369416
  • trunk/WebKit/win/ChangeLog

    r53554 r53567  
     12010-01-20  Jon Honeycutt  <jhoneycutt@apple.com>
     2
     3        MSAA: accSelect() is not implemented
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=33918
     6        <rdar://problem/7436861>
     7
     8        Reviewed by Darin Adler.
     9
     10        * AccessibleBase.cpp:
     11        (AccessibleBase::accSelect):
     12        If there is an invalid combination of state flags, return early. If the
     13        caller passed the "take focus" flag, focus the object. If the "take
     14        selection" flag was passed, check whether the parent object is an
     15        AccessibilityListBox; if so, call the object's setSelectedChildren()
     16        function. If the parent is an AccessibilityMenuListPopup, call the
     17        child object's setSelected() function. Otherwise, if the parent is some
     18        other, unsupported object, return early.
     19        If the selection flags include "add", "remove", or "extend" selection,
     20        and the parent object is not multi-selectable, return early. Otherwise,
     21        set or unset the child's selected flag based on the passed flag.
     22
    1232010-01-20  Steve Falkenburg  <sfalken@apple.com>
    224
  • trunk/WebKitTools/ChangeLog

    r53559 r53567  
     12010-01-20  Jon Honeycutt  <jhoneycutt@apple.com>
     2
     3        MSAA: accSelect() is not implemented
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=33918
     6        <rdar://problem/7436861>
     7
     8        Reviewed by Darin Adler.
     9
     10        * DumpRenderTree/AccessibilityUIElement.cpp:
     11        (takeFocusCallback):
     12        Call the object's takeFocus() function.
     13        (takeSelectionCallback):
     14        Call its takeSelection() function.
     15        (addSelectionCallback):
     16        Call its addSelection() function.
     17        (removeSelectionCallback):
     18        Call its removeSelection() function.
     19        (AccessibilityUIElement::getJSClass):
     20        Add new functions to the JS class definition.
     21
     22        * DumpRenderTree/AccessibilityUIElement.h:
     23        Declare new functions.
     24
     25        * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
     26        (AccessibilityUIElement::takeFocus):
     27        Stubbed.
     28        (AccessibilityUIElement::takeSelection):
     29        Stubbed.
     30        (AccessibilityUIElement::addSelection):
     31        Stubbed.
     32        (AccessibilityUIElement::removeSelection):
     33        Stubbed.
     34
     35        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
     36        (AccessibilityUIElement::takeFocus):
     37        Stubbed.
     38        (AccessibilityUIElement::takeSelection):
     39        Stubbed.
     40        (AccessibilityUIElement::addSelection):
     41        Stubbed.
     42        (AccessibilityUIElement::removeSelection):
     43        Stubbed.
     44
     45        * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
     46        (AccessibilityUIElement::takeFocus):
     47        Call the object's accSelect() function, passing the appropriate flag.
     48        (AccessibilityUIElement::takeSelection):
     49        Ditto.
     50        (AccessibilityUIElement::addSelection):
     51        Ditto.
     52        (AccessibilityUIElement::removeSelection):
     53        Ditto.
     54
    1552010-01-20  Andras Becsi  <abecsi@inf.u-szeged.hu>
    256
  • trunk/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp

    r53512 r53567  
    344344    return JSValueMakeUndefined(context);
    345345}
     346
     347static JSValueRef takeFocusCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     348{
     349    toAXElement(thisObject)->takeFocus();
     350    return JSValueMakeUndefined(context);
     351}
     352
     353static JSValueRef takeSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     354{
     355    toAXElement(thisObject)->takeSelection();
     356    return JSValueMakeUndefined(context);
     357}
     358
     359static JSValueRef addSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     360{
     361    toAXElement(thisObject)->addSelection();
     362    return JSValueMakeUndefined(context);
     363}
     364
     365static JSValueRef removeSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     366{
     367    toAXElement(thisObject)->removeSelection();
     368    return JSValueMakeUndefined(context);
     369}
     370
    346371
    347372// Static Value Getters
     
    678703        { "isEqual", isEqualCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    679704        { "addNotificationListener", addNotificationListenerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     705        { "takeFocus", takeFocusCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     706        { "takeSelection", takeSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     707        { "addSelection", addSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     708        { "removeSelection", removeSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    680709        { 0, 0, 0 }
    681710    };
  • trunk/WebKitTools/DumpRenderTree/AccessibilityUIElement.h

    r53512 r53567  
    7575    AccessibilityUIElement titleUIElement();
    7676    AccessibilityUIElement parentElement();
    77    
     77
     78    void takeFocus();
     79    void takeSelection();
     80    void addSelection();
     81    void removeSelection();
     82
    7883    // Methods - platform-independent implementations
    7984    JSStringRef allAttributes();
  • trunk/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp

    r53512 r53567  
    594594    return false;
    595595}
     596
     597void AccessibilityUIElement::takeFocus()
     598{
     599    // FIXME: implement
     600}
     601
     602void AccessibilityUIElement::takeSelection()
     603{
     604    // FIXME: implement
     605}
     606
     607void AccessibilityUIElement::addSelection()
     608{
     609    // FIXME: implement
     610}
     611
     612void AccessibilityUIElement::removeSelection()
     613{
     614    // FIXME: implement
     615}
  • trunk/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm

    r53512 r53567  
    816816    return false;
    817817}
     818
     819void AccessibilityUIElement::takeFocus()
     820{
     821    // FIXME: implement
     822}
     823
     824void AccessibilityUIElement::takeSelection()
     825{
     826    // FIXME: implement
     827}
     828
     829void AccessibilityUIElement::addSelection()
     830{
     831    // FIXME: implement
     832}
     833
     834void AccessibilityUIElement::removeSelection()
     835{
     836    // FIXME: implement
     837}
  • trunk/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp

    r53512 r53567  
    571571    return (state & STATE_SYSTEM_HASPOPUP) == STATE_SYSTEM_HASPOPUP;
    572572}
     573
     574void AccessibilityUIElement::takeFocus()
     575{
     576    m_element->accSelect(SELFLAG_TAKEFOCUS, self());
     577}
     578
     579void AccessibilityUIElement::takeSelection()
     580{
     581    m_element->accSelect(SELFLAG_TAKESELECTION, self());
     582}
     583
     584void AccessibilityUIElement::addSelection()
     585{
     586    m_element->accSelect(SELFLAG_ADDSELECTION, self());
     587}
     588
     589void AccessibilityUIElement::removeSelection()
     590{
     591    m_element->accSelect(SELFLAG_REMOVESELECTION, self());
     592}
Note: See TracChangeset for help on using the changeset viewer.