Title: [128743] releases/WebKitGTK/webkit-1.10
Revision
128743
Author
carlo...@webkit.org
Date
2012-09-17 04:09:27 -0700 (Mon, 17 Sep 2012)

Log Message

Merge r128140 - Properly expose <legend> elements to ATs
https://bugs.webkit.org/show_bug.cgi?id=84137

Patch by Joanmarie Diggs <jdi...@igalia.com> on 2012-09-10
Reviewed by Chris Fleizach.

Created a new WebCore Accessibility Role, LegendRole. Used it to map to
the expected platform role, ATK_ROLE_LABEL. Also established the needed
AtkRelation pair, label-for/labelled-by between the legend and fieldset.

Source/WebCore:

No new test needed - Existing legend.html test is now unskipped for Gtk.

* accessibility/AccessibilityObject.h: Added LegendRole
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::determineAccessibilityRole): Map legendTag to LegendRole
* accessibility/gtk/WebKitAccessibleWrapperAtk.cpp:
(webkitAccessibleGetName): Fieldset accessible should take its name from the associated LegendRole/label
(setAtkRelationSetFromCoreObject): Set label-for/labelled-by AtkRelation pair between fieldset and legend
(atkRole): Map LegendRole to ATK_ROLE_LABEL
* accessibility/mac/WebAccessibilityObjectWrapper.mm:
(createAccessibilityRoleMap):  Map LegendRole to NSAccessibilityGroupRole

Source/WebKit/chromium:

* public/WebAccessibilityRole.h: added WebAccessibilityRoleLegend
* src/AssertMatchingEnums.cpp: added the assert matching rule for
WebAccessibilityRoleLegend and LegendRole

Tools:

* DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp:
(roleToString): added "Legend" string for WebAccessibilityRoleLegend

LayoutTests:

* accessibility/legend.html: Modified the test to be more platform-agnostic.
* platform/gtk/TestExpectations: Removed legend.html from the skipped list.
* platform/gtk/accessibility/legend-expected.txt: Added.
* platform/mac/accessibility/legend-expected.txt: Updated.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-1.10/LayoutTests/ChangeLog (128742 => 128743)


--- releases/WebKitGTK/webkit-1.10/LayoutTests/ChangeLog	2012-09-17 11:08:14 UTC (rev 128742)
+++ releases/WebKitGTK/webkit-1.10/LayoutTests/ChangeLog	2012-09-17 11:09:27 UTC (rev 128743)
@@ -1,3 +1,19 @@
+2012-09-10  Joanmarie Diggs  <jdi...@igalia.com>
+
+        Properly expose <legend> elements to ATs
+        https://bugs.webkit.org/show_bug.cgi?id=84137
+
+        Reviewed by Chris Fleizach.
+
+        Created a new WebCore Accessibility Role, LegendRole. Used it to map to
+        the expected platform role, ATK_ROLE_LABEL. Also established the needed
+        AtkRelation pair, label-for/labelled-by between the legend and fieldset.
+
+        * accessibility/legend.html: Modified the test to be more platform-agnostic.
+        * platform/gtk/TestExpectations: Removed legend.html from the skipped list.
+        * platform/gtk/accessibility/legend-expected.txt: Added.
+        * platform/mac/accessibility/legend-expected.txt: Updated.
+
 2012-09-07  Dominic Mazzoni  <dmazz...@google.com>
 
         AX: WebCore accessibility roles should be cross-platform

Modified: releases/WebKitGTK/webkit-1.10/LayoutTests/accessibility/legend.html (128742 => 128743)


--- releases/WebKitGTK/webkit-1.10/LayoutTests/accessibility/legend.html	2012-09-17 11:08:14 UTC (rev 128742)
+++ releases/WebKitGTK/webkit-1.10/LayoutTests/accessibility/legend.html	2012-09-17 11:09:27 UTC (rev 128743)
@@ -1,6 +1,31 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
+<script>
+
+    function buildAccessibilityTree(accessibilityObject, indent, targetObject, targetString) {
+        var str = "";
+        for (var i = 0; i < indent; i++)
+            str += "    ";
+        str += accessibilityObject.role;
+        str += " " + accessibilityObject.stringValue;
+        if (targetObject && accessibilityObject.isEqual(targetObject))
+            str += "     " + targetString;
+        str += "\n";
+        document.getElementById("tree").innerText += str;
+
+        if (accessibilityObject.stringValue.indexOf('End of test') >= 0)
+            return false;
+
+        var count = accessibilityObject.childrenCount;
+        for (var i = 0; i < count; ++i) {
+            if (!buildAccessibilityTree(accessibilityObject.childAtIndex(i), indent + 1, targetObject, targetString))
+                return false;
+        }
+
+        return true;
+    }
+</script>
 <script src=""
 </head>
 <body id="body">
