Title: [126369] trunk
Revision
126369
Author
[email protected]
Date
2012-08-22 17:36:06 -0700 (Wed, 22 Aug 2012)

Log Message

Source/WebCore: [Gtk] Dojo toggle buttons should expose ROLE_TOGGLE_BUTTON not ROLE_PUSH_BUTTON
https://bugs.webkit.org/show_bug.cgi?id=73819

Patch by Alejandro Piñeiro <[email protected]> on 2012-08-22
Reviewed by Chris Fleizach.

Added a new role, Toggle Button, based on whether aria-pressed is present.
http://www.w3.org/TR/wai-aria/states_and_properties#aria-pressed

Test: platform/gtk/accessibility/aria-toggle-button-role.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::determineAccessibilityRole): using buttonRoleType
to classify a button-related role.
(WebCore::AccessibilityNodeObject::determineAriaRoleAttribute): using buttonRoleType
to classify a button-related role.
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::ariaPressedIsPresent): checks if aria-pressed
attribute is present.
(WebCore::AccessibilityObject::buttonRoleType): returns a specific button-related
role if the object is a button-related role.
* accessibility/AccessibilityObject.h:
(AccessibilityObject): added new role ToggleButtonRole.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::determineAccessibilityRole): using buttonRoleType
to classify a button-related role.
* accessibility/gtk/WebKitAccessibleWrapperAtk.cpp:
(atkRole): added a mapping between ToggleButtonRole and
ATK_ROLE_TOGGLE_BUTTON.
* accessibility/mac/WebAccessibilityObjectWrapper.mm:
(createAccessibilityRoleMap): added a mapping between
ToggleButtonRole and NSAccessibilityButtonRole

Source/WebKit/chromium: Dojo toggle buttons should expose ROLE_TOGGLE_BUTTON not ROLE_PUSH_BUTTON
https://bugs.webkit.org/show_bug.cgi?id=73819

Patch by Alejandro Piñeiro <[email protected]> on 2012-08-22
Reviewed by Chris Fleizach.

Added a new role, Toggle Button, based on whether aria-pressed is present.
http://www.w3.org/TR/wai-aria/states_and_properties#aria-pressed

* public/WebAccessibilityRole.h: added WebAccessibilityRoleToggleButton that
matchs with WebCore ToggleButtonRole
* src/AssertMatchingEnums.cpp: added the assert matching rule for
WebAccessibilityRoleToggleButton and ToggleButtonRole

Tools: Dojo toggle buttons should expose ROLE_TOGGLE_BUTTON not ROLE_PUSH_BUTTON
https://bugs.webkit.org/show_bug.cgi?id=73819

Patch by Alejandro Piñeiro <[email protected]> on 2012-08-22
Reviewed by Chris Fleizach.

Added a new role, Toggle Button, based on whether aria-pressed is present.
http://www.w3.org/TR/wai-aria/states_and_properties#aria-pressed

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

LayoutTests: [Gtk] Dojo toggle buttons should expose ROLE_TOGGLE_BUTTON not ROLE_PUSH_BUTTON
https://bugs.webkit.org/show_bug.cgi?id=73819

Patch by Alejandro Piñeiro <[email protected]> on 2012-08-22
Reviewed by Chris Fleizach.

Added a test to verify that when aria-pressed is present, buttons
will have the appropiate role.

* platform/gtk/accessibility/aria-toggle-button-role-expected.txt: Added.
* platform/gtk/accessibility/aria-toggle-button-role.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (126368 => 126369)


--- trunk/LayoutTests/ChangeLog	2012-08-23 00:13:53 UTC (rev 126368)
+++ trunk/LayoutTests/ChangeLog	2012-08-23 00:36:06 UTC (rev 126369)
@@ -1,3 +1,16 @@
+2012-08-22  Alejandro Piñeiro  <[email protected]>
+
+        [Gtk] Dojo toggle buttons should expose ROLE_TOGGLE_BUTTON not ROLE_PUSH_BUTTON
+        https://bugs.webkit.org/show_bug.cgi?id=73819
+
+        Reviewed by Chris Fleizach.
+
+        Added a test to verify that when aria-pressed is present, buttons
+        will have the appropiate role.
+
+        * platform/gtk/accessibility/aria-toggle-button-role-expected.txt: Added.
+        * platform/gtk/accessibility/aria-toggle-button-role.html: Added.
+
 2012-08-22  Kenneth Russell  <[email protected]>
 
         [Chromium] Need baselines for new paged-x and paged-y tests in fast/overflow after r126343

Added: trunk/LayoutTests/platform/gtk/accessibility/aria-toggle-button-role-expected.txt (0 => 126369)


