Title: [160450] trunk
Revision
160450
Author
mario.pr...@samsung.com
Date
2013-12-11 11:49:39 -0800 (Wed, 11 Dec 2013)

Log Message

[ATK] Expose accessibility objects WAI-ARIA landmark roles
https://bugs.webkit.org/show_bug.cgi?id=125584

Reviewed by Chris Fleizach.

Source/WebCore:

Exposed accessibility objects with landmark roles with the proper
AtkRole, to be provided by the next stable release of ATK.

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

Tools:

Add mappings to DRT & WKTR for landmark roles.

* DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
(AccessibilityUIElement::role):
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::role):
* gtk/jhbuild.modules:

LayoutTests:

Update test to unskip landmark elements and update expectations.

* platform/gtk/accessibility/roles-exposed-expected.txt:
* platform/gtk/accessibility/roles-exposed.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (160449 => 160450)


--- trunk/LayoutTests/ChangeLog	2013-12-11 19:18:08 UTC (rev 160449)
+++ trunk/LayoutTests/ChangeLog	2013-12-11 19:49:39 UTC (rev 160450)
@@ -1,5 +1,17 @@
 2013-12-11  Mario Sanchez Prada  <mario.pr...@samsung.com>
 
+        [ATK] Expose accessibility objects WAI-ARIA landmark roles
+        https://bugs.webkit.org/show_bug.cgi?id=125584
+
+        Reviewed by Chris Fleizach.
+
+        Update test to unskip landmark elements and update expectations.
+
+        * platform/gtk/accessibility/roles-exposed-expected.txt:
+        * platform/gtk/accessibility/roles-exposed.html:
+
+2013-12-11  Mario Sanchez Prada  <mario.pr...@samsung.com>
+
         [ATK] Add new layout test to check ATK roles in a central place
         https://bugs.webkit.org/show_bug.cgi?id=125525
 

Modified: trunk/LayoutTests/platform/gtk/accessibility/roles-exposed-expected.txt (160449 => 160450)


--- trunk/LayoutTests/platform/gtk/accessibility/roles-exposed-expected.txt	2013-12-11 19:18:08 UTC (rev 160449)
+++ trunk/LayoutTests/platform/gtk/accessibility/roles-exposed-expected.txt	2013-12-11 19:49:39 UTC (rev 160450)
@@ -6,6 +6,12 @@
 PASS: a[href]
       AXRole: AXLink
       
+PASS: address
+      AXRole: AXLandmarkContentInfo
+      
+PASS: aside
+      AXRole: AXLandmarkComplementary
+      
 PASS: blockquote
       AXRole: AXGroup
       
@@ -24,6 +30,9 @@
 PASS: form
       AXRole: AXForm
       
+PASS: header
+      AXRole: AXLandmarkBanner
+      
 PASS: hgroup
       AXRole: AXGroup
       
@@ -114,6 +123,9 @@
 PASS: input[type='week']
       AXRole: AXTextField
       
+PASS: nav
+      AXRole: AXLandmarkNavigation
+      
 PASS: ol
       AXRole: AXList
       
@@ -216,6 +228,12 @@
 PASS: div[role=alertdialog]
       AXRole: AXAlert
       
+PASS: div[role=application]
+      AXRole: AXEmbedded
+      
+PASS: div[role=banner]
+      AXRole: AXLandmarkBanner
+      
 PASS: div[role=button]
       AXRole: AXButton
       
@@ -225,6 +243,12 @@
 PASS: div[role=combobox]
       AXRole: AXComboBox
       
+PASS: div[role=complementary]
+      AXRole: AXLandmarkComplementary
+      
+PASS: div[role=contentinfo]
+      AXRole: AXLandmarkContentInfo
+      
 PASS: div[role=directory]
       AXRole: AXList
       
@@ -266,6 +290,9 @@
 PASS: div[role=option]
       AXRole: AXListItem
       
+PASS: div[role=main]
+      AXRole: AXLandmarkMain
+      
 PASS: div[role=menu]
       AXRole: AXMenu
       
@@ -284,6 +311,9 @@
 PASS: div[role=menuitemradio]
       AXRole: AXRadioMenuItem
       
+PASS: div[role=navigation]
+      AXRole: AXLandmarkNavigation
+      
 PASS: div[role=progressbar]
       AXRole: AXProgressIndicator
       
@@ -296,6 +326,9 @@
 PASS: div[role=scrollbar]
       AXRole: AXScrollBar
       
+PASS: div[role=search]
+      AXRole: AXLandmarkSearch
+      
 PASS: div[role=separator]
       AXRole: AXSeparator
       

Modified: trunk/LayoutTests/platform/gtk/accessibility/roles-exposed.html (160449 => 160450)


--- trunk/LayoutTests/platform/gtk/accessibility/roles-exposed.html	2013-12-11 19:18:08 UTC (rev 160449)
+++ trunk/LayoutTests/platform/gtk/accessibility/roles-exposed.html	2013-12-11 19:49:39 UTC (rev 160450)
@@ -10,10 +10,10 @@
 <a data-role="AXLink" href="" data-note="[href]" class="ex">X</a>
 <!-- skipped ATK: not focusable <a data-role="" data-note=":not([href])" class="ex">X</a>-->
 <!-- skipped ATK: not focusable <abbr data-role="" class="ex">X</abbr>-->
-<!-- http://webkit.org/b/125493 <address data-role="AXLandmarkContentInfo" class="ex">X</address>-->
+<address data-role="AXLandmarkContentInfo" class="ex">X</address>
 <!-- skipped <area> -->
 <!-- http://webkit.org/b/125493 <article data-role="AXArticle" class="ex">X</article>-->
-<!-- http://webkit.org/b/125493 <aside data-role="AXLandmarkComplementary" class="ex">X</aside>-->
+<aside data-role="AXLandmarkComplementary" class="ex">X</aside>
 <!-- http://webkit.org/b/125491 <audio data-role="" class="ex">X</audio>-->
 <!-- skipped ATK: not focusable <b data-role="" class="ex">X</b>-->
 <!-- skipped ATK: not focusable <bdo data-role="" class="ex">X</bdo>-->
@@ -43,7 +43,7 @@
 <!-- skipped <frame> -->
 <!-- skipped <frameset> -->
 <!-- skipped <head> -->
-<!-- http://webkit.org/b/125493 <header data-role="AXLandmarkBanner" class="ex">X</header>-->
+<header data-role="AXLandmarkBanner" class="ex">X</header>
 <hgroup data-role="AXGroup" class="ex">X</hgroup>
 <h1 data-role="AXHeading" class="ex">X</h1>
 <h2 data-role="AXHeading" class="ex">X</h2>
@@ -94,7 +94,7 @@
 <!-- skipped <menu> -->
 <!-- skipped <meta> -->
 <!-- http://webkit.org/b/125491 <meter data-role="AXProgressIndicator" class="ex" value="0.75">X</meter>-->
-<!-- http://webkit.org/b/125493 <nav data-role="AXLandmarkNavigation" class="ex">X</nav>-->
+<nav data-role="AXLandmarkNavigation" class="ex">X</nav>
 <!-- skipped <noscript> -->
 <!-- skipped <object> -->
 <ol data-role="AXList" class="ex">
@@ -188,14 +188,14 @@
 <!-- ==================================================================================================== -->
 <div role="alert"                    data-role="AXAlert" class="ex">X</div>
 <div role="alertdialog"              data-role="AXAlert" class="ex">X</div>
-<!-- http://webkit.org/b/125493 <div role="application"              data-role="AXEmbedded" class="ex">X</div>-->
+<div role="application"              data-role="AXEmbedded" class="ex">X</div>
 <!-- http://webkit.org/b/125493 <div role="article"                  data-role="AXArticle" class="ex">X</div>-->
