REGRESSION: AX: buttons now extremely repetitive
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2009 20:04:32 +0000 (20:04 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2009 20:04:32 +0000 (20:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=32164

Reviewed by Darin Adler.

WebCore:

Test: platform/mac/accessibility/button-shouldnot-have-axvalue.html

* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isButton):
* accessibility/mac/AccessibilityObjectWrapper.mm:
(-[AccessibilityObjectWrapper accessibilityAttributeNames]):

WebKitTools:

* DumpRenderTree/AccessibilityUIElement.cpp:
(isAttributeSupportedCallback):
(AccessibilityUIElement::getJSClass):
* DumpRenderTree/AccessibilityUIElement.h:
* DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
(AccessibilityUIElement::isAttributeSupported):
* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(AccessibilityUIElement::isAttributeSupported):
* DumpRenderTree/win/AccessibilityUIElementWin.cpp:
(AccessibilityUIElement::isAttributeSupported):

LayoutTests:

* platform/mac-leopard/accessibility/table-with-aria-role-expected.txt:
* platform/mac/accessibility/button-shouldnot-have-axvalue-expected.txt: Added.
* platform/mac/accessibility/button-shouldnot-have-axvalue.html: Added.
* platform/mac/accessibility/table-with-aria-role-expected.txt:

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

14 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-leopard/accessibility/table-with-aria-role-expected.txt
LayoutTests/platform/mac/accessibility/button-shouldnot-have-axvalue-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/button-shouldnot-have-axvalue.html [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/table-with-aria-role-expected.txt
WebCore/ChangeLog
WebCore/accessibility/AccessibilityObject.h
WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
WebKitTools/DumpRenderTree/AccessibilityUIElement.h
WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp

index b985c7a10c78b99fa22791d40e90b1b350d16473..c1e2c82bd1cdbec5af847767b3916c5204d7d602 100644 (file)
@@ -1,3 +1,15 @@
+2009-12-04  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION: AX: buttons now extremely repetitive
+        https://bugs.webkit.org/show_bug.cgi?id=32164
+
+        * platform/mac-leopard/accessibility/table-with-aria-role-expected.txt:
+        * platform/mac/accessibility/button-shouldnot-have-axvalue-expected.txt: Added.
+        * platform/mac/accessibility/button-shouldnot-have-axvalue.html: Added.
+        * platform/mac/accessibility/table-with-aria-role-expected.txt:
+
 2009-12-04  Enrica Casucci  <enrica@apple.com>
 
         Reviewed by John Sullivan.
index 1d8ed0693201b62fe20fafdf88de69c38354ddbc..e66bdb93d05ae8bb080e12cf5595a0ff8b2bd54a 100644 (file)
@@ -15,7 +15,6 @@ AXTitle: test test    test
 test   test    test
 
 AXDescription: 
-AXValue: 
 AXFocused: 0
 AXEnabled: 1
 AXWindow: <AXButton: 'test     test    test
@@ -37,7 +36,6 @@ test  test    test
 '>
 AXTitleUIElement: (null)
 AXAccessKey: (null)
-AXRequired: 0
 
 ------------
 AXRole: AXMenu
diff --git a/LayoutTests/platform/mac/accessibility/button-shouldnot-have-axvalue-expected.txt b/LayoutTests/platform/mac/accessibility/button-shouldnot-have-axvalue-expected.txt
new file mode 100644 (file)
index 0000000..4787fb1
--- /dev/null
@@ -0,0 +1,12 @@
+
+This tests that a button should not have AXRequired and should not have AXValue returned.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS button.isAttributeSupported('AXValue') is false
+PASS button.isAttributeSupported('AXRequired') is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/button-shouldnot-have-axvalue.html b/LayoutTests/platform/mac/accessibility/button-shouldnot-have-axvalue.html
new file mode 100644 (file)
index 0000000..a2b3fb9
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script>
+var successfullyParsed = false;
+</script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<input tabindex=0 id="button" type="button" value="test">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that a button should not have AXRequired and should not have AXValue returned.");
+
+    if (window.accessibilityController) {
+
+          document.getElementById("button").focus();
+          var button = accessibilityController.focusedElement;
+
+          shouldBe("button.isAttributeSupported('AXValue')", "false");
+          shouldBe("button.isAttributeSupported('AXRequired')", "false");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
index 1d8ed0693201b62fe20fafdf88de69c38354ddbc..e66bdb93d05ae8bb080e12cf5595a0ff8b2bd54a 100644 (file)
@@ -15,7 +15,6 @@ AXTitle: test test    test
 test   test    test
 
 AXDescription: 
-AXValue: 
 AXFocused: 0
 AXEnabled: 1
 AXWindow: <AXButton: 'test     test    test
@@ -37,7 +36,6 @@ test  test    test
 '>
 AXTitleUIElement: (null)
 AXAccessKey: (null)
-AXRequired: 0
 
 ------------
 AXRole: AXMenu
index 450a63811c1e2ca144a92a41a845c4ae740f15d4..a65c96961fff98e6852db4b738e5221f07937014 100644 (file)
@@ -1,3 +1,17 @@
+2009-12-04  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION: AX: buttons now extremely repetitive
+        https://bugs.webkit.org/show_bug.cgi?id=32164
+
+        Test: platform/mac/accessibility/button-shouldnot-have-axvalue.html
+
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::isButton):
+        * accessibility/mac/AccessibilityObjectWrapper.mm:
+        (-[AccessibilityObjectWrapper accessibilityAttributeNames]):
+
 2009-12-04  Zoltan Herczeg  <zherczeg@inf.u-szeged.hu>
 
         Reviewed by Darin Adler.
index e02982c29a4884f9c83c859dfa4f3dec1604f769..8e463119a5c7b70f07389857fee1504d5cb20392 100644 (file)
@@ -286,6 +286,7 @@ public:
     bool isTree() const { return roleValue() == TreeRole; }
     bool isTreeItem() const { return roleValue() == TreeItemRole; }
     bool isScrollbar() const { return roleValue() == ScrollBarRole; }
+    bool isButton() const { return roleValue() == ButtonRole; }
     
     virtual bool isChecked() const { return false; }
     virtual bool isEnabled() const { return false; }
index 7ae470abb1711cbf0aa4c2cce86756a8536c7c87..6099b3d17191881cf84a5d2a0bd9dd6ea6dc4947 100644 (file)
@@ -637,6 +637,7 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePositi
     static NSArray* comboBoxAttrs = nil;
     static NSArray* outlineAttrs = nil;
     static NSArray* outlineRowAttrs = nil;
+    static NSArray* buttonAttrs = nil;
     NSMutableArray* tempArray;
     if (attributes == nil) {
         attributes = [[NSArray alloc] initWithObjects: NSAccessibilityRoleAttribute,
@@ -776,6 +777,15 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePositi
         controlAttrs = [[NSArray alloc] initWithArray:tempArray];
         [tempArray release];
     }
+    if (buttonAttrs == nil) {
+        tempArray = [[NSMutableArray alloc] initWithArray:attributes];
+        // Buttons should not expose AXValue.
+        [tempArray removeObject:NSAccessibilityValueAttribute];
+        [tempArray addObject:NSAccessibilityTitleUIElementAttribute];
+        [tempArray addObject:NSAccessibilityAccessKeyAttribute];
+        buttonAttrs = [[NSArray alloc] initWithArray:tempArray];
+        [tempArray release];
+    }
     if (comboBoxAttrs == nil) {
         tempArray = [[NSMutableArray alloc] initWithArray:controlAttrs];
         [tempArray addObject:NSAccessibilityExpandedAttribute];
@@ -824,9 +834,8 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePositi
         [tempArray release];
     }
     if (inputImageAttrs == nil) {
-        tempArray = [[NSMutableArray alloc] initWithArray:controlAttrs];
+        tempArray = [[NSMutableArray alloc] initWithArray:buttonAttrs];
         [tempArray addObject:NSAccessibilityURLAttribute];
-        [tempArray addObject:NSAccessibilityAccessKeyAttribute];
         inputImageAttrs = [[NSArray alloc] initWithArray:tempArray];
         [tempArray release];
     }
@@ -900,9 +909,11 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePositi
     else if (m_object->isProgressIndicator() || m_object->isSlider())
         objectAttributes = rangeAttrs;
 
+    // These are processed in order because an input image is a button, and a button is a control.
     else if (m_object->isInputImage())
         objectAttributes = inputImageAttrs;
-    
+    else if (m_object->isButton())
+        objectAttributes = buttonAttrs;
     else if (m_object->isControl())
         objectAttributes = controlAttrs;
     
@@ -921,10 +932,8 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePositi
         objectAttributes = menuItemAttrs;
 
     NSArray *additionalAttributes = [self additionalAccessibilityAttributeNames];
-    if ( [additionalAttributes count] > 0 )
-    {
+    if ([additionalAttributes count])
         objectAttributes = [objectAttributes arrayByAddingObjectsFromArray:additionalAttributes];
-    }
     
     return objectAttributes;
 }
index 85dc830188b9e562f5892e4a746a6723ff4ce972..5b633aa25e46f107338b27fd79026f44751318f9 100644 (file)
@@ -1,3 +1,21 @@
+2009-12-04  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION: AX: buttons now extremely repetitive
+        https://bugs.webkit.org/show_bug.cgi?id=32164
+
+        * DumpRenderTree/AccessibilityUIElement.cpp:
+        (isAttributeSupportedCallback):
+        (AccessibilityUIElement::getJSClass):
+        * DumpRenderTree/AccessibilityUIElement.h:
+        * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
+        (AccessibilityUIElement::isAttributeSupported):
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (AccessibilityUIElement::isAttributeSupported):
+        * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
+        (AccessibilityUIElement::isAttributeSupported):
+
 2009-12-03  Shinichiro Hamaji  <hamaji@chromium.org>
 
         Reviewed by David Levin.
index 9268b466910739cd793cd6b9821db07cd4668c7d..8c592523158e4ec0ce99327d1ee9031b2136f967 100644 (file)
@@ -220,9 +220,20 @@ static JSValueRef elementAtPointCallback(JSContextRef context, JSObjectRef funct
     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->elementAtPoint(x, y));
 }
 
+static JSValueRef isAttributeSupportedCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    JSStringRef attribute = 0;
+    if (argumentCount == 1)
+        attribute = JSValueToStringCopy(context, arguments[0], exception);    
+    JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isAttributeSupported(attribute));
+    if (attribute)
+        JSStringRelease(attribute);
+    return result;
+}
+
 static JSValueRef isAttributeSettableCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
-    JSStringRef attribute = NULL;
+    JSStringRef attribute = 0;
     if (argumentCount == 1)
         attribute = JSValueToStringCopy(context, arguments[0], exception);    
     JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isAttributeSettable(attribute));
@@ -245,7 +256,7 @@ static JSValueRef isActionSupportedCallback(JSContextRef context, JSObjectRef fu
 
 static JSValueRef attributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
-    JSStringRef attribute = NULL;
+    JSStringRef attribute = 0;
     if (argumentCount == 1)
         attribute = JSValueToStringCopy(context, arguments[0], exception);
     JSRetainPtr<JSStringRef> attributeValue(Adopt, toAXElement(thisObject)->attributeValue(attribute));
@@ -569,6 +580,7 @@ JSClassRef AccessibilityUIElement::getJSClass()
         { "titleUIElement", titleUIElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setSelectedTextRange", setSelectedTextRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "attributeValue", attributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "isAttributeSupported", isAttributeSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "isAttributeSettable", isAttributeSettableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "isActionSupported", isActionSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "parentElement", parentElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
index 10529f66c4f49bb415cfba884e0ec64f94ba4902..99855235046a77e8f1455e169229db1577e2dd4c 100644 (file)
@@ -86,6 +86,7 @@ public:
 
     // Attributes - platform-independent implementations
     JSStringRef attributeValue(JSStringRef attribute);
+    bool isAttributeSupported(JSStringRef attribute);
     bool isAttributeSettable(JSStringRef attribute);
     bool isActionSupported(JSStringRef action);
     JSStringRef role();
index a92d68cf923666d2112c7a6e19924bba9f674780..13d313d7b0f22503aff8f7d6c8875c192c94ae45 100644 (file)
@@ -460,6 +460,11 @@ bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute)
     return false;
 }
 
+bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute)
+{
+    return false;
+}
+
 void AccessibilityUIElement::increment()
 {
     // FIXME: implement
index 2512aa99a97065dc3013eb116ed6d85b36d6c457..948f379dd0698853f2370c0aa0d6bb7913d8706a 100644 (file)
@@ -350,6 +350,11 @@ bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute)
     return [m_element accessibilityIsAttributeSettable:[NSString stringWithJSStringRef:attribute]];
 }
 
+bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute)
+{
+    return [[m_element accessibilityAttributeNames] containsObject:[NSString stringWithJSStringRef:attribute]];
+}
+
 JSStringRef AccessibilityUIElement::parameterizedAttributeNames()
 {
     NSArray* supportedParameterizedAttributes = [m_element accessibilityParameterizedAttributeNames];
index 2acc4a4a92e0f564ee1d2a4e229a9ed1a53aa3dd..163abb146e4d53f972b3452124fb44b23d1e7a03 100644 (file)
@@ -413,6 +413,11 @@ bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute)
     return false;
 }
 
+bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute)
+{
+    return false;
+}
+
 void AccessibilityUIElement::increment()
 {
 }