Commit 2d7f5b40 authored by mario@webkit.org's avatar mario@webkit.org

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

        [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-18  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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@78979 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e1803daf
2011-02-18 Mario Sanchez Prada <msanchez@igalia.com>
[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-18 Philippe Normand <pnormand@igalia.com>
Unreviewed, update GTK tables/mozilla_expected_failures baselines
......
Accessibility object emitted "focus-event = 1" / Name: "foo" / Role: 11
Accessibility object emitted "state-change:focused = 1" / Name: "foo" / Role: 11
Accessibility object emitted "focus-event = 1" / Name: "bar" / Role: 11
Accessibility object emitted "state-change:focused = 1" / Name: "bar" / Role: 11
Accessibility object emitted "state-change:selected = 1" / Name: "bar" / Role: 34
Accessibility object emitted "focus-event = 1" / Name: "bar" / Role: 34
Accessibility object emitted "state-change:focused = 1" / Name: "bar" / Role: 34
Accessibility object emitted "focus-event = 1" / Name: "baz" / Role: 11
Accessibility object emitted "state-change:focused = 1" / Name: "baz" / Role: 11
Accessibility object emitted "focus-event = 0" / Name: "bar" / Role: 34
Accessibility object emitted "state-change:focused = 0" / Name: "bar" / Role: 34
Accessibility object emitted "state-change:selected = 1" / Name: "baz" / Role: 34
Accessibility object emitted "focus-event = 1" / Name: "baz" / Role: 34
Accessibility object emitted "state-change:focused = 1" / Name: "baz" / Role: 34
Accessibility object emitted "focus-event = 1" / Name: "bar" / Role: 11
Accessibility object emitted "state-change:focused = 1" / Name: "bar" / Role: 11
Accessibility object emitted "focus-event = 0" / Name: "baz" / Role: 34
Accessibility object emitted "state-change:focused = 0" / Name: "baz" / Role: 34
Accessibility object emitted "state-change:selected = 1" / Name: "bar" / Role: 34
Accessibility object emitted "focus-event = 1" / Name: "bar" / Role: 34
Accessibility object emitted "state-change:focused = 1" / Name: "bar" / Role: 34
Accessibility object emitted "focus-event = 1" / Name: "foo" / Role: 11
Accessibility object emitted "state-change:focused = 1" / Name: "foo" / Role: 11
Accessibility object emitted "focus-event = 0" / Name: "bar" / Role: 34
Accessibility object emitted "state-change:focused = 0" / Name: "bar" / Role: 34
Accessibility object emitted "state-change:selected = 1" / Name: "foo" / Role: 34
Accessibility object emitted "focus-event = 1" / Name: "foo" / Role: 34
Accessibility object emitted "state-change:focused = 1" / Name: "foo" / Role: 34
This tests that the 'state-changed:selected' signal is emitted when arrowing through the options of a combobox while collapsed.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
<script src="../../../fast/js/resources/js-test-pre.js"></script>
<script>
var successfullyParsed = false;
function runTest() {
description("This tests that the 'state-changed:selected' signal is emitted when arrowing through the options of a combobox while collapsed.");
if (window.layoutTestController) {
layoutTestController.dumpAsText();
}
if (window.accessibilityController) {
accessibilityController.logAccessibilityEvents();
}
// Focus in the combobox and move around the options. The signal
// 'state-change:selected' should be emitted with every change.
document.getElementById("combo").focus();
eventSender.keyDown("downArrow");
eventSender.keyDown("downArrow");
eventSender.keyDown("upArrow");
eventSender.keyDown("upArrow");
}
</script>
</head>
<body onload="runTest();">
<form>
<select id="combo">
<option selected value='foo'>foo</option>
<option value='bar'>bar</option>
<option value='baz'>baz</option>
</select>
</form>
<p id="description"></p>
<div id="console"></div>
<script>
successfullyParsed = true;
</script>
<script src="../../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
2011-02-18 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.
2011-02-18 Mario Sanchez Prada <msanchez@igalia.com>
Reviewed by Martin Robinson.
......
......@@ -42,6 +42,30 @@ void AXObjectCache::attachWrapper(AccessibilityObject* obj)
g_object_unref(atkObj);
}
static AccessibilityObject* getListObject(AccessibilityObject* object)
{
// Only list boxes and menu lists supported so far.
if (!object->isListBox() && !object->isMenuList())
return 0;
// For list boxes the list object is just itself.
if (object->isListBox())
return object;
// For menu lists we need to return the first accessible child,
// with role MenuListPopupRole, since that's the one holding the list
// of items with role MenuListOptionRole.
AccessibilityObject::AccessibilityChildrenVector children = object->children();
if (!children.size())
return 0;
AccessibilityObject* listObject = children.at(0).get();
if (!listObject->isMenuListPopup())
return 0;
return listObject;
}
static void notifyChildrenSelectionChange(AccessibilityObject* object)
{
// This static variable is needed to keep track of the old focused
......@@ -49,19 +73,24 @@ static void notifyChildrenSelectionChange(AccessibilityObject* object)
// properly decide whether to emit some signals or not.
static RefPtr<AccessibilityObject> oldFocusedObject = 0;
// Only list boxes supported so far.
if (!object || !object->isListBox())
// Only list boxes and menu lists supported so far.
if (!object || !(object->isListBox() || object->isMenuList()))
return;
// Emit signal from the listbox's point of view first.
g_signal_emit_by_name(object->wrapper(), "selection-changed");
// Find the item where the selection change was triggered from.
AccessibilityObject::AccessibilityChildrenVector items = object->children();
SelectElement* select = toSelectElement(static_cast<Element*>(object->node()));
if (!select)
return;
int changedItemIndex = select->activeSelectionStartListIndex();
AccessibilityObject* listObject = getListObject(object);
if (!listObject)
return;
AccessibilityObject::AccessibilityChildrenVector items = listObject->children();
if (changedItemIndex < 0 || changedItemIndex >= static_cast<int>(items.size()))
return;
AccessibilityObject* item = items.at(changedItemIndex).get();
......@@ -103,13 +132,13 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* coreObject, AX
if (!coreObject->isCheckboxOrRadio())
return;
g_signal_emit_by_name(axObject, "state-change", "checked", coreObject->isChecked());
} else if (notification == AXMenuListValueChanged) {
if (!coreObject->isMenuList())
return;
g_signal_emit_by_name(axObject, "focus-event", true);
g_signal_emit_by_name(axObject, "state-change", "focused", true);
} else if (notification == AXSelectedChildrenChanged)
} else if (notification == AXSelectedChildrenChanged || notification == AXMenuListValueChanged) {
if (notification == AXMenuListValueChanged && coreObject->isMenuList()) {
g_signal_emit_by_name(axObject, "focus-event", true);
g_signal_emit_by_name(axObject, "state-change", "focused", true);
}
notifyChildrenSelectionChange(coreObject);
}
}
static void emitTextChanged(AccessibilityRenderObject* object, AXObjectCache::AXTextChange textChange, unsigned offset, unsigned count)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment