Title: [152716] trunk
Revision
152716
Author
[email protected]
Date
2013-07-16 05:55:56 -0700 (Tue, 16 Jul 2013)

Log Message

[ATK] Adds support for aria-haspopup property.
https://bugs.webkit.org/show_bug.cgi?id=117834

Source/WebCore:

Patch by Krzysztof Czech <[email protected]> on 2013-07-16
Reviewed by Christophe Dumez.

Adds support for aria-haspopup property.

Tests: accessibility/element-haspopup.html
       accessibility/popup-button-title.html

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

Tools:

Patch by Krzysztof Czech <[email protected]> on 2013-07-16
Reviewed by Christophe Dumez.

Adds implementation for testing aria-haspopup property.

* DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
(getAttributeSetValueForId):
(AccessibilityUIElement::stringAttributeValue):
(AccessibilityUIElement::hasPopup):
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::getAttributeSetValueForId):
(WTR::AccessibilityUIElement::stringAttributeValue):
(WTR::AccessibilityUIElement::hasPopup):

LayoutTests:

Patch by Krzysztof Czech <[email protected]> on 2013-07-16
Reviewed by Christophe Dumez.

Moving accessibility tests related to aria-haspopup property.

* accessibility/element-haspopup-expected.txt: Renamed from LayoutTests/platform/mac/accessibility/element-haspopup-expected.txt.
* accessibility/element-haspopup.html: Renamed from LayoutTests/platform/mac/accessibility/element-haspopup.html.
* accessibility/popup-button-title-expected.txt: Renamed from LayoutTests/platform/mac/accessibility/popup-button-title-expected.txt.
* accessibility/popup-button-title.html: Renamed from LayoutTests/platform/mac/accessibility/popup-button-title.html.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (152715 => 152716)


--- trunk/LayoutTests/ChangeLog	2013-07-16 12:22:20 UTC (rev 152715)
+++ trunk/LayoutTests/ChangeLog	2013-07-16 12:55:56 UTC (rev 152716)
@@ -1,3 +1,17 @@
+2013-07-16  Krzysztof Czech  <[email protected]>
+
+        [ATK] Adds support for aria-haspopup property.
+        https://bugs.webkit.org/show_bug.cgi?id=117834
+
+        Reviewed by Christophe Dumez.
+
+        Moving accessibility tests related to aria-haspopup property.
+
+        * accessibility/element-haspopup-expected.txt: Renamed from LayoutTests/platform/mac/accessibility/element-haspopup-expected.txt.
+        * accessibility/element-haspopup.html: Renamed from LayoutTests/platform/mac/accessibility/element-haspopup.html.
+        * accessibility/popup-button-title-expected.txt: Renamed from LayoutTests/platform/mac/accessibility/popup-button-title-expected.txt.
+        * accessibility/popup-button-title.html: Renamed from LayoutTests/platform/mac/accessibility/popup-button-title.html.
+
 2013-07-16  Gabor Abraham  <[email protected]>
 
         [Qt]Unreviewed gardening. New baseline and skip failing tests.

Copied: trunk/LayoutTests/accessibility/element-haspopup-expected.txt (from rev 152715, trunk/LayoutTests/platform/mac/accessibility/element-haspopup-expected.txt) (0 => 152716)


--- trunk/LayoutTests/accessibility/element-haspopup-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/element-haspopup-expected.txt	2013-07-16 12:55:56 UTC (rev 152716)
@@ -0,0 +1,12 @@
+Link 1 Link 2
+This tests that an element will report that it has a popup correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS accessibilityController.focusedElement.hasPopup is true
+PASS accessibilityController.focusedElement.hasPopup is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/accessibility/element-haspopup.html (from rev 152715, trunk/LayoutTests/platform/mac/accessibility/element-haspopup.html) (0 => 152716)