-<!-- http://webkit.org/b/125493 <div role="banner"                   data-role="AXLandmarkBanner" class="ex">X</div>-->
+<div role="banner"                   data-role="AXLandmarkBanner" class="ex">X</div>
 <div role="button"                   data-role="AXButton" class="ex">X</div>
 <div role="checkbox"                 data-role="AXCheckBox" class="ex">X</div>
 <div role="combobox"                 data-role="AXComboBox" class="ex">X</div>
-<!-- http://webkit.org/b/125493 <div role="complementary"            data-role="AXLandmarkComplementary" class="ex">X</div>-->
-<!-- http://webkit.org/b/125493 <div role="contentinfo"              data-role="AXLandmarkContentInfo" class="ex">X</div>-->
+<div role="complementary"            data-role="AXLandmarkComplementary" class="ex">X</div>
+<div role="contentinfo"              data-role="AXLandmarkContentInfo" class="ex">X</div>
 <!-- http://webkit.org/b/125493 <div role="definition"               data-role="AXDefinition" class="ex">X</div>-->
 <!-- http://webkit.org/b/125493 <div role="dialog"                   data-role="AXGroup" class="ex">X</div>-->
 <div role="directory"                data-role="AXList" class="ex">X</div>
@@ -222,7 +222,7 @@
     <div role="option"               data-role="AXListItem" class="ex">X</div>
 </div>
 <!-- http://webkit.org/b/125493 <div role="log"                      data-role="AXLog" class="ex">X</div>-->
-<!-- http://webkit.org/b/125493 <div role="main"                     data-role="AXLandmarkMain" class="ex">X</div>-->
+<div role="main"                     data-role="AXLandmarkMain" class="ex">X</div>
 <!-- http://webkit.org/b/125493 <div role="marquee"                  data-role="AXMarquee" class="ex">X</div>-->
 <!-- http://webkit.org/b/125493 <div role="math"                     data-role="AXMath" class="ex">X</div>-->
 <div role="menu"                     data-role="AXMenu" class="ex">
@@ -237,7 +237,7 @@
     <!-- http://webkit.org/b/125493 <div role="menuitemcheckbox"     data-role="AXCheckMenuItem" class="ex">X</div>-->
     <div role="menuitemradio"        data-role="AXRadioMenuItem" class="ex">X</div>
 </div>
-<!-- http://webkit.org/b/125493 <div role="navigation"               data-role="AXLandmarkNavigation" class="ex">X</div>-->
+<div role="navigation"               data-role="AXLandmarkNavigation" class="ex">X</div>
 <!-- http://webkit.org/b/125493 <div role="note"                     data-role="AXComment" class="ex">X</div>-->
 <!-- skipped: presentation elements should not be exposed directly <div role="presentation"             data-role="" class="ex">X</div>-->
 <div role="progressbar"              data-role="AXProgressIndicator" class="ex">X</div>
@@ -246,7 +246,7 @@
 </div>
 <!-- http://webkit.org/b/125493 <div role="region"                   data-role="AXGroup" class="ex">X</div>-->
 <div role="scrollbar"                data-role="AXScrollBar" class="ex">X</div>
-<!-- http://webkit.org/b/125493 <div role="search"                   data-role="AXLandmarkSearch" class="ex">X</div>-->
+<div role="search"                   data-role="AXLandmarkSearch" class="ex">X</div>
 <div role="separator"                data-role="AXSeparator" class="ex">X</div>
 <div role="slider"                   data-role="AXSlider" class="ex">X</div>
 <div role="spinbutton"               data-role="AXSpinButton" class="ex">X</div>

Modified: trunk/Source/WebCore/ChangeLog (160449 => 160450)


