AX: [ATK] Inline text elements with accessible object attributes and/or event handler...
authorjdiggs@igalia.com <jdiggs@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Dec 2014 19:51:28 +0000 (19:51 +0000)
committerjdiggs@igalia.com <jdiggs@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Dec 2014 19:51:28 +0000 (19:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=139071

Reviewed by Chris Fleizach.

Source/WebCore:

Adds a new InlineRole accessibility role type for non-focusable inline
elements which have an event handler or attribute suggesting possible
inclusion by the platform. This is mapped to ATK_ROLE_STATIC for GTK and
EFL. On the Mac, it is currently ignored to preserve existing behavior.

Added new test cases to the existing roles-exposed.html test.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::supportsDatetimeAttribute): Added.
* accessibility/AccessibilityObject.h: Added InlineRole.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::determineAccessibilityRole): Handle InlineRole.
* accessibility/atk/AccessibilityObjectAtk.cpp:
(WebCore::AccessibilityObject::accessibilityPlatformIncludesObject): Include InlineRole objects.
* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(atkRole):
* accessibility/mac/AccessibilityObjectMac.mm:
(WebCore::AccessibilityObject::accessibilityPlatformIncludesObject): Ignore InlineRole objects.
* html/HTMLTagNames.in: Added 'time'.

Tools:

Add string value for ATK_ROLE_STATIC in roleToString.

* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:

LayoutTests:

* accessibility/roles-exposed.html: New test cases added.
* platform/efl/accessibility/roles-exposed-expected.txt: Updated for new test cases.
* platform/gtk/accessibility/roles-exposed-expected.txt: Updated for new test cases.
* platform/mac-mavericks/accessibility/roles-exposed-expected.txt: Updated for new test cases.
* platform/mac-mountainlion/accessibility/roles-exposed-expected.txt: Updated for new test cases.
* platform/mac/accessibility/roles-exposed-expected.txt: Updated for new test cases.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176731 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
LayoutTests/ChangeLog
LayoutTests/accessibility/roles-exposed.html
LayoutTests/platform/efl/accessibility/roles-exposed-expected.txt
LayoutTests/platform/gtk/accessibility/roles-exposed-expected.txt
LayoutTests/platform/mac-mavericks/accessibility/roles-exposed-expected.txt
LayoutTests/platform/mac-mountainlion/accessibility/roles-exposed-expected.txt
LayoutTests/platform/mac/accessibility/roles-exposed-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp
Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm
Source/WebCore/html/HTMLTagNames.in
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp

index 861baae..de31874 100644 (file)
@@ -1,3 +1,17 @@
+2014-12-03  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: [ATK] Inline text elements with accessible object attributes and/or event handlers are not exposed
+        https://bugs.webkit.org/show_bug.cgi?id=139071
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/roles-exposed.html: New test cases added.
+        * platform/efl/accessibility/roles-exposed-expected.txt: Updated for new test cases.
+        * platform/gtk/accessibility/roles-exposed-expected.txt: Updated for new test cases.
+        * platform/mac-mavericks/accessibility/roles-exposed-expected.txt: Updated for new test cases.
+        * platform/mac-mountainlion/accessibility/roles-exposed-expected.txt: Updated for new test cases.
+        * platform/mac/accessibility/roles-exposed-expected.txt: Updated for new test cases.
+
 2014-12-03  Chris Dumez  <cdumez@apple.com>
 
         Add layout test for DOM timer throttling in iframe scrolled out of viewport
index 7ce939c..427645d 100644 (file)
@@ -8,7 +8,8 @@
 <!-- ==================================================================================================== -->
 <a data-platform="atk,mac" href="#" data-note="[href]" class="ex">X</a>
 <a data-platform="atk,mac" data-note=":not([href])" class="ex">X</a>
-<abbr data-platform="atk,mac" class="ex">X</abbr>
+<abbr data-platform="atk,mac" data-note=":not([title])" class="ex">X</abbr>
+<abbr data-platform="atk,mac" title="Times" data-note="[title]" class="ex">X</abbr>
 <!-- http://webkit.org/b/83989 --><address data-platform="atk,mac" class="ex">X</address>
 <!-- skipped <area> -->
 <article data-platform="atk,mac" class="ex">X</article>