--- trunk/LayoutTests/platform/gtk/accessibility/aria-toggle-button-role-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/gtk/accessibility/aria-toggle-button-role-expected.txt	2012-08-23 00:36:06 UTC (rev 126369)
@@ -0,0 +1,14 @@
+  
+This tests that the role exposed when a button has the attribute aria-pressed is toggle buttons in GTK.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS obj.childAtIndex(0).childAtIndex(0).role is 'AXRole: list item'
+PASS obj1.role is 'AXRole: toggle button'
+PASS obj2.role is 'AXRole: toggle button'
+PASS obj3.role is 'AXRole: push button'
+

Added: trunk/LayoutTests/platform/gtk/accessibility/aria-toggle-button-role.html (0 => 126369)


--- trunk/LayoutTests/platform/gtk/accessibility/aria-toggle-button-role.html	                        (rev 0)
+++ trunk/LayoutTests/platform/gtk/accessibility/aria-toggle-button-role.html	2012-08-23 00:36:06 UTC (rev 126369)
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script>
+
+function runTest()
+{
+  if (window.accessibilityController) {
+
+    document.getElementById("body").focus();
+    obj = accessibilityController.focusedElement;
+    shouldBe("obj.childAtIndex(0).childAtIndex(0).role", "'AXRole: list item'");
+
+    document.getElementById("obj1").focus();
+    obj1 = accessibilityController.focusedElement;
+    shouldBe("obj1.role", "'AXRole: toggle button'");
+
+    document.getElementById("obj2").focus();
+    obj2 = accessibilityController.focusedElement;
+    shouldBe("obj2.role", "'AXRole: toggle button'");
+
+    document.getElementById("obj3").focus();
+    obj3 = accessibilityController.focusedElement;
+    shouldBe("obj3.role", "'AXRole: push button'");
+  }
+}
+</script>
+</head>
+<body id="body" _onload_="runTest()">
+
+<div role="list">
+<div role="listitem" aria-label="item 1" aria-pressed="false"><img src='' width=100 height=100></div>
+</div>
+
+<input type="button" id="obj1" role="button" aria-pressed="true">
+<input type="button" id="obj2" role="button" aria-pressed="false">
+<input type="button" id="obj3" role="button">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("This tests that the role exposed when a button has the attribute aria-pressed is toggle buttons in GTK.");
+
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (126368 => 126369)


--- trunk/Source/WebCore/ChangeLog	2012-08-23 00:13:53 UTC (rev 126368)
+++ trunk/Source/WebCore/ChangeLog	2012-08-23 00:36:06 UTC (rev 126369)
@@ -1,3 +1,37 @@
+2012-08-22  Alejandro Piñeiro  <[email protected]>
+
+        [Gtk] Dojo toggle buttons should expose ROLE_TOGGLE_BUTTON not ROLE_PUSH_BUTTON
+        https://bugs.webkit.org/show_bug.cgi?id=73819
+
+        Reviewed by Chris Fleizach.
+
+        Added a new role, Toggle Button, based on whether aria-pressed is present.
+        http://www.w3.org/TR/wai-aria/states_and_properties#aria-pressed
+
+        Test: platform/gtk/accessibility/aria-toggle-button-role.html
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::determineAccessibilityRole): using buttonRoleType
+        to classify a button-related role.
+        (WebCore::AccessibilityNodeObject::determineAriaRoleAttribute): using buttonRoleType
+        to classify a button-related role.
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::ariaPressedIsPresent): checks if aria-pressed
+        attribute is present.
+        (WebCore::AccessibilityObject::buttonRoleType): returns a specific button-related
+        role if the object is a button-related role.
+        * accessibility/AccessibilityObject.h:
+        (AccessibilityObject): added new role ToggleButtonRole.
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::determineAccessibilityRole): using buttonRoleType
+        to classify a button-related role.
+        * accessibility/gtk/WebKitAccessibleWrapperAtk.cpp:
+        (atkRole): added a mapping between ToggleButtonRole and
+        ATK_ROLE_TOGGLE_BUTTON.
+        * accessibility/mac/WebAccessibilityObjectWrapper.mm:
+        (createAccessibilityRoleMap): added a mapping between
+        ToggleButtonRole and NSAccessibilityButtonRole
+
 2012-08-22  David Grogan  <[email protected]>
 
         IndexedDB: revert int version when version change transaction aborts

Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (126368 => 126369)


--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2012-08-23 00:13:53 UTC (rev 126368)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2012-08-23 00:36:06 UTC (rev 126369)
@@ -250,7 +250,7 @@
     if (node()->isTextNode())
         return StaticTextRole;
     if (node()->hasTagName(buttonTag))
-        return ariaHasPopup() ? PopUpButtonRole : ButtonRole;
+        return buttonRoleType();
     if (node()->hasTagName(inputTag)) {
         HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
         if (input->isCheckbox())
@@ -258,7 +258,7 @@
         if (input->isRadioButton())
             return RadioButtonRole;
         if (input->isTextButton())
-            return ariaHasPopup() ? PopUpButtonRole : ButtonRole;
+            return buttonRoleType();
         return TextFieldRole;
     }
     if (node()->hasTagName(selectTag)) {
@@ -336,10 +336,10 @@
     // ARIA states if an item can get focus, it should not be presentational.
     if (role == PresentationalRole && canSetFocusAttribute())
         return UnknownRole;
-    
-    if (role == ButtonRole && ariaHasPopup())
-        role = PopUpButtonRole;
 
+    if (role == ButtonRole)
+        role = buttonRoleType();
+
     if (role == TextAreaRole && !ariaIsMultiline())
         role = TextFieldRole;
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (126368 => 126369)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2012-08-23 00:13:53 UTC (rev 126368)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2012-08-23 00:36:06 UTC (rev 126369)
@@ -1734,5 +1734,24 @@
         }
     }
 }
-    
+
+bool AccessibilityObject::ariaPressedIsPresent() const
+{
+    return !getAttribute(aria_pressedAttr).isEmpty();
+}
+
+AccessibilityRole AccessibilityObject::buttonRoleType() const
+{
+    // If aria-pressed is present, then it should be exposed as a toggle button.
+    // http://www.w3.org/TR/wai-aria/states_and_properties#aria-pressed
+    if (ariaPressedIsPresent())
+        return ToggleButtonRole;
+    if (ariaHasPopup())
+        return PopUpButtonRole;
+    // We don't contemplate RadioButtonRole, as it depends on the input
+    // type.
+
+    return ButtonRole;
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (126368 => 126369)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2012-08-23 00:13:53 UTC (rev 126368)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2012-08-23 00:36:06 UTC (rev 126369)
@@ -187,6 +187,7 @@
     TreeGridRole,
     TreeItemRole,
     TextFieldRole,
+    ToggleButtonRole,
     ToolbarRole,
     UnknownRole,
     UserInterfaceTooltipRole,
@@ -451,6 +452,7 @@
     virtual bool supportsARIAFlowTo() const { return false; }
     virtual void ariaFlowToElements(AccessibilityChildrenVector&) const { }
     virtual bool ariaHasPopup() const { return false; }
+    virtual bool ariaPressedIsPresent() const;
     bool ariaIsMultiline() const;
     virtual const AtomicString& invalidStatus() const;
     bool supportsARIAExpanded() const;
@@ -715,6 +717,7 @@
     static bool isAccessibilityObjectSearchMatch(AccessibilityObject*, AccessibilitySearchCriteria*);
     static bool isAccessibilityTextSearchMatch(AccessibilityObject*, AccessibilitySearchCriteria*);
     static bool objectMatchesSearchCriteriaWithResultLimit(AccessibilityObject*, AccessibilitySearchCriteria*, AccessibilityChildrenVector&);
+    virtual AccessibilityRole buttonRoleType() const;
     
 #if PLATFORM(GTK)
     bool allowsTextRanges() const;

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (126368 => 126369)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2012-08-23 00:13:53 UTC (rev 126368)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2012-08-23 00:36:06 UTC (rev 126369)
@@ -1688,7 +1688,7 @@
 {
     return elementAttributeValue(aria_haspopupAttr);
 }
-    
+
 bool AccessibilityRenderObject::supportsARIAFlowTo() const
 {
     return !getAttribute(aria_flowtoAttr).isEmpty();
@@ -3143,7 +3143,7 @@
     if (m_renderer->isListMarker())
         return ListMarkerRole;
     if (node && node->hasTagName(buttonTag))
-        return ariaHasPopup() ? PopUpButtonRole : ButtonRole;
+        return buttonRoleType();
     if (m_renderer->isText())
         return StaticTextRole;
     if (cssBox && cssBox->isImage()) {
@@ -3170,7 +3170,7 @@
         if (input->isRadioButton())
             return RadioButtonRole;
         if (input->isTextButton())
-            return ariaHasPopup() ? PopUpButtonRole : ButtonRole;
+            return buttonRoleType();
     }
 
     if (isFileUploadButton())

Modified: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp (126368 => 126369)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp	2012-08-23 00:13:53 UTC (rev 126368)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp	2012-08-23 00:36:06 UTC (rev 126369)
@@ -430,6 +430,8 @@
         return ATK_ROLE_UNKNOWN;
     case ButtonRole:
         return ATK_ROLE_PUSH_BUTTON;
+    case ToggleButtonRole:
+        return ATK_ROLE_TOGGLE_BUTTON;
     case RadioButtonRole:
         return ATK_ROLE_RADIO_BUTTON;
     case CheckBoxRole:

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm (126368 => 126369)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm	2012-08-23 00:13:53 UTC (rev 126368)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm	2012-08-23 00:36:06 UTC (rev 126369)
@@ -1577,7 +1577,8 @@
         { DivRole, NSAccessibilityGroupRole },
         { FormRole, NSAccessibilityGroupRole },
         { SpinButtonRole, NSAccessibilityIncrementorRole },
-        { FooterRole, NSAccessibilityGroupRole }
+        { FooterRole, NSAccessibilityGroupRole },
+        { ToggleButtonRole, NSAccessibilityButtonRole }
     };
     AccessibilityRoleMap& roleMap = *new AccessibilityRoleMap;
     

Modified: trunk/Source/WebKit/chromium/ChangeLog (126368 => 126369)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-08-23 00:13:53 UTC (rev 126368)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-08-23 00:36:06 UTC (rev 126369)
@@ -1,3 +1,18 @@
+2012-08-22  Alejandro Piñeiro  <[email protected]>
+
+        Dojo toggle buttons should expose ROLE_TOGGLE_BUTTON not ROLE_PUSH_BUTTON
+        https://bugs.webkit.org/show_bug.cgi?id=73819
+
+        Reviewed by Chris Fleizach.
+
+        Added a new role, Toggle Button, based on whether aria-pressed is present.
+        http://www.w3.org/TR/wai-aria/states_and_properties#aria-pressed
+
+        * public/WebAccessibilityRole.h: added WebAccessibilityRoleToggleButton that
+        matchs with WebCore ToggleButtonRole
+        * src/AssertMatchingEnums.cpp: added the assert matching rule for
+        WebAccessibilityRoleToggleButton and ToggleButtonRole
+
 2012-08-17  Jeffrey Pfau  <[email protected]>
 
         Allow blocking of Web SQL databases in third-party web workers

Modified: trunk/Source/WebKit/chromium/public/WebAccessibilityRole.h (126368 => 126369)


--- trunk/Source/WebKit/chromium/public/WebAccessibilityRole.h	2012-08-23 00:13:53 UTC (rev 126368)
+++ trunk/Source/WebKit/chromium/public/WebAccessibilityRole.h	2012-08-23 00:36:06 UTC (rev 126369)
@@ -133,6 +133,7 @@
     WebAccessibilityRoleTreeGrid,
     WebAccessibilityRoleTreeItemRole,
     WebAccessibilityRoleTextField,
+    WebAccessibilityRoleToggleButton,
     WebAccessibilityRoleToolbar,
     WebAccessibilityRoleUnknown,
     WebAccessibilityRoleUserInterfaceTooltip,

Modified: trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp (126368 => 126369)


--- trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp	2012-08-23 00:13:53 UTC (rev 126368)
+++ trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp	2012-08-23 00:36:06 UTC (rev 126369)
@@ -257,6 +257,7 @@
 COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDocumentNote, DocumentNoteRole);
 COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDocumentRegion, DocumentRegionRole);
 COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleUserInterfaceTooltip, UserInterfaceTooltipRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleToggleButton, ToggleButtonRole);
 
 COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::Uncached, ApplicationCacheHost::UNCACHED);
 COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::Idle, ApplicationCacheHost::IDLE);

Modified: trunk/Tools/ChangeLog (126368 => 126369)


--- trunk/Tools/ChangeLog	2012-08-23 00:13:53 UTC (rev 126368)
+++ trunk/Tools/ChangeLog	2012-08-23 00:36:06 UTC (rev 126369)
@@ -1,3 +1,16 @@
+2012-08-22  Alejandro Piñeiro  <[email protected]>
+
+        Dojo toggle buttons should expose ROLE_TOGGLE_BUTTON not ROLE_PUSH_BUTTON
+        https://bugs.webkit.org/show_bug.cgi?id=73819
+
+        Reviewed by Chris Fleizach.
+
+        Added a new role, Toggle Button, based on whether aria-pressed is present.
+        http://www.w3.org/TR/wai-aria/states_and_properties#aria-pressed
+
+        * DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp:
+        (roleToString): added "ToggleButton" string for WebAccessibilityRoleToggleButton
+
 2012-08-23  Victor Carbune  <[email protected]>
 
         Add myself to the committer list

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp (126368 => 126369)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp	2012-08-23 00:13:53 UTC (rev 126368)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp	2012-08-23 00:36:06 UTC (rev 126369)
@@ -204,6 +204,8 @@
         return result.append("DocumentRegion");
     case WebAccessibilityRoleUserInterfaceTooltip:
         return result.append("UserInterfaceTooltip");
+    case WebAccessibilityRoleToggleButton:
+        return result.append("ToggleButton");
     default:
         // Also matches WebAccessibilityRoleUnknown.
         return result.append("Unknown");
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to