Skip to content

Commit

Permalink
Merge r222787 - AX: [ATK] ARIA drag-and-drop attribute values should …
Browse files Browse the repository at this point in the history
…be exposed via AtkObject attributes

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

Reviewed by Chris Fleizach.

Source/WebCore:

Expose the values of aria-grabbed and aria-dropeffect via the "grabbed" and "dropeffect"
AtkObject attributes.

Test: accessibility/gtk/aria-drag-and-drop.html

* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(webkitAccessibleGetAttributes):

Tools:

Implement ariaIsGrabbed() and ariaDropEffects() for ATK.

* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::ariaIsGrabbed const):
(WTR::AccessibilityUIElement::ariaDropEffects const):

LayoutTests:

* accessibility/gtk/aria-drag-and-drop-expected.txt: Added.
* accessibility/gtk/aria-drag-and-drop.html: Added.
  • Loading branch information
joanmarie authored and carlosgcampos committed Oct 17, 2017
1 parent a756f27 commit 97e478e
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 4 deletions.
10 changes: 10 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
2017-10-03 Joanmarie Diggs <jdiggs@igalia.com>

AX: [ATK] ARIA drag-and-drop attribute values should be exposed via AtkObject attributes
https://bugs.webkit.org/show_bug.cgi?id=177763

Reviewed by Chris Fleizach.

* accessibility/gtk/aria-drag-and-drop-expected.txt: Added.
* accessibility/gtk/aria-drag-and-drop.html: Added.

2017-10-02 Joanmarie Diggs <jdiggs@igalia.com>

AX: [ATK] The value of aria-level is not exposed on non-heading roles
Expand Down
41 changes: 41 additions & 0 deletions LayoutTests/accessibility/gtk/aria-drag-and-drop-expected.txt
@@ -0,0 +1,41 @@
This tests the exposure of ARIA properties related to drag and drop.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


test1
ariaDropEffects:
ariaIsGrabbed: false
has grabbed attribute: false
test2
ariaDropEffects:
ariaIsGrabbed: false
has grabbed attribute: false
test3
ariaDropEffects:
ariaIsGrabbed: true
has grabbed attribute: true
test4
ariaDropEffects:
ariaIsGrabbed: false
has grabbed attribute: true
test5
ariaDropEffects: copy
ariaIsGrabbed: false
has grabbed attribute: false
test6
ariaDropEffects: move
ariaIsGrabbed: false
has grabbed attribute: false
test7
ariaDropEffects: copy move
ariaIsGrabbed: false
has grabbed attribute: false
test8
ariaDropEffects: none
ariaIsGrabbed: false
has grabbed attribute: false
PASS successfullyParsed is true

TEST COMPLETE

45 changes: 45 additions & 0 deletions LayoutTests/accessibility/gtk/aria-drag-and-drop.html
@@ -0,0 +1,45 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body id="body">
<div id="content">
<div id="test1" role="button">X</div>
<div id="test2" role="button" aria-grabbed="">X</div>
<div id="test3" role="button" aria-grabbed="true">X</div>
<div id="test4" role="button" aria-grabbed="false">X</div>
<div id="test5" role="button" aria-dropeffect="copy">X</div>
<div id="test6" role="button" aria-dropeffect="move">X</div>
<div id="test7" role="button" aria-dropeffect="copy move">X</div>
<div id="test8" role="button" aria-dropeffect="none">X</div>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
function hasGrabbedAttribute(axElement) {
var allAttributes = axElement.allAttributes().split("\n");
var length = allAttributes.length;
for (var i = 0; i < length; i++) {
var string = allAttributes[i];
if (string.startsWith("AXPlatformAttributes"))
return string.search("grabbed") > -1;
}
return false;
}

description("This tests the exposure of ARIA properties related to drag and drop.");
if (window.accessibilityController) {
for (var i = 1; i <= 8; i++) {
var axElement = accessibilityController.accessibleElementById("test" + i);
debug("test" + i + "\n\tariaDropEffects: " + axElement.ariaDropEffects +
"\n\tariaIsGrabbed: " + axElement.ariaIsGrabbed +
"\n\thas grabbed attribute: " + hasGrabbedAttribute(axElement));
}

document.getElementById("content").style.visibility = "hidden";
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
15 changes: 15 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,18 @@
2017-10-03 Joanmarie Diggs <jdiggs@igalia.com>

AX: [ATK] ARIA drag-and-drop attribute values should be exposed via AtkObject attributes
https://bugs.webkit.org/show_bug.cgi?id=177763

Reviewed by Chris Fleizach.

Expose the values of aria-grabbed and aria-dropeffect via the "grabbed" and "dropeffect"
AtkObject attributes.

Test: accessibility/gtk/aria-drag-and-drop.html

* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(webkitAccessibleGetAttributes):

2017-10-02 Joanmarie Diggs <jdiggs@igalia.com>

AX: [ATK] The value of aria-level is not exposed on non-heading roles
Expand Down
10 changes: 10 additions & 0 deletions Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
Expand Up @@ -575,6 +575,16 @@ static AtkAttributeSet* webkitAccessibleGetAttributes(AtkObject* object)
attributeSet = addToAtkAttributeSet(attributeSet, "atomic", "true");
}

// The Core AAM states the author-provided value should be exposed as-is.
String dropEffect = coreObject->getAttribute(HTMLNames::aria_dropeffectAttr);
if (!dropEffect.isEmpty())
attributeSet = addToAtkAttributeSet(attributeSet, "dropeffect", dropEffect.utf8().data());

if (coreObject->isARIAGrabbed())
attributeSet = addToAtkAttributeSet(attributeSet, "grabbed", "true");
else if (coreObject->supportsARIADragging())
attributeSet = addToAtkAttributeSet(attributeSet, "grabbed", "false");

return attributeSet;
}

Expand Down
13 changes: 13 additions & 0 deletions Tools/ChangeLog
@@ -1,3 +1,16 @@
2017-10-03 Joanmarie Diggs <jdiggs@igalia.com>

AX: [ATK] ARIA drag-and-drop attribute values should be exposed via AtkObject attributes
https://bugs.webkit.org/show_bug.cgi?id=177763

Reviewed by Chris Fleizach.

Implement ariaIsGrabbed() and ariaDropEffects() for ATK.

* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::ariaIsGrabbed const):
(WTR::AccessibilityUIElement::ariaDropEffects const):

2017-10-02 Joanmarie Diggs <jdiggs@igalia.com>

AX: [ATK] The value of aria-level is not exposed on non-heading roles
Expand Down
Expand Up @@ -1695,14 +1695,13 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::speak()

bool AccessibilityUIElement::ariaIsGrabbed() const
{
// FIXME: implement
return false;
return getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "grabbed") == "true";
}

JSRetainPtr<JSStringRef> AccessibilityUIElement::ariaDropEffects() const
{
// FIXME: implement
return JSStringCreateWithCharacters(0, 0);
String dropEffects = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "dropeffect");
return dropEffects.isEmpty() ? JSStringCreateWithCharacters(0, 0) : JSStringCreateWithUTF8CString(dropEffects.utf8().data());
}

// parameterized attributes
Expand Down

0 comments on commit 97e478e

Please sign in to comment.