@@ -10,28 +35,37 @@
     <input id="overnight" type="radio" name="shipping" value="overnight" />Overnight
 </fieldset>
 
+<div>End of test</div>
+
 <p id="description"></p>
+<pre id="tree"></pre>
 <div id="console"></div>
 
 <script>
 
-    description("This tests that a fieldset's title ui element is the legend's static text.");
+    description("This tests that a fieldset's title ui element is the legend.");
+
     if (window.accessibilityController) {
+        document.body.focus();
+        var body = accessibilityController.focusedElement;
+        var fieldset = body.childAtIndex(0);
+        var titleUIElement = fieldset.titleUIElement();
 
-        if (window.accessibilityController) {
+        // Print out the tree of accessible objects, indicating the titleUIElement so
+        // that each platform can verify their expected object has been found
+        buildAccessibilityTree(body, 0, titleUIElement, "<< fieldset's titleUIElement");
 
-            var body = document.getElementById("body");
-            body.focus();
+        // Verify that we have gotten the titleUIElement and it has the expected text,
+        // which should be in the last descendant regardless of platform.
+        shouldBeTrue("titleUIElement != null");
+        var titleUIElementText = titleUIElement;
+        while (titleUIElementText && titleUIElementText.childrenCount)
+            titleUIElementText = titleUIElementText.childAtIndex(0); 
 
-            var fieldset = accessibilityController.focusedElement.childAtIndex(0);
-            var titleUIElement = fieldset.titleUIElement();
-            shouldBe("titleUIElement.role", "'AXRole: AXGroup'");
-            shouldBe("titleUIElement.childAtIndex(0).role", "'AXRole: AXStaticText'");
-            shouldBe("titleUIElement.childAtIndex(0).stringValue", "'AXValue: Choose a shipping method:'");
-        }
+        shouldBe("titleUIElementText.stringValue", "'AXValue: Choose a shipping method:'");
     }
 </script>
 
-<script src=""
+<script src=""
 </body>
 </html>

Modified: releases/WebKitGTK/webkit-1.10/LayoutTests/platform/gtk/TestExpectations (128742 => 128743)


--- releases/WebKitGTK/webkit-1.10/LayoutTests/platform/gtk/TestExpectations	2012-09-17 11:08:14 UTC (rev 128742)
+++ releases/WebKitGTK/webkit-1.10/LayoutTests/platform/gtk/TestExpectations	2012-09-17 11:09:27 UTC (rev 128743)
@@ -1070,9 +1070,6 @@
 BUGWK84045 SKIP : accessibility/image-map1.html = TEXT
 BUGWK84045 SKIP : accessibility/image-map2.html = TEXT
 
-// Properly expose <legend> elements to ATs
-BUGWK84137 SKIP : accessibility/legend.html = TEXT
-
 // [DRT] didDetectXSS is not implemented
 BUGWK71465 : http/tests/security/xssAuditor/script-tag-with-callbacks.html = TEXT
 

Added: releases/WebKitGTK/webkit-1.10/LayoutTests/platform/gtk/accessibility/legend-expected.txt (0 => 128743)


--- releases/WebKitGTK/webkit-1.10/LayoutTests/platform/gtk/accessibility/legend-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.10/LayoutTests/platform/gtk/accessibility/legend-expected.txt	2012-09-17 11:09:27 UTC (rev 128743)
@@ -0,0 +1,20 @@
+Choose a shipping method:
+Overnight
+End of test
+This tests that a fieldset's title ui element is the legend.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+AXRole: document frame 
+    AXRole: panel 
+        AXRole: label AXValue: Choose a shipping method:     << fieldset's titleUIElement
+        AXRole: panel AXValue: <obj>Overnight<\n>
+            AXRole: radio button AXValue: 
+    AXRole: section AXValue: End of test
+PASS titleUIElement != null is true
+PASS titleUIElementText.stringValue is 'AXValue: Choose a shipping method:'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: releases/WebKitGTK/webkit-1.10/LayoutTests/platform/mac/accessibility/legend-expected.txt (128742 => 128743)


--- releases/WebKitGTK/webkit-1.10/LayoutTests/platform/mac/accessibility/legend-expected.txt	2012-09-17 11:08:14 UTC (rev 128742)
+++ releases/WebKitGTK/webkit-1.10/LayoutTests/platform/mac/accessibility/legend-expected.txt	2012-09-17 11:09:27 UTC (rev 128743)
@@ -1,11 +1,23 @@
 Choose a shipping method:
 Overnight
-This tests that a fieldset's title ui element is the legend's static text.
+End of test
+This tests that a fieldset's title ui element is the legend.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS titleUIElement.role is 'AXRole: AXGroup'
-PASS titleUIElement.childAtIndex(0).role is 'AXRole: AXStaticText'
-PASS titleUIElement.childAtIndex(0).stringValue is 'AXValue: Choose a shipping method:'
+AXRole: AXWebArea AXValue: 
+    AXRole: AXGroup AXValue: 
+        AXRole: AXGroup AXValue:      << fieldset's titleUIElement
+            AXRole: AXStaticText AXValue: Choose a shipping method:
+        AXRole: AXGroup AXValue: 
+            AXRole: AXRadioButton AXValue: 0
+            AXRole: AXStaticText AXValue: Overnight
+    AXRole: AXGroup AXValue: 
+        AXRole: AXStaticText AXValue: End of test
+PASS titleUIElement != null is true
+PASS titleUIElementText.stringValue is 'AXValue: Choose a shipping method:'
+PASS successfullyParsed is true
 
+TEST COMPLETE
+

Modified: releases/WebKitGTK/webkit-1.10/Source/WebCore/ChangeLog (128742 => 128743)


--- releases/WebKitGTK/webkit-1.10/Source/WebCore/ChangeLog	2012-09-17 11:08:14 UTC (rev 128742)
+++ releases/WebKitGTK/webkit-1.10/Source/WebCore/ChangeLog	2012-09-17 11:09:27 UTC (rev 128743)
@@ -1,3 +1,26 @@
+2012-09-10  Joanmarie Diggs  <jdi...@igalia.com>
+
+        Properly expose <legend> elements to ATs
+        https://bugs.webkit.org/show_bug.cgi?id=84137
+
+        Reviewed by Chris Fleizach.
+
+        Created a new WebCore Accessibility Role, LegendRole. Used it to map to
+        the expected platform role, ATK_ROLE_LABEL. Also established the needed
+        AtkRelation pair, label-for/labelled-by between the legend and fieldset.
+
+        No new test needed - Existing legend.html test is now unskipped for Gtk.
+
+        * accessibility/AccessibilityObject.h: Added LegendRole
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::determineAccessibilityRole): Map legendTag to LegendRole
+        * accessibility/gtk/WebKitAccessibleWrapperAtk.cpp:
+        (webkitAccessibleGetName): Fieldset accessible should take its name from the associated LegendRole/label
+        (setAtkRelationSetFromCoreObject): Set label-for/labelled-by AtkRelation pair between fieldset and legend
+        (atkRole): Map LegendRole to ATK_ROLE_LABEL
+        * accessibility/mac/WebAccessibilityObjectWrapper.mm:
+        (createAccessibilityRoleMap):  Map LegendRole to NSAccessibilityGroupRole
+
 2012-09-07  Dominic Mazzoni  <dmazz...@google.com>
 
         AX: WebCore accessibility roles should be cross-platform

Modified: releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/AccessibilityObject.h (128742 => 128743)


--- releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/AccessibilityObject.h	2012-09-17 11:08:14 UTC (rev 128742)
+++ releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/AccessibilityObject.h	2012-09-17 11:09:27 UTC (rev 128743)
@@ -143,6 +143,7 @@
     LandmarkMainRole,
     LandmarkNavigationRole,
     LandmarkSearchRole,