@@ -23,7 +24,8 @@
 <code data-platform="atk,mac" class="ex">X</code>
 <!-- skipped <command> -->
 <!-- skipped <datalist> -->
-<del data-platform="atk,mac" class="ex">X</del>
+<del data-platform="atk,mac" data-note=":not([datetime])" class="ex">X</del>
+<del data-platform="atk,mac" datetime="2014-10-31 00:00" data-note="[datetime]" class="ex">X</del>
 <!-- skipped <details/summary> http://webkit.org/b/108979 -->
 <dfn data-platform="atk,mac" class="ex">X</dfn>
 <dl data-platform="atk,mac" class="ex">
@@ -87,7 +89,8 @@
 <!-- http://webkit.org/b/109017 --><input data-platform="atk,mac" type="time" value="X" class="ex" data-note="[type='time']">
 <!-- http://webkit.org/b/109017 --><input data-platform="atk,mac" type="url" value="X" class="ex" data-note="[type='url']">
 <!-- http://webkit.org/b/109017 --><input data-platform="atk,mac" type="week" value="X" class="ex" data-note="[type='week']">
-<ins data-platform="atk,mac" class="ex">X</ins>
+<ins data-platform="atk,mac" data-note=":not([datetime])" class="ex">X</ins>
+<ins data-platform="atk,mac" datetime="2014-10-31 00:00" data-note="[datetime]" class="ex">X</ins>
 <!-- skipped <link> -->
 <map data-platform="atk,mac" class="ex" name="imagemap">
   <area data-platform="atk,mac" class="ex" shape="rect" coords="0,0,10,10" href="#" title="x" />
 </select>
 <small data-platform="atk,mac" class="ex">X</small>
 <!-- skipped <source> -->
-<span data-platform="atk,mac" class="ex">X</span>
+<span data-platform="atk,mac" data-note=":not([onclick])" class="ex">X</span>
+<span data-platform="atk,mac" onclick="return;" data-note="[onclick]" class="ex">X</span>
 <strong data-platform="atk,mac" class="ex">X</strong>
 <!-- skipped <style> -->
 <sub data-platform="atk,mac" class="ex">X</sub>
     </tfoot>
 </table>
 <textarea data-platform="atk,mac" class="ex">X</textarea>
-<time data-platform="atk,mac" class="ex">X</time>
+<time data-platform="atk,mac" data-note=":not([datetime])" class="ex">X</time>
+<time data-platform="atk,mac" datetime="2014-10-31 00:00" data-note="[datetime]" class="ex">X</time>
 <!-- skipped <title> -->
 <ul data-platform="atk,mac" class="ex">
     <li data-platform="atk,mac" class="ex">X</li>
index 59953e4..4bf3d10 100644 (file)
@@ -10,9 +10,12 @@ a[href]
 a:not([href])
       AXRole: 
       
-abbr
+abbr:not([title])
       AXRole: 
       
+abbr[title]
+      AXRole: AXUnknown
+      
 address
       AXRole: AXLandmarkContentInfo
       
@@ -46,9 +49,12 @@ cite
 code
       AXRole: 
       
-del
+del:not([datetime])
       AXRole: 
       
+del[datetime]
+      AXRole: AXUnknown
+      
 dfn
       AXRole: AXDefinition
       
@@ -196,9 +202,12 @@ input[type='url']
 input[type='week']
       AXRole: AXTextField
       
-ins
+ins:not([datetime])
       AXRole: 
       
+ins[datetime]
+      AXRole: AXUnknown
+      
 map
       AXRole: 
       
@@ -265,9 +274,12 @@ optgroup
 small
       AXRole: 
       
-span
+span:not([onclick])
       AXRole: 
       
+span[onclick]
+      AXRole: AXUnknown
+      
 strong
       AXRole: 
       
@@ -316,9 +328,12 @@ th
 textarea
       AXRole: AXTextField
       
-time
+time:not([datetime])
       AXRole: 
       
+time[datetime]
+      AXRole: AXUnknown
+      
 ul
       AXRole: AXList
       
index 59953e4..4bf3d10 100644 (file)
@@ -10,9 +10,12 @@ a[href]
 a:not([href])
       AXRole: 
       
