Title: [185536] trunk
Revision
185536
Author
[email protected]
Date
2015-06-13 01:29:23 -0700 (Sat, 13 Jun 2015)

Log Message

AX: WebKit exposes all Ruby Text as Unknown (Japanese EPUB accessibility blocker)
https://bugs.webkit.org/show_bug.cgi?id=141303

Patch by Andres Gonzalez <[email protected]> on 2015-06-13
Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/ruby-hierarchy-roles.html

* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(createAccessibilityRoleMap):
(-[WebAccessibilityObjectWrapper subrole]):

LayoutTests:

* accessibility/ruby-hierarchy-roles-expected.txt: Added.
* accessibility/ruby-hierarchy-roles.html: Added.
* platform/mac-mavericks/accessibility/ruby-hierarchy-roles-expected.txt: Added.
* platform/mac/accessibility/ruby-hierarchy-roles-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (185535 => 185536)


--- trunk/LayoutTests/ChangeLog	2015-06-13 08:16:24 UTC (rev 185535)
+++ trunk/LayoutTests/ChangeLog	2015-06-13 08:29:23 UTC (rev 185536)
@@ -1,3 +1,15 @@
+2015-06-13  Andres Gonzalez  <[email protected]>
+
+        AX: WebKit exposes all Ruby Text as Unknown (Japanese EPUB accessibility blocker)
+        https://bugs.webkit.org/show_bug.cgi?id=141303
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/ruby-hierarchy-roles-expected.txt: Added.
+        * accessibility/ruby-hierarchy-roles.html: Added.
+        * platform/mac-mavericks/accessibility/ruby-hierarchy-roles-expected.txt: Added.
+        * platform/mac/accessibility/ruby-hierarchy-roles-expected.txt: Added.
+
 2015-06-12  Chris Fleizach  <[email protected]>
 
         AX:ARIA Toggle buttons aren't properly conveyed on iOS using VoiceOver

Added: trunk/LayoutTests/accessibility/ruby-hierarchy-roles-expected.txt (0 => 185536)


--- trunk/LayoutTests/accessibility/ruby-hierarchy-roles-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ruby-hierarchy-roles-expected.txt	2015-06-13 08:29:23 UTC (rev 185536)
@@ -0,0 +1,9 @@
+This tests that the ruby containers are exposed with the appropriate hierarchy and roles.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+basetext rubytext

Added: trunk/LayoutTests/accessibility/ruby-hierarchy-roles.html (0 => 185536)


--- trunk/LayoutTests/accessibility/ruby-hierarchy-roles.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ruby-hierarchy-roles.html	2015-06-13 08:29:23 UTC (rev 185536)
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+    <head>
+        <script src=""
+    </head>
+    <body>
+        <ruby id="rubyElemId">
+            <rb>basetext</rb>
+            <rp>(</rp>
+            <rt>rubytext</rt>
+            <rp>)</rp>
+        </ruby>
+        
+        <script>
+            if (window.accessibilityController) {
+                description("This tests that the ruby containers are exposed with the appropriate hierarchy and roles.")
+                // At the moment, this is implemented only for OSX.
+                var platform = accessibilityController.platformName;
+                if ("mac" == platform) {
+                    // Expected values for roles and subroles.
+                    var expectedRubyRole = "AXRole: AXGroup"; // all ruby containers have AXGroup role
+                    var expectedRubyInlineSubrole = "AXSubrole: AXRubyInline";
+                    var expectedRubyBlockSubrole = "AXSubrole: AXRubyBlock";
+                    var expectedRubyRunSubrole = "AXSubrole: AXRubyRun";
+                    var expectedRubyTextSubrole = "AXSubrole: AXRubyText";
+                    var expectedRubyBaseSubrole = "AXSubrole: AXRubyBase";
+                    
+                    // Try inline style first, block style second
+                    var rubyElem = document.getElementById("rubyElemId");
+                    shouldBeTrue("rubyElem != null");
+                    rubyElem.style.display = "inline";
+                    checkHierarchyAndRoles(rubyElem);
+                    
+                    rubyElem.style.display = "block";
+                    checkHierarchyAndRoles(rubyElem);
+                    
+                    function checkHierarchyAndRoles(rubyElem) {
+                        axRuby = window.accessibilityController.accessibleElementById("rubyElemId");
+                        shouldBeTrue("axRuby != null");
+                        role = axRuby.role;
+                        subrole = axRuby.subrole;
+                        shouldBe("role", "expectedRubyRole");
+                        if (rubyElem.style.display == "inline") {
+                            shouldBe("subrole", "expectedRubyInlineSubrole");
+                        }
+                        else {
+                            shouldBe("subrole", "expectedRubyBlockSubrole");
+                        }
+                        
+                        // RubyRun
+                        axRubyRun = axRuby.childAtIndex(0);
+                        shouldBeTrue("axRubyRun != null");
+                        role = axRubyRun.role;
+                        subrole = axRubyRun.subrole;
+                        shouldBe("role", "expectedRubyRole");
+                        shouldBe("subrole", "expectedRubyRunSubrole");
+                        
+                        // RubyText
+                        axRubyText = axRubyRun.childAtIndex(0);
+                        shouldBeTrue("axRubyText != null");
+                        role = axRubyText.role;
+                        subrole = axRubyText.subrole;
+                        shouldBe("role", "expectedRubyRole");
+                        shouldBe("subrole", "expectedRubyTextSubrole");
+                        
+                        // RubyBase
+                        axRubyBase = axRubyRun.childAtIndex(1);
+                        shouldBeTrue("axRubyBase != null");
+                        role = axRubyBase.role;
+                        subrole = axRubyBase.subrole;
+                        shouldBe("role", "expectedRubyRole");
+                        shouldBe("subrole", "expectedRubyBaseSubrole");
+                    }
+                }
+            }
+        </script>
+        <script src=""
+    </body>
+</html>