+    LegendRole,
     LinkRole,
     ListRole,
     ListBoxRole,

Modified: releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (128742 => 128743)


--- releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2012-09-17 11:08:14 UTC (rev 128742)
+++ releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2012-09-17 11:09:27 UTC (rev 128743)
@@ -3192,6 +3192,8 @@
         return ListMarkerRole;
     if (node && node->hasTagName(buttonTag))
         return buttonRoleType();
+    if (node && node->hasTagName(legendTag))
+        return LegendRole;
     if (m_renderer->isText())
         return StaticTextRole;
     if (cssBox && cssBox->isImage()) {

Modified: releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp (128742 => 128743)


--- releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp	2012-09-17 11:08:14 UTC (rev 128742)
+++ releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp	2012-09-17 11:09:27 UTC (rev 128743)
@@ -99,6 +99,15 @@
     if (!coreObject->isAccessibilityRenderObject())
         return returnString(coreObject->stringValue());
 
+    if (coreObject->isFieldset()) {
+        AccessibilityObject* label = coreObject->titleUIElement();
+        if (label) {
+            AtkObject* atkObject = label->wrapper();
+            if (ATK_IS_TEXT(atkObject))
+                return atk_text_get_text(ATK_TEXT(atkObject), 0, -1);
+        }
+    }
+
     if (coreObject->isControl()) {
         AccessibilityObject* label = coreObject->correspondingLabelForControlElement();
         if (label) {
@@ -166,6 +175,23 @@
 
 static void setAtkRelationSetFromCoreObject(AccessibilityObject* coreObject, AtkRelationSet* relationSet)
 {
+    if (coreObject->isFieldset()) {
+        AccessibilityObject* label = coreObject->titleUIElement();
+        if (label)
+            atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, label->wrapper());
+        return;
+    }
+
+    if (coreObject->roleValue() == LegendRole) {
+        for (AccessibilityObject* parent = coreObject->parentObjectUnignored(); parent; parent = parent->parentObjectUnignored()) {
+            if (parent->isFieldset()) {
+                atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, parent->wrapper());
+                break;
+            }
+        }
+        return;
+    }
+
     if (coreObject->isControl()) {
         AccessibilityObject* label = coreObject->correspondingLabelForControlElement();
         if (label)
@@ -519,6 +545,7 @@
     case ParagraphRole:
         return ATK_ROLE_PARAGRAPH;
     case LabelRole:
+    case LegendRole:
         return ATK_ROLE_LABEL;
     case DivRole:
         return ATK_ROLE_SECTION;

Modified: releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm (128742 => 128743)


--- releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm	2012-09-17 11:08:14 UTC (rev 128742)
+++ releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm	2012-09-17 11:09:27 UTC (rev 128743)
@@ -1579,7 +1579,8 @@
         { SpinButtonRole, NSAccessibilityIncrementorRole },
         { FooterRole, NSAccessibilityGroupRole },
         { ToggleButtonRole, NSAccessibilityButtonRole },
-        { CanvasRole, NSAccessibilityImageRole }
+        { CanvasRole, NSAccessibilityImageRole },
+        { LegendRole, NSAccessibilityGroupRole }
     };
     AccessibilityRoleMap& roleMap = *new AccessibilityRoleMap;
     

Modified: releases/WebKitGTK/webkit-1.10/Source/WebKit/chromium/ChangeLog (128742 => 128743)


--- releases/WebKitGTK/webkit-1.10/Source/WebKit/chromium/ChangeLog	2012-09-17 11:08:14 UTC (rev 128742)
+++ releases/WebKitGTK/webkit-1.10/Source/WebKit/chromium/ChangeLog	2012-09-17 11:09:27 UTC (rev 128743)
@@ -1,3 +1,18 @@
+2012-09-10  Joanmarie Diggs  <jdi...@igalia.com>
+
+        Properly expose <legend> elements to ATs
+        https://bugs.webkit.org/show_bug.cgi?id=84137
+
+        Reviewed by Chris Fleizach.
+
+        Created a new WebCore Accessibility Role, LegendRole. Used it to map to
+        the expected platform role, ATK_ROLE_LABEL. Also established the needed
+        AtkRelation pair, label-for/labelled-by between the legend and fieldset.
+
+        * public/WebAccessibilityRole.h: added WebAccessibilityRoleLegend
+        * src/AssertMatchingEnums.cpp: added the assert matching rule for
+        WebAccessibilityRoleLegend and LegendRole
+
 2012-09-07  Dominic Mazzoni  <dmazz...@google.com>
 
         AX: WebCore accessibility roles should be cross-platform

Modified: releases/WebKitGTK/webkit-1.10/Source/WebKit/chromium/public/WebAccessibilityRole.h (128742 => 128743)


--- releases/WebKitGTK/webkit-1.10/Source/WebKit/chromium/public/WebAccessibilityRole.h	2012-09-17 11:08:14 UTC (rev 128742)
+++ releases/WebKitGTK/webkit-1.10/Source/WebKit/chromium/public/WebAccessibilityRole.h	2012-09-17 11:09:27 UTC (rev 128743)
@@ -89,6 +89,7 @@
     WebAccessibilityRoleLandmarkMain,
     WebAccessibilityRoleLandmarkNavigation,
     WebAccessibilityRoleLandmarkSearch,
+    WebAccessibilityRoleLegend,
     WebAccessibilityRoleLink,
     WebAccessibilityRoleList,
     WebAccessibilityRoleListBox,

Modified: releases/WebKitGTK/webkit-1.10/Source/WebKit/chromium/src/AssertMatchingEnums.cpp (128742 => 128743)


--- releases/WebKitGTK/webkit-1.10/Source/WebKit/chromium/src/AssertMatchingEnums.cpp	2012-09-17 11:08:14 UTC (rev 128742)
+++ releases/WebKitGTK/webkit-1.10/Source/WebKit/chromium/src/AssertMatchingEnums.cpp	2012-09-17 11:09:27 UTC (rev 128743)
@@ -259,6 +259,7 @@
 COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleUserInterfaceTooltip, UserInterfaceTooltipRole);
 COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleToggleButton, ToggleButtonRole);
 COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleCanvas, CanvasRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleLegend, LegendRole);
 
 COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::Uncached, ApplicationCacheHost::UNCACHED);
 COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::Idle, ApplicationCacheHost::IDLE);