-abbr
+abbr:not([title])
       AXRole: 
       
+abbr[title]
+      AXRole: AXUnknown
+      
 address
       AXRole: AXLandmarkContentInfo
       
@@ -46,9 +49,12 @@ cite
 code
       AXRole: 
       
-del
+del:not([datetime])
       AXRole: 
       
+del[datetime]
+      AXRole: AXUnknown
+      
 dfn
       AXRole: AXDefinition
       
@@ -196,9 +202,12 @@ input[type='url']
 input[type='week']
       AXRole: AXTextField
       
-ins
+ins:not([datetime])
       AXRole: 
       
+ins[datetime]
+      AXRole: AXUnknown
+      
 map
       AXRole: 
       
@@ -265,9 +274,12 @@ optgroup
 small
       AXRole: 
       
-span
+span:not([onclick])
       AXRole: 
       
+span[onclick]
+      AXRole: AXUnknown
+      
 strong
       AXRole: 
       
@@ -316,9 +328,12 @@ th
 textarea
       AXRole: AXTextField
       
-time
+time:not([datetime])
       AXRole: 
       
+time[datetime]
+      AXRole: AXUnknown
+      
 ul
       AXRole: AXList
       
index a54c087..f467e4a 100644 (file)
@@ -14,7 +14,12 @@ a:not([href])
       AXSubrole: 
       AXRoleDescription: 
       
-abbr
+abbr:not([title])
+      AXRole: 
+      AXSubrole: 
+      AXRoleDescription: 
+      
+abbr[title]
       AXRole: 
       AXSubrole: 
       AXRoleDescription: 
@@ -74,7 +79,12 @@ code
       AXSubrole: 
       AXRoleDescription: 
       
-del
+del:not([datetime])
+      AXRole: 
+      AXSubrole: 
+      AXRoleDescription: 
+      
+del[datetime]
       AXRole: 
       AXSubrole: 
       AXRoleDescription: 
@@ -324,7 +334,12 @@ input[type='week']
       AXSubrole: 
       AXRoleDescription: text field
       
-ins
+ins:not([datetime])
+      AXRole: 
+      AXSubrole: 
+      AXRoleDescription: 
+      
+ins[datetime]
       AXRole: 
       AXSubrole: 
       AXRoleDescription: 
@@ -439,7 +454,12 @@ small
       AXSubrole: 
       AXRoleDescription: 
       
-span
+span:not([onclick])
+      AXRole: 
+      AXSubrole: 
+      AXRoleDescription: 
+      
+span[onclick]
       AXRole: 
       AXSubrole: 
       AXRoleDescription: 
@@ -524,7 +544,12 @@ textarea
       AXSubrole: 
       AXRoleDescription: text entry area
       
-time
+time:not([datetime])
+      AXRole: 
+      AXSubrole: 
+      AXRoleDescription: 
+      
+time[datetime]
       AXRole: 
       AXSubrole: 
       AXRoleDescription: 
index 8a6341e..8fe310f 100644 (file)
@@ -14,7 +14,12 @@ a:not([href])
       AXSubrole: 
       AXRoleDescription: 
       
-abbr
+abbr:not([title])
+      AXRole: 
+      AXSubrole: 
+      AXRoleDescription: 
+      
+abbr[title]
       AXRole: 
       AXSubrole: 
       AXRoleDescription: 
@@ -74,7 +79,12 @@ code
       AXSubrole: 
       AXRoleDescription: 
       
-del
+del:not([datetime])
+      AXRole: 
+      AXSubrole: 
+      AXRoleDescription: 
+      
+del[datetime]
       AXRole: 
       AXSubrole: 
       AXRoleDescription: 
@@ -324,7 +334,12 @@ input[type='week']
       AXSubrole: 
       AXRoleDescription: text field
       
-ins
+ins:not([datetime])
+      AXRole: 
+      AXSubrole: 
+      AXRoleDescription: 
+      
+ins[datetime]
       AXRole: 
       AXSubrole: 
       AXRoleDescription: 
@@ -439,7 +454,12 @@ small
       AXSubrole: 
       AXRoleDescription: 
       