--- trunk/LayoutTests/accessibility/element-haspopup.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/element-haspopup.html	2013-07-16 12:55:56 UTC (rev 152716)
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<a href="" aria-haspopup="true" tabindex="0" id="link1">Link 1</a>
+<a href="" aria-haspopup="false" tabindex="0" id="link2">Link 2</a>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that an element will report that it has a popup correctly.");
+
+    if (window.accessibilityController) {
+
+        document.getElementById("link1").focus();
+        shouldBe("accessibilityController.focusedElement.hasPopup", "true");
+
+        document.getElementById("link2").focus();
+        shouldBe("accessibilityController.focusedElement.hasPopup", "false");
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>

Copied: trunk/LayoutTests/accessibility/popup-button-title-expected.txt (from rev 152715, trunk/LayoutTests/platform/mac/accessibility/popup-button-title-expected.txt) (0 => 152716)


--- trunk/LayoutTests/accessibility/popup-button-title-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/popup-button-title-expected.txt	2013-07-16 12:55:56 UTC (rev 152716)
@@ -0,0 +1,12 @@
+Click me
+
+This tests that a popup button will return the text under the element for its title.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS element.title is 'AXTitle: Click me'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/accessibility/popup-button-title.html (from rev 152715, trunk/LayoutTests/platform/mac/accessibility/popup-button-title.html) (0 => 152716)


--- trunk/LayoutTests/accessibility/popup-button-title.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/popup-button-title.html	2013-07-16 12:55:56 UTC (rev 152716)
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<p><a id="link" role="button" aria-owns="popup" aria-haspopup="true" tabindex="0" href="" me</a></p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that a popup button will return the text under the element for its title.");
+
+    if (window.accessibilityController) {
+        document.getElementById("link").focus();
+        var element = accessibilityController.focusedElement;
+
+        // The element should not be ignored (it should be a group)
+        shouldBe("element.title", "'AXTitle: Click me'");
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>

Deleted: trunk/LayoutTests/platform/mac/accessibility/element-haspopup-expected.txt (152715 => 152716)


--- trunk/LayoutTests/platform/mac/accessibility/element-haspopup-expected.txt	2013-07-16 12:22:20 UTC (rev 152715)
+++ trunk/LayoutTests/platform/mac/accessibility/element-haspopup-expected.txt	2013-07-16 12:55:56 UTC (rev 152716)
@@ -1,12 +0,0 @@
-Link 1 Link 2
-This tests that an element will report that it has a popup correctly.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS accessibilityController.focusedElement.hasPopup is true
-PASS accessibilityController.focusedElement.hasPopup is false
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/platform/mac/accessibility/element-haspopup.html (152715 => 152716)


--- trunk/LayoutTests/platform/mac/accessibility/element-haspopup.html	2013-07-16 12:22:20 UTC (rev 152715)
+++ trunk/LayoutTests/platform/mac/accessibility/element-haspopup.html	2013-07-16 12:55:56 UTC (rev 152716)
@@ -1,31 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src=""
-</head>
-<body id="body">
-
-<a href="" aria-haspopup="true" tabindex="0" id="link1">Link 1</a>
-<a href="" aria-haspopup="false" tabindex="0" id="link2">Link 2</a>
-
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
-
-    description("This tests that an element will report that it has a popup correctly.");
-
-    if (window.accessibilityController) {
-
-        document.getElementById("link1").focus();
-        shouldBe("accessibilityController.focusedElement.hasPopup", "true");
-
-        document.getElementById("link2").focus();
-        shouldBe("accessibilityController.focusedElement.hasPopup", "false");
-    }
-
-</script>
-
-<script src=""
-</body>
-</html>

Deleted: trunk/LayoutTests/platform/mac/accessibility/popup-button-title-expected.txt (152715 => 152716)


--- trunk/LayoutTests/platform/mac/accessibility/popup-button-title-expected.txt	2013-07-16 12:22:20 UTC (rev 152715)
+++ trunk/LayoutTests/platform/mac/accessibility/popup-button-title-expected.txt	2013-07-16 12:55:56 UTC (rev 152716)
@@ -1,12 +0,0 @@
-Click me
-
-This tests that a popup button will return the text under the element for its title.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS element.title is 'AXTitle: Click me'
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/platform/mac/accessibility/popup-button-title.html (152715 => 152716)


--- trunk/LayoutTests/platform/mac/accessibility/popup-button-title.html	2013-07-16 12:22:20 UTC (rev 152715)
+++ trunk/LayoutTests/platform/mac/accessibility/popup-button-title.html	2013-07-16 12:55:56 UTC (rev 152716)
@@ -1,29 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src=""
-</head>
-<body id="body">
-
-<p><a id="link" role="button" aria-owns="popup" aria-haspopup="true" tabindex="0" href="" me</a></p>
-
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
-
-    description("This tests that a popup button will return the text under the element for its title.");
-
-    if (window.accessibilityController) {
-        document.getElementById("link").focus();
-        var element = accessibilityController.focusedElement;
-
-        // The element should not be ignored (it should be a group)
-        shouldBe("element.title", "'AXTitle: Click me'");
-    }
-
-</script>
-
-<script src=""
-</body>
-</html>

Modified: trunk/Source/WebCore/ChangeLog (152715 => 152716)


--- trunk/Source/WebCore/ChangeLog	2013-07-16 12:22:20 UTC (rev 152715)
+++ trunk/Source/WebCore/ChangeLog	2013-07-16 12:55:56 UTC (rev 152716)
@@ -1,3 +1,18 @@
+2013-07-16  Krzysztof Czech  <[email protected]>
+
+        [ATK] Adds support for aria-haspopup property.
+        https://bugs.webkit.org/show_bug.cgi?id=117834
+
+        Reviewed by Christophe Dumez.
+
+        Adds support for aria-haspopup property.
+
+        Tests: accessibility/element-haspopup.html
+               accessibility/popup-button-title.html
+
+        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
+        (webkitAccessibleGetAttributes):
+
 2013-07-16  Víctor Manuel Jáquez Leal  <[email protected]>
 
         [texmap][GStreamer] upload onto the texture only the buffer to be painted

Modified: trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp (152715 => 152716)


--- trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp	2013-07-16 12:22:20 UTC (rev 152715)
+++ trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp	2013-07-16 12:55:56 UTC (rev 152716)
@@ -495,6 +495,9 @@
     if (!placeholder.isEmpty())
         attributeSet = addToAtkAttributeSet(attributeSet, "placeholder-text", placeholder.utf8().data());
 
+    if (coreObject->ariaHasPopup())
+        attributeSet = addToAtkAttributeSet(attributeSet, "aria-haspopup", "true");
+
     return attributeSet;
 }
 

Modified: trunk/Tools/ChangeLog (152715 => 152716)


--- trunk/Tools/ChangeLog	2013-07-16 12:22:20 UTC (rev 152715)
+++ trunk/Tools/ChangeLog	2013-07-16 12:55:56 UTC (rev 152716)
@@ -1,3 +1,21 @@
+2013-07-16  Krzysztof Czech  <[email protected]>
+
+        [ATK] Adds support for aria-haspopup property.
+        https://bugs.webkit.org/show_bug.cgi?id=117834
+
+        Reviewed by Christophe Dumez.
+
+        Adds implementation for testing aria-haspopup property.
+
+        * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
+        (getAttributeSetValueForId):
+        (AccessibilityUIElement::stringAttributeValue):
+        (AccessibilityUIElement::hasPopup):
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+        (WTR::getAttributeSetValueForId):
+        (WTR::AccessibilityUIElement::stringAttributeValue):
+        (WTR::AccessibilityUIElement::hasPopup):
+
 2013-07-16  Michael Brüning  <[email protected]>
 
         [Qt] Replace Nokia references.

Modified: trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp (152715 => 152716)


--- trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp	2013-07-16 12:22:20 UTC (rev 152715)
+++ trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp	2013-07-16 12:55:56 UTC (rev 152716)
@@ -51,6 +51,24 @@
     return "";
 }
 