Added: trunk/LayoutTests/platform/mac/accessibility/ruby-hierarchy-roles-expected.txt (0 => 185536)


--- trunk/LayoutTests/platform/mac/accessibility/ruby-hierarchy-roles-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/ruby-hierarchy-roles-expected.txt	2015-06-13 08:29:23 UTC (rev 185536)
@@ -0,0 +1,34 @@
+This tests that the ruby containers are exposed with the appropriate hierarchy and roles.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rubyElem != null is true
+PASS axRuby != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyInlineSubrole
+PASS axRubyRun != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyRunSubrole
+PASS axRubyText != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyTextSubrole
+PASS axRubyBase != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyBaseSubrole
+PASS axRuby != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyBlockSubrole
+PASS axRubyRun != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyRunSubrole
+PASS axRubyText != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyTextSubrole
+PASS axRubyBase != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyBaseSubrole
+PASS successfullyParsed is true
+
+TEST COMPLETE
+basetext rubytext

Added: trunk/LayoutTests/platform/mac-mavericks/accessibility/ruby-hierarchy-roles-expected.txt (0 => 185536)


--- trunk/LayoutTests/platform/mac-mavericks/accessibility/ruby-hierarchy-roles-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-mavericks/accessibility/ruby-hierarchy-roles-expected.txt	2015-06-13 08:29:23 UTC (rev 185536)
@@ -0,0 +1,34 @@
+This tests that the ruby containers are exposed with the appropriate hierarchy and roles.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rubyElem != null is true
+PASS axRuby != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyInlineSubrole
+PASS axRubyRun != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyRunSubrole
+PASS axRubyText != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyTextSubrole
+PASS axRubyBase != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyBaseSubrole
+PASS axRuby != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyBlockSubrole
+PASS axRubyRun != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyRunSubrole
+PASS axRubyText != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyTextSubrole
+PASS axRubyBase != null is true
+PASS role is expectedRubyRole
+PASS subrole is expectedRubyBaseSubrole
+PASS successfullyParsed is true
+
+TEST COMPLETE
+basetext rubytext

Modified: trunk/Source/WebCore/ChangeLog (185535 => 185536)