-span
+span:not([onclick])
+      AXRole: 
+      AXSubrole: 
+      AXRoleDescription: 
+      
+span[onclick]
       AXRole: 
       AXSubrole: 
       AXRoleDescription: 
@@ -524,7 +544,12 @@ textarea
       AXSubrole: 
       AXRoleDescription: text entry area
       
-time
+time:not([datetime])
+      AXRole: 
+      AXSubrole: 
+      AXRoleDescription: 
+      
+time[datetime]
       AXRole: 
       AXSubrole: 
       AXRoleDescription: 
index 7d321c5..a45ebd1 100644 (file)
@@ -14,7 +14,12 @@ a:not([href])
       AXSubrole: 
       AXRoleDescription: 
       
-abbr
+abbr:not([title])
+      AXRole: 
+      AXSubrole: 
+      AXRoleDescription: 
+      
+abbr[title]
       AXRole: 
       AXSubrole: 
       AXRoleDescription: 
@@ -74,7 +79,12 @@ code
       AXSubrole: 
       AXRoleDescription: 
       
-del
+del:not([datetime])
+      AXRole: 
+      AXSubrole: 
+      AXRoleDescription: 
+      
+del[datetime]
       AXRole: 
       AXSubrole: 
       AXRoleDescription: 
@@ -324,7 +334,12 @@ input[type='week']
       AXSubrole: 
       AXRoleDescription: text field
       
-ins
+ins:not([datetime])
+      AXRole: 
+      AXSubrole: 
+      AXRoleDescription: 
+      
+ins[datetime]
       AXRole: 
       AXSubrole: 
       AXRoleDescription: 
@@ -439,7 +454,12 @@ small
       AXSubrole: 
       AXRoleDescription: 
       
-span
+span:not([onclick])
+      AXRole: 
+      AXSubrole: 
+      AXRoleDescription: 
+      
+span[onclick]
       AXRole: 
       AXSubrole: 
       AXRoleDescription: 
@@ -524,7 +544,12 @@ textarea
       AXSubrole: 
       AXRoleDescription: text entry area
       
-time
+time:not([datetime])
+      AXRole: 
+      AXSubrole: 
+      AXRoleDescription: 
+      
+time[datetime]
       AXRole: 
       AXSubrole: 
       AXRoleDescription: 
index 49a3a84..3548016 100644 (file)
@@ -1,3 +1,30 @@
+2014-12-03  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: [ATK] Inline text elements with accessible object attributes and/or event handlers are not exposed
+        https://bugs.webkit.org/show_bug.cgi?id=139071
+
+        Reviewed by Chris Fleizach.
+
+        Adds a new InlineRole accessibility role type for non-focusable inline
+        elements which have an event handler or attribute suggesting possible
+        inclusion by the platform. This is mapped to ATK_ROLE_STATIC for GTK and
+        EFL. On the Mac, it is currently ignored to preserve existing behavior.
+
+        Added new test cases to the existing roles-exposed.html test.
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::supportsDatetimeAttribute): Added.
+        * accessibility/AccessibilityObject.h: Added InlineRole.
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::determineAccessibilityRole): Handle InlineRole.
+        * accessibility/atk/AccessibilityObjectAtk.cpp:
+        (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject): Include InlineRole objects.
+        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
+        (atkRole):
+        * accessibility/mac/AccessibilityObjectMac.mm:
+        (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject): Ignore InlineRole objects.
+        * html/HTMLTagNames.in: Added 'time'.
+
 2014-12-03  Jer Noble  <jer.noble@apple.com>
 
         [Mac] Hang when calling -[AVAsset resolvedURL].
index b81f024..9197d84 100644 (file)
@@ -1965,6 +1965,11 @@ bool AccessibilityObject::hasHighlighting() const
     return false;
 }
 
+bool AccessibilityObject::supportsDatetimeAttribute() const
+{
+    return hasTagName(insTag) || hasTagName(delTag) || hasTagName(timeTag);
+}
+
 Element* AccessibilityObject::element() const
 {
     Node* node = this->node();
index c270b96..82f5713 100644 (file)
@@ -137,6 +137,7 @@ enum AccessibilityRole {
     HelpTagRole,
     HorizontalRuleRole,
     IgnoredRole,
+    InlineRole,
     ImageRole,
     ImageMapRole,
     ImageMapLinkRole,
@@ -549,6 +550,8 @@ public:
     virtual bool hasUnderline() const { return false; }
     bool hasHighlighting() const;
 
+    bool supportsDatetimeAttribute() const;
+
     virtual bool canSetFocusAttribute() const { return false; }
     virtual bool canSetTextRangeAttributes() const { return false; }
     virtual bool canSetValueAttribute() const { return false; }
index 77e7f9d..332194b 100644 (file)
@@ -2646,6 +2646,15 @@ AccessibilityRole AccessibilityRenderObject::determineAccessibilityRole()
     if (supportsARIAAttributes() || canSetFocusAttribute())
         return GroupRole;
     
+    // InlineRole is the final fallback before assigning UnknownRole to an object. It makes it
+    // possible to distinguish truly unknown objects from non-focusable inline text elements
+    // which have an event handler or attribute suggesting possible inclusion by the platform.
+    if (is<RenderInline>(*m_renderer)
+        && (hasAttributesRequiredForInclusion()
+            || (node && node->hasEventListeners())
+            || (supportsDatetimeAttribute() && !getAttribute(datetimeAttr).isEmpty())))
+        return InlineRole;
+
     return UnknownRole;
 }
 
index d108018..7cde53d 100644 (file)
@@ -76,6 +76,9 @@ AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesO
     if (role == UnknownRole)
         return IgnoreObject;
 
+    if (role == InlineRole)
+        return IncludeObject;
+
     // Lines past this point only make sense for AccessibilityRenderObjects.
     RenderObject* renderObject = renderer();
     if (!renderObject)
index 0aa3dda..7c0a9dd 100644 (file)
@@ -665,6 +665,10 @@ static AtkRole atkRole(AccessibilityObject* coreObject)
     case DescriptionListDetailRole:
         return ATK_ROLE_DESCRIPTION_VALUE;
 #endif
+#if ATK_CHECK_VERSION(2, 15, 2)
+    case InlineRole:
+        return ATK_ROLE_STATIC;
+#endif
     default:
         return ATK_ROLE_UNKNOWN;
     }
index 5f3a244..dd7ec7b 100644 (file)
@@ -85,6 +85,9 @@ AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesO
     if (roleValue() == UnknownRole && !isAttachment())
         return IgnoreObject;
     
+    if (roleValue() == InlineRole)
+        return IgnoreObject;
+
     if (RenderObject* renderer = this->renderer()) {
         // The legend element is ignored if it lives inside of a fieldset element that uses it to generate alternative text.
         if (renderer->isLegend()) {
index fa91e00..1cfc7ee 100644 (file)
@@ -127,6 +127,7 @@ textarea interfaceName=HTMLTextAreaElement, constructorNeedsFormElement
 tfoot interfaceName=HTMLTableSectionElement
 th interfaceName=HTMLTableCellElement
 thead interfaceName=HTMLTableSectionElement
+time interfaceName=HTMLElement
 title
 tr interfaceName=HTMLTableRowElement
 track wrapperOnlyIfMediaIsAvailable, conditional=VIDEO_TRACK
index bad4067..8f899ea 100644 (file)
@@ -1,3 +1,14 @@
+2014-12-03  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: [ATK] Inline text elements with accessible object attributes and/or event handlers are not exposed
+        https://bugs.webkit.org/show_bug.cgi?id=139071
+
+        Reviewed by Chris Fleizach.
+
+        Add string value for ATK_ROLE_STATIC in roleToString.
+
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+
 2014-12-03  Renato Nagy  <rnagy@inf.u-szeged.hu>
 
         check-webkit-style is confused by ternary expression inside first member initializer
index c135e76..09a991b 100644 (file)
@@ -481,6 +481,10 @@ const gchar* roleToString(AtkObject* object)
     case ATK_ROLE_DESCRIPTION_VALUE:
         return "AXDescriptionValue";
 #endif
+#if ATK_CHECK_VERSION(2, 15, 2)
+    case ATK_ROLE_STATIC:
+        return "AXStatic";
+#endif
     default:
         // We want to distinguish ATK_ROLE_UNKNOWN from a known AtkRole which
         // our DRT isn't properly handling.