Modified: releases/WebKitGTK/webkit-1.10/Tools/ChangeLog (128742 => 128743)


--- releases/WebKitGTK/webkit-1.10/Tools/ChangeLog	2012-09-17 11:08:14 UTC (rev 128742)
+++ releases/WebKitGTK/webkit-1.10/Tools/ChangeLog	2012-09-17 11:09:27 UTC (rev 128743)
@@ -1,3 +1,17 @@
+2012-09-10  Joanmarie Diggs  <jdi...@igalia.com>
+
+        Properly expose <legend> elements to ATs
+        https://bugs.webkit.org/show_bug.cgi?id=84137
+
+        Reviewed by Chris Fleizach.
+
+        Created a new WebCore Accessibility Role, LegendRole. Used it to map to
+        the expected platform role, ATK_ROLE_LABEL. Also established the needed
+        AtkRelation pair, label-for/labelled-by between the legend and fieldset.
+
+        * DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp:
+        (roleToString): added "Legend" string for WebAccessibilityRoleLegend
+
 2012-09-07  Dominic Mazzoni  <dmazz...@google.com>
 
         AX: WebCore accessibility roles should be cross-platform

Modified: releases/WebKitGTK/webkit-1.10/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp (128742 => 128743)


--- releases/WebKitGTK/webkit-1.10/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp	2012-09-17 11:08:14 UTC (rev 128742)
+++ releases/WebKitGTK/webkit-1.10/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp	2012-09-17 11:09:27 UTC (rev 128743)
@@ -218,6 +218,8 @@
         return result.append("Form");
     case WebAccessibilityRoleHorizontalRule:
         return result.append("HorizontalRule");
+    case WebAccessibilityRoleLegend:
+        return result.append("Legend");
     default:
         // Also matches WebAccessibilityRoleUnknown.
         return result.append("Unknown");
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to