--- trunk/Source/WebCore/ChangeLog	2015-06-13 08:16:24 UTC (rev 185535)
+++ trunk/Source/WebCore/ChangeLog	2015-06-13 08:29:23 UTC (rev 185536)
@@ -1,3 +1,20 @@
+2015-06-13  Andres Gonzalez  <[email protected]>
+
+        AX: WebKit exposes all Ruby Text as Unknown (Japanese EPUB accessibility blocker)
+        https://bugs.webkit.org/show_bug.cgi?id=141303
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/ruby-hierarchy-roles.html
+
+        * accessibility/AccessibilityObject.h:
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
+        (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (createAccessibilityRoleMap):
+        (-[WebAccessibilityObjectWrapper subrole]):
+
 2015-06-12  Chris Fleizach  <[email protected]>
 
         AX: iOS: after updating control, VoiceOver speaks aria-expanded states reversed (says "collapsed" when "expanded")

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (185535 => 185536)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2015-06-13 08:16:24 UTC (rev 185535)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2015-06-13 08:29:23 UTC (rev 185536)
@@ -177,6 +177,11 @@
     RadioGroupRole,
     RowHeaderRole,
     RowRole,
+    RubyBaseRole,
+    RubyBlockRole,
+    RubyInlineRole,
+    RubyRunRole,
+    RubyTextRole,
     RulerRole,
     RulerMarkerRole,
     ScrollAreaRole,

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (185535 => 185536)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2015-06-13 08:16:24 UTC (rev 185535)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2015-06-13 08:29:23 UTC (rev 185536)
@@ -1382,7 +1382,11 @@
     if (node && node->hasTagName(dfnTag))
         return false;
     
-    // By default, objects should be ignored so that the AX hierarchy is not 
+    // Make sure that ruby containers are not ignored.
+    if (m_renderer->isRubyRun() || m_renderer->isRubyBlock() || m_renderer->isRubyInline())
+        return false;
+
+    // By default, objects should be ignored so that the AX hierarchy is not
     // filled with unnecessary items.
     return true;
 }
@@ -2575,9 +2579,18 @@
     if (node && node->hasTagName(dlTag))
         return DescriptionListRole;
 
-    if (node && (node->hasTagName(rpTag) || node->hasTagName(rtTag)))
-        return AnnotationRole;
-
+    // Check for Ruby elements
+    if (m_renderer->isRubyText())
+        return RubyTextRole;
+    if (m_renderer->isRubyBase())
+        return RubyBaseRole;
+    if (m_renderer->isRubyRun())
+        return RubyRunRole;
+    if (m_renderer->isRubyBlock())
+        return RubyBlockRole;
+    if (m_renderer->isRubyInline())
+        return RubyInlineRole;
+    
     // This return value is what will be used if AccessibilityTableCell determines
     // the cell should not be treated as a cell (e.g. because it is a layout table.
     // In ATK, there is a distinction between generic text block elements and other

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (185535 => 185536)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2015-06-13 08:16:24 UTC (rev 185535)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2015-06-13 08:29:23 UTC (rev 185536)
@@ -120,6 +120,26 @@
 #define NSAccessibilityContentSeparatorSubrole @"AXContentSeparator"
 #endif
 
+#ifndef NSAccessibilityRubyBaseSubRole
+#define NSAccessibilityRubyBaseSubrole @"AXRubyBase"
+#endif
+
+#ifndef NSAccessibilityRubyBlockSubrole
+#define NSAccessibilityRubyBlockSubrole @"AXRubyBlock"
+#endif
+
+#ifndef NSAccessibilityRubyInlineSubrole
+#define NSAccessibilityRubyInlineSubrole @"AXRubyInline"
+#endif
+
+#ifndef NSAccessibilityRubyRunSubrole
+#define NSAccessibilityRubyRunSubrole @"AXRubyRun"
+#endif
+
+#ifndef NSAccessibilityRubyTextSubrole
+#define NSAccessibilityRubyTextSubrole @"AXRubyText"
+#endif
+
 // Miscellaneous
 #ifndef NSAccessibilityBlockQuoteLevelAttribute
 #define NSAccessibilityBlockQuoteLevelAttribute @"AXBlockQuoteLevel"
@@ -1960,6 +1980,11 @@
         { SwitchRole, NSAccessibilityCheckBoxRole },
         { SearchFieldRole, NSAccessibilityTextFieldRole },
         { PreRole, NSAccessibilityGroupRole },
+        { RubyBaseRole, NSAccessibilityGroupRole },
+        { RubyBlockRole, NSAccessibilityGroupRole },
+        { RubyInlineRole, NSAccessibilityGroupRole },
+        { RubyRunRole, NSAccessibilityGroupRole },
+        { RubyTextRole, NSAccessibilityGroupRole },
     };
     AccessibilityRoleMap& roleMap = *new AccessibilityRoleMap;
     
@@ -2142,6 +2167,22 @@
 
     if (m_object->isSwitch())
         return NSAccessibilitySwitchSubrole;
+
+    // Ruby subroles
+    switch (role) {
+    case RubyBaseRole:
+        return NSAccessibilityRubyBaseSubrole;
+    case RubyBlockRole:
+        return NSAccessibilityRubyBlockSubrole;
+    case RubyInlineRole:
+        return NSAccessibilityRubyInlineSubrole;
+    case RubyRunRole:
+        return NSAccessibilityRubyRunSubrole;
+    case RubyTextRole:
+        return NSAccessibilityRubyTextSubrole;
+    default:
+        break;
+    }
     
     return nil;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to