[ATK] Elements with a defined, non-false value for aria-current should expose ATK_STATE_ACTIVE
https://bugs.webkit.org/show_bug.cgi?id=171163
Reviewed by Chris Fleizach.
Source/WebCore:
Add ATK_STATE_ACTIVE to the state set of elements which have a valid, non-false
value for aria-current, expose the value of via the "current" AtkObject attribute,
and emit state-change notifications when the value of aria-current changes from
non-false to false, or vice versa.
Tests: accessibility/gtk/aria-current-changed-notification.html
accessibility/gtk/aria-current.html
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::handleAttributeChanged):
* accessibility/AXObjectCache.h:
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::supportsARIACurrent):
(WebCore::AccessibilityObject::ariaCurrentValue):
* accessibility/AccessibilityObject.h:
* accessibility/atk/AXObjectCacheAtk.cpp:
(WebCore::AXObjectCache::postPlatformNotification):
* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(webkitAccessibleGetAttributes):
(setAtkStateSetFromCoreObject):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): Moved code returning
string value for aria-current into AccessibilityObject:ariaCurrentValue().
Tools:
Add support for state-change notifications for ATK_STATE_ACTIVE.
* WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp:
LayoutTests:
* accessibility/gtk/aria-current-changed-notification-expected.txt: Added.
* accessibility/gtk/aria-current-changed-notification.html: Added.
* accessibility/gtk/aria-current-expected.txt: Added.
* accessibility/gtk/aria-current.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@215837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
index 6df2587..d3c5b96 100644
--- a/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
+++ b/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
@@ -403,6 +403,9 @@
if (coreObject->supportsARIAHasPopup())
attributeSet = addToAtkAttributeSet(attributeSet, "haspopup", coreObject->ariaPopupValue().utf8().data());
+ if (coreObject->supportsARIACurrent())
+ attributeSet = addToAtkAttributeSet(attributeSet, "current", coreObject->ariaCurrentValue().utf8().data());
+
AccessibilitySortDirection sortDirection = coreObject->sortDirection();
if (sortDirection != SortDirectionNone) {
// WAI-ARIA spec says to translate the value as is from the attribute.
@@ -753,7 +756,8 @@
bool isListBoxOption = parent && parent->isListBox();
// Please keep the state list in alphabetical order
- if (isListBoxOption && coreObject->isSelectedOptionActive())
+ if ((isListBoxOption && coreObject->isSelectedOptionActive())
+ || coreObject->ariaCurrentState() != ARIACurrentFalse)
atk_state_set_add_state(stateSet, ATK_STATE_ACTIVE);
if (coreObject->isBusy())