+static String getAttributeSetValueForId(AtkObject* accessible, const char* id)
+{
+    const char* attributeValue = 0;
+    AtkAttributeSet* attributeSet = atk_object_get_attributes(accessible);
+    for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) {
+        AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data);
+        if (!strcmp(atkAttribute->name, id)) {
+            attributeValue = atkAttribute->value;
+            break;
+        }
+    }
+
+    String atkAttributeValue = String::fromUTF8(attributeValue);
+    atk_attribute_set_free(attributeSet);
+
+    return atkAttributeValue;
+}
+
 static inline String roleToString(AtkRole role)
 {
     switch (role) {
@@ -804,21 +822,8 @@
     if (atkAttributeName.isEmpty())
         return JSStringCreateWithCharacters(0, 0);
 
-    const char* attributeValue = 0;
-    AtkAttributeSet* attributeSet = atk_object_get_attributes(ATK_OBJECT(m_element));
-    for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) {
-        AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data);
-        if (!strcmp(atkAttribute->name, atkAttributeName.utf8().data())) {
-            attributeValue = atkAttribute->value;
-            break;
-        }
-    }
-    JSStringRef jsString = attributeValue
-        ? JSStringCreateWithUTF8CString(attributeValue)
-        : JSStringCreateWithCharacters(0, 0);
-    atk_attribute_set_free(attributeSet);
-
-    return jsString;
+    String attributeValue = getAttributeSetValueForId(ATK_OBJECT(m_element), atkAttributeName.utf8().data());
+    return JSStringCreateWithUTF8CString(attributeValue.utf8().data());
 }
 
 double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute)