--- trunk/Source/WebCore/ChangeLog	2013-12-11 19:18:08 UTC (rev 160449)
+++ trunk/Source/WebCore/ChangeLog	2013-12-11 19:49:39 UTC (rev 160450)
@@ -1,3 +1,17 @@
+2013-12-11  Mario Sanchez Prada  <mario.pr...@samsung.com>
+
+        [ATK] Expose accessibility objects WAI-ARIA landmark roles
+        https://bugs.webkit.org/show_bug.cgi?id=125584
+
+        Reviewed by Chris Fleizach.
+
+        Exposed accessibility objects with landmark roles with the proper
+        AtkRole, to be provided by the next stable release of ATK.
+
+        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
+        (webkitAccessibleGetAttributes):
+        (atkRole):
+
 2013-12-11  José Dapena Paz  <jdap...@igalia.com> and Zan Dobersek  <zdober...@igalia.com>
 
         [GTK] Add a UPower-based BatteryProvider

Modified: trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp (160449 => 160450)


--- trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp	2013-12-11 19:18:08 UTC (rev 160449)
+++ trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp	2013-12-11 19:49:39 UTC (rev 160450)
@@ -528,6 +528,32 @@
         attributeSet = addToAtkAttributeSet(attributeSet, "sort", sortAttribute.string().utf8().data());
     }
 
+    // Landmarks will be exposed with xml-roles object attributes, with the exception
+    // of LandmarkApplicationRole, which will be exposed with ATK_ROLE_EMBEDDED.
+    AccessibilityRole role = coreObject->roleValue();
+    switch (role) {
+    case LandmarkBannerRole:
+        attributeSet = addToAtkAttributeSet(attributeSet, "xml-roles", "banner");
+        break;
+    case LandmarkComplementaryRole:
+        attributeSet = addToAtkAttributeSet(attributeSet, "xml-roles", "complementary");
+        break;
+    case LandmarkContentInfoRole:
+        attributeSet = addToAtkAttributeSet(attributeSet, "xml-roles", "contentinfo");
+        break;
+    case LandmarkMainRole:
+        attributeSet = addToAtkAttributeSet(attributeSet, "xml-roles", "main");
+        break;
+    case LandmarkNavigationRole:
+        attributeSet = addToAtkAttributeSet(attributeSet, "xml-roles", "navigation");
+        break;
+    case LandmarkSearchRole:
+        attributeSet = addToAtkAttributeSet(attributeSet, "xml-roles", "search");
+        break;
+    default:
+        break;
+    }
+
     return attributeSet;
 }
 
@@ -662,6 +688,17 @@
         return ATK_ROLE_TOOL_TIP;
     case WebAreaRole:
         return ATK_ROLE_DOCUMENT_WEB;
+    case LandmarkApplicationRole:
+        return ATK_ROLE_EMBEDDED;
+#if ATK_CHECK_VERSION(2, 11, 3)
+    case LandmarkBannerRole:
+    case LandmarkComplementaryRole:
+    case LandmarkContentInfoRole:
+    case LandmarkMainRole:
+    case LandmarkNavigationRole:
+    case LandmarkSearchRole:
+        return ATK_ROLE_LANDMARK;
+#endif
     default:
         return ATK_ROLE_UNKNOWN;
     }

Modified: trunk/Tools/ChangeLog (160449 => 160450)


--- trunk/Tools/ChangeLog	2013-12-11 19:18:08 UTC (rev 160449)
+++ trunk/Tools/ChangeLog	2013-12-11 19:49:39 UTC (rev 160450)
@@ -1,3 +1,18 @@
+2013-12-11  Mario Sanchez Prada  <mario.pr...@samsung.com>
+
+        [ATK] Expose accessibility objects WAI-ARIA landmark roles
+        https://bugs.webkit.org/show_bug.cgi?id=125584
+
+        Reviewed by Chris Fleizach.
+
+        Add mappings to DRT & WKTR for landmark roles.
+
+        * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
+        (AccessibilityUIElement::role):
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+        (WTR::AccessibilityUIElement::role):
+        * gtk/jhbuild.modules:
+
 2013-12-11  Alejandro G. Castro  <a...@igalia.com>
 
         [GTK] Avoid double quotations when passing parameters to valgrind in gtk.py

Modified: trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp (160449 => 160450)


--- trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp	2013-12-11 19:18:08 UTC (rev 160449)
+++ trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp	2013-12-11 19:49:39 UTC (rev 160450)
@@ -81,6 +81,15 @@
     { "AXUnknownSortDirection", "unknown" }
 };
 
+#if ATK_CHECK_VERSION(2, 11, 3)
+const char* landmarkStringBanner = "AXLandmarkBanner";
+const char* landmarkStringComplementary = "AXLandmarkComplementary";
+const char* landmarkStringContentinfo = "AXLandmarkContentInfo";
+const char* landmarkStringMain = "AXLandmarkMain";
+const char* landmarkStringNavigation = "AXLandmarkNavigation";
+const char* landmarkStringSearch = "AXLandmarkSearch";
+#endif
+
 String jsStringToWTFString(JSStringRef attribute)
 {
     size_t bufferSize = JSStringGetMaximumUTF8CStringSize(attribute);
@@ -178,8 +187,28 @@
     return builder.toString();
 }
 
-inline const char* roleToString(AtkRole role)
+const char* roleToString(AtkObject* object)
 {
+    AtkRole role = atk_object_get_role(object);
+
+#if ATK_CHECK_VERSION(2, 11, 3)
+    if (role == ATK_ROLE_LANDMARK) {
+        String xmlRolesValue = getAttributeSetValueForId(object, ObjectAttributeType, "xml-roles");
+        if (equalIgnoringCase(xmlRolesValue, "banner"))
+            return landmarkStringBanner;
+        if (equalIgnoringCase(xmlRolesValue, "complementary"))
+            return landmarkStringComplementary;
+        if (equalIgnoringCase(xmlRolesValue, "contentinfo"))
+            return landmarkStringContentinfo;
+        if (equalIgnoringCase(xmlRolesValue, "main"))
+            return landmarkStringMain;
+        if (equalIgnoringCase(xmlRolesValue, "navigation"))
+            return landmarkStringNavigation;
+        if (equalIgnoringCase(xmlRolesValue, "search"))
+            return landmarkStringSearch;
+    }
+#endif
+
     switch (role) {
     case ATK_ROLE_ALERT:
         return "AXAlert";
@@ -335,7 +364,7 @@
     builder.append("AXParent: ");
     AccessibilityUIElement parent = element->parentElement();
     if (AtkObject* atkParent = parent.platformUIElement()) {
-        builder.append(roleToString(atk_object_get_role(atkParent)));
+        builder.append(roleToString(atkParent));
         const char* parentName = atk_object_get_name(atkParent);
         if (parentName && g_utf8_strlen(parentName, -1))
             builder.append(String::format(": %s", parentName));
@@ -679,11 +708,10 @@
     if (!ATK_IS_OBJECT(m_element))
         return JSStringCreateWithCharacters(0, 0);
 
-    AtkRole role = atk_object_get_role(ATK_OBJECT(m_element));
-    if (!role)
+    if (!atk_object_get_role(ATK_OBJECT(m_element)))
         return JSStringCreateWithCharacters(0, 0);
 
-    GOwnPtr<char> roleStringWithPrefix(g_strdup_printf("AXRole: %s", roleToString(role)));
+    GOwnPtr<char> roleStringWithPrefix(g_strdup_printf("AXRole: %s", roleToString(ATK_OBJECT(m_element))));
     return JSStringCreateWithUTF8CString(roleStringWithPrefix.get());
 }
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp (160449 => 160450)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp	2013-12-11 19:18:08 UTC (rev 160449)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp	2013-12-11 19:49:39 UTC (rev 160450)
@@ -85,6 +85,15 @@
     { "AXUnknownSortDirection", "unknown" }
 };
 
+#if ATK_CHECK_VERSION(2, 11, 3)
+const char* landmarkStringBanner = "AXLandmarkBanner";
+const char* landmarkStringComplementary = "AXLandmarkComplementary";
+const char* landmarkStringContentinfo = "AXLandmarkContentInfo";
+const char* landmarkStringMain = "AXLandmarkMain";
+const char* landmarkStringNavigation = "AXLandmarkNavigation";
+const char* landmarkStringSearch = "AXLandmarkSearch";
+#endif
+
 String jsStringToWTFString(JSStringRef attribute)
 {
     size_t bufferSize = JSStringGetMaximumUTF8CStringSize(attribute);
@@ -267,8 +276,28 @@
     return g_strdup(uString.utf8().data());
 }
 
-const gchar* roleToString(AtkRole role)
+const gchar* roleToString(AtkObject* object)
 {
+    AtkRole role = atk_object_get_role(object);
+
+#if ATK_CHECK_VERSION(2, 11, 3)
+    if (role == ATK_ROLE_LANDMARK) {
+        String xmlRolesValue = getAttributeSetValueForId(object, ObjectAttributeType, "xml-roles");
+        if (equalIgnoringCase(xmlRolesValue, "banner"))
+            return landmarkStringBanner;
+        if (equalIgnoringCase(xmlRolesValue, "complementary"))
+            return landmarkStringComplementary;
+        if (equalIgnoringCase(xmlRolesValue, "contentinfo"))
+            return landmarkStringContentinfo;
+        if (equalIgnoringCase(xmlRolesValue, "main"))
+            return landmarkStringMain;
+        if (equalIgnoringCase(xmlRolesValue, "navigation"))
+            return landmarkStringNavigation;
+        if (equalIgnoringCase(xmlRolesValue, "search"))
+            return landmarkStringSearch;
+    }
+#endif
+
     switch (role) {
     case ATK_ROLE_ALERT:
         return "AXAlert";
@@ -400,7 +429,7 @@
     RefPtr<AccessibilityUIElement> parent = element->parentElement();
     AtkObject* atkParent = parent ? parent->platformUIElement().get() : nullptr;
     if (atkParent) {
-        builder.append(roleToString(atk_object_get_role(atkParent)));
+        builder.append(roleToString(atkParent));
         const char* parentName = atk_object_get_name(atkParent);
         if (parentName && g_utf8_strlen(parentName, -1))
             builder.append(String::format(": %s", parentName));
@@ -800,11 +829,10 @@
     if (!ATK_IS_OBJECT(m_element.get()))
         return JSStringCreateWithCharacters(0, 0);
 
-    AtkRole role = atk_object_get_role(ATK_OBJECT(m_element.get()));
-    if (!role)
+    if (!atk_object_get_role(ATK_OBJECT(m_element.get())))
         return JSStringCreateWithCharacters(0, 0);
 
-    GOwnPtr<char> roleStringWithPrefix(g_strdup_printf("AXRole: %s", roleToString(role)));
+    GOwnPtr<char> roleStringWithPrefix(g_strdup_printf("AXRole: %s", roleToString(ATK_OBJECT(m_element.get()))));
     return JSStringCreateWithUTF8CString(roleStringWithPrefix.get());
 }
 

Modified: trunk/Tools/gtk/jhbuild.modules (160449 => 160450)


--- trunk/Tools/gtk/jhbuild.modules	2013-12-11 19:18:08 UTC (rev 160449)
+++ trunk/Tools/gtk/jhbuild.modules	2013-12-11 19:49:39 UTC (rev 160450)
@@ -232,9 +232,9 @@
   <autotools id="atk"
              autogen-sh="configure"
              autogenargs="--disable-introspection">
-    <branch module="pub/GNOME/sources/atk/2.10/atk-2.10.0.tar.xz" version="2.10.0"
+    <branch module="pub/GNOME/sources/atk/2.11/atk-2.11.3.tar.xz" version="2.11.3"
             repo="ftp.gnome.org"
-            hash="sha256:636917a5036bc851d8491194645d284798ec118919a828be5e713b6ecc5b50b0"/>
+            hash="sha256:b3c63668638dbb627a81f4333a00b744c503531d07b168405ef5f27f382a0ae4"/>
   </autotools>
 
   <autotools id="at-spi2-core" 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to