Changeset 79321 in webkit


Ignore:
Timestamp:
Feb 22, 2011 7:26:23 AM (13 years ago)
Author:
mario@webkit.org
Message:

2011-02-22 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Martin Robinson.

[GTK] Combo boxes should emit object:selection-changed even when collapsed
https://bugs.webkit.org/show_bug.cgi?id=53146

New GTK-specific layout test to check the right signals are emitted.

  • platform/gtk/accessibility/combo-box-collapsed-selection-changed-expected.txt: Added.
  • platform/gtk/accessibility/combo-box-collapsed-selection-changed.html: Added.

2011-02-22 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Martin Robinson.

[GTK] Combo boxes should emit object:selection-changed even when collapsed
https://bugs.webkit.org/show_bug.cgi?id=53146

Emit the selection-changed signals when the menu list value has changed

Test: platform/gtk/accessibility/combo-box-collapsed-selection-changed.html

  • accessibility/gtk/AXObjectCacheAtk.cpp: (WebCore::getListObject): New, return the right list object for menu lists and list boxes. (WebCore::notifyChildrenSelectionChange): Support menu lists. (WebCore::AXObjectCache::postPlatformNotification): Call function notifyChildrenSelectionChange for AXMenuListValueChanged.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r79318 r79321  
     12011-02-22  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GTK] Combo boxes should emit object:selection-changed even when collapsed
     6        https://bugs.webkit.org/show_bug.cgi?id=53146
     7
     8        New GTK-specific layout test to check the right signals are emitted.
     9
     10        * platform/gtk/accessibility/combo-box-collapsed-selection-changed-expected.txt: Added.
     11        * platform/gtk/accessibility/combo-box-collapsed-selection-changed.html: Added.
     12
    1132011-02-15  Jer Noble  <jer.noble@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r79320 r79321  
     12011-02-22  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GTK] Combo boxes should emit object:selection-changed even when collapsed
     6        https://bugs.webkit.org/show_bug.cgi?id=53146
     7
     8        Emit the selection-changed signals when the menu list value has changed
     9
     10        Test: platform/gtk/accessibility/combo-box-collapsed-selection-changed.html
     11
     12        * accessibility/gtk/AXObjectCacheAtk.cpp:
     13        (WebCore::getListObject): New, return the right list object for
     14        menu lists and list boxes.
     15        (WebCore::notifyChildrenSelectionChange): Support menu lists.
     16        (WebCore::AXObjectCache::postPlatformNotification): Call function
     17        notifyChildrenSelectionChange for AXMenuListValueChanged.
     18
    1192011-02-22  Andras Becsi  <abecsi@webkit.org>
    220
  • trunk/Source/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp

    r78987 r79321  
    4343}
    4444
     45static AccessibilityObject* getListObject(AccessibilityObject* object)
     46{
     47    // Only list boxes and menu lists supported so far.
     48    if (!object->isListBox() && !object->isMenuList())
     49        return 0;
     50
     51    // For list boxes the list object is just itself.
     52    if (object->isListBox())
     53        return object;
     54
     55    // For menu lists we need to return the first accessible child,
     56    // with role MenuListPopupRole, since that's the one holding the list
     57    // of items with role MenuListOptionRole.
     58    AccessibilityObject::AccessibilityChildrenVector children = object->children();
     59    if (!children.size())
     60        return 0;
     61
     62    AccessibilityObject* listObject = children.at(0).get();
     63    if (!listObject->isMenuListPopup())
     64        return 0;
     65
     66    return listObject;
     67}
     68
    4569static void notifyChildrenSelectionChange(AccessibilityObject* object)
    4670{
     
    5074    static RefPtr<AccessibilityObject> oldFocusedObject = 0;
    5175
    52     // Only list boxes supported so far.
    53     if (!object || !object->isListBox())
     76    // Only list boxes and menu lists supported so far.
     77    if (!object || !(object->isListBox() || object->isMenuList()))
    5478        return;
    5579
     
    5882
    5983    // Find the item where the selection change was triggered from.
    60     AccessibilityObject::AccessibilityChildrenVector items = object->children();
    6184    SelectElement* select = toSelectElement(static_cast<Element*>(object->node()));
    6285    if (!select)
    6386        return;
    6487    int changedItemIndex = select->activeSelectionStartListIndex();
     88
     89    AccessibilityObject* listObject = getListObject(object);
     90    if (!listObject)
     91        return;
     92
     93    AccessibilityObject::AccessibilityChildrenVector items = listObject->children();
    6594    if (changedItemIndex < 0 || changedItemIndex >= static_cast<int>(items.size()))
    6695        return;
    6796    AccessibilityObject* item = items.at(changedItemIndex).get();
    6897
    69     // Ensure the oldFocusedObject belongs to the same document that
     98    // Ensure oldFocusedObject belongs to the same list object that
    7099    // the current item so further comparisons make sense. Otherwise,
    71100    // just reset oldFocusedObject so it won't be taken into account.
    72     if (item && oldFocusedObject && item->document() != oldFocusedObject->document())
     101    if (item && oldFocusedObject && item->parentObject() != oldFocusedObject->parentObject())
    73102        oldFocusedObject = 0;
    74103
     
    104133            return;
    105134        g_signal_emit_by_name(axObject, "state-change", "checked", coreObject->isChecked());
    106     } else if (notification == AXMenuListValueChanged) {
    107         if (!coreObject->isMenuList())
    108             return;
    109         g_signal_emit_by_name(axObject, "focus-event", true);
    110         g_signal_emit_by_name(axObject, "state-change", "focused", true);
    111     } else if (notification == AXSelectedChildrenChanged)
     135    } else if (notification == AXSelectedChildrenChanged || notification == AXMenuListValueChanged) {
     136        if (notification == AXMenuListValueChanged && coreObject->isMenuList()) {
     137            g_signal_emit_by_name(axObject, "focus-event", true);
     138            g_signal_emit_by_name(axObject, "state-change", "focused", true);
     139        }
    112140        notifyChildrenSelectionChange(coreObject);
     141    }
    113142}
    114143
Note: See TracChangeset for help on using the changeset viewer.