@@ -1021,8 +1026,10 @@
 
 bool AccessibilityUIElement::hasPopup() const
 {
-    // FIXME: implement
-    return false;
+    if (!m_element || !ATK_IS_OBJECT(m_element))
+        return false;
+
+    return equalIgnoringCase(getAttributeSetValueForId(ATK_OBJECT(m_element), "aria-haspopup"), "true");
 }
 
 void AccessibilityUIElement::takeFocus()

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp (152715 => 152716)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp	2013-07-16 12:22:20 UTC (rev 152715)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp	2013-07-16 12:55:56 UTC (rev 152716)
@@ -53,6 +53,24 @@
     return attributeString == "AXPlaceholderValue" ? "placeholder-text" : String();
 }
 
+static String getAttributeSetValueForId(AtkObject* accessible, const char* id)
+{
+    const char* attributeValue = 0;
+    AtkAttributeSet* attributeSet = atk_object_get_attributes(accessible);
+    for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) {
+        AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data);
+        if (!strcmp(atkAttribute->name, id)) {
+            attributeValue = atkAttribute->value;
+            break;
+        }
+    }
+
+    String atkAttributeValue = String::fromUTF8(attributeValue);
+    atk_attribute_set_free(attributeSet);
+
+    return atkAttributeValue;
+}
+
 static char* getAtkAttributeSetAsString(AtkObject* accessible)
 {
     GString* str = g_string_new(0);
@@ -473,21 +491,8 @@
     if (atkAttributeName.isNull())
         return JSStringCreateWithCharacters(0, 0);
 
-    const char* attributeValue = 0;
-    AtkAttributeSet* attributeSet = atk_object_get_attributes(ATK_OBJECT(m_element.get()));
-    for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) {
-        AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data);
-        if (!strcmp(atkAttribute->name, atkAttributeName.utf8().data())) {
-            attributeValue = atkAttribute->value;
-            break;
-        }
-    }
-    JSStringRef jsString = attributeValue
-        ? JSStringCreateWithUTF8CString(attributeValue)
-        : JSStringCreateWithCharacters(0, 0);
-    atk_attribute_set_free(attributeSet);
-
-    return jsString;
+    String attributeValue = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), atkAttributeName.utf8().data());
+    return JSStringCreateWithUTF8CString(attributeValue.utf8().data());
 }
 
 double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute)
@@ -1074,8 +1079,10 @@
 
 bool AccessibilityUIElement::hasPopup() const
 {
-    // FIXME: implement
-    return false;
+    if (!m_element || !ATK_IS_OBJECT(m_element.get()))
+        return false;
+
+    return equalIgnoringCase(getAttributeSetValueForId(ATK_OBJECT(m_element.get()), "aria-haspopup"), "true");
 }
 
 void AccessibilityUIElement::takeFocus()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to