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
+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.
test test test
AXDescription:
-AXValue:
AXFocused: 0
AXEnabled: 1
AXWindow: <AXButton: 'test test test
'>
AXTitleUIElement: (null)
AXAccessKey: (null)
-AXRequired: 0
------------
AXRole: AXMenu
--- /dev/null
+
+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
+
--- /dev/null
+<!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>
test test test
AXDescription:
-AXValue:
AXFocused: 0
AXEnabled: 1
AXWindow: <AXButton: 'test test test
'>
AXTitleUIElement: (null)
AXAccessKey: (null)
-AXRequired: 0
------------
AXRole: AXMenu
+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.
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; }
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,
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];
[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];
}
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;
objectAttributes = menuItemAttrs;
NSArray *additionalAttributes = [self additionalAccessibilityAttributeNames];
- if ( [additionalAttributes count] > 0 )
- {
+ if ([additionalAttributes count])
objectAttributes = [objectAttributes arrayByAddingObjectsFromArray:additionalAttributes];
- }
return objectAttributes;
}
+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.
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));
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));
{ "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 },
// Attributes - platform-independent implementations
JSStringRef attributeValue(JSStringRef attribute);
+ bool isAttributeSupported(JSStringRef attribute);
bool isAttributeSettable(JSStringRef attribute);
bool isActionSupported(JSStringRef action);
JSStringRef role();
return false;
}
+bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute)
+{
+ return false;
+}
+
void AccessibilityUIElement::increment()
{
// FIXME: implement
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];
return false;
}
+bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute)
+{
+ return false;
+}
+
void AccessibilityUIElement::increment()
{
}