Changeset 93226 in webkit


Ignore:
Timestamp:
Aug 17, 2011 11:28:02 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Source/WebCore: AccessibilityObject levels are inconsistent
https://bugs.webkit.org/show_bug.cgi?id=66180

Updated accessibilityTable to return level values consistent with other accessibilityObjects that
return level values. This means a value of 0 is now only returned when tableLevel() is called on a
non-table element.

Patch by Sam White <samuel.white@rochester.edu> on 2011-08-17
Reviewed by Chris Fleizach.

Test: platform/mac/accessibility/element-level.html

  • accessibility/AccessibilityTable.cpp:

(WebCore::AccessibilityTable::tableLevel):

  • accessibility/mac/AccessibilityObjectWrapper.mm:

(-[AccessibilityObjectWrapper accessibilityAttributeValue:]):

Tools: AccessibilityObject levels are inconsistent
https://bugs.webkit.org/show_bug.cgi?id=66180

Added the ability to get numeric attribute values using numberAttributeValue. This
function complements the existing stringAttributeValue and boolAttributeValue functions.
The addition of numberAttributeValue was necessary because the stringAttributeValue
function does a type check and will only return strings. This limitation made it
impossible to get values for attributes that returned an NSNumber.

Patch by Sam White <samuel.white@rochester.edu> on 2011-08-17
Reviewed by Chris Fleizach.

  • DumpRenderTree/AccessibilityUIElement.cpp:

(numberAttributeValueCallback):
(AccessibilityUIElement::getJSClass):

  • DumpRenderTree/AccessibilityUIElement.h:
  • DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:

(AccessibilityUIElement::numberAttributeValue):

  • DumpRenderTree/mac/AccessibilityUIElementMac.mm:

(AccessibilityUIElement::numberAttributeValue):

  • DumpRenderTree/win/AccessibilityUIElementWin.cpp:

(AccessibilityUIElement::numberAttributeValue):

LayoutTests: AccessibilityObject levels are inconsistent
https://bugs.webkit.org/show_bug.cgi?id=66180

This test ensures that all AccessibilityObjects that return a level value return consistent results.
For example, a level of 0 should only be returned by a level function when it is called on an
AccessibilityObject of the wrong type. It's especially important that we enforce this consistency
using layout tests because these level values are not defined by the W3C but are still used by
popular screen readers such as VoiceOver.

Patch by Sam White <samuel.white@rochester.edu> on 2011-08-17
Reviewed by Chris Fleizach.

  • platform/mac/accessibility/element-level-expected.txt: Added.
  • platform/mac/accessibility/element-level.html: Added.
Location:
trunk
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r93221 r93226  
     12011-08-17  Sam White  <samuel.white@rochester.edu>
     2
     3        AccessibilityObject levels are inconsistent
     4        https://bugs.webkit.org/show_bug.cgi?id=66180
     5       
     6        This test ensures that all AccessibilityObjects that return a level value return consistent results.
     7        For example, a level of 0 should only be returned by a level function when it is called on an
     8        AccessibilityObject of the wrong type. It's especially important that we enforce this consistency
     9        using layout tests because these level values are not defined by the W3C but are still used by
     10        popular screen readers such as VoiceOver.
     11
     12        Reviewed by Chris Fleizach.
     13
     14        * platform/mac/accessibility/element-level-expected.txt: Added.
     15        * platform/mac/accessibility/element-level.html: Added.
     16
    1172011-08-17  Ryosuke Niwa  <rniwa@webkit.org>
    218
  • trunk/Source/WebCore/ChangeLog

    r93221 r93226  
     12011-08-17  Sam White  <samuel.white@rochester.edu>
     2
     3        AccessibilityObject levels are inconsistent
     4        https://bugs.webkit.org/show_bug.cgi?id=66180
     5       
     6        Updated accessibilityTable to return level values consistent with other accessibilityObjects that
     7        return level values. This means a value of 0 is now only returned when tableLevel() is called on a
     8        non-table element.
     9
     10        Reviewed by Chris Fleizach.
     11
     12        Test: platform/mac/accessibility/element-level.html
     13
     14        * accessibility/AccessibilityTable.cpp:
     15        (WebCore::AccessibilityTable::tableLevel):
     16        * accessibility/mac/AccessibilityObjectWrapper.mm:
     17        (-[AccessibilityObjectWrapper accessibilityAttributeValue:]):
     18
    1192011-08-17  Ryosuke Niwa  <rniwa@webkit.org>
    220
  • trunk/Source/WebCore/accessibility/AccessibilityTable.cpp

    r92000 r93226  
    451451{
    452452    int level = 0;
    453     for (AccessibilityObject* obj = parentObject(); obj; obj = obj->parentObject()) {
     453    for (AccessibilityObject* obj = static_cast<AccessibilityObject*>(const_cast<AccessibilityTable*>(this)); obj; obj = obj->parentObject()) {
    454454        if (obj->isAccessibilityTable())
    455455            ++level;
  • trunk/Source/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm

    r93021 r93226  
    21992199        if ([attributeName isEqualToString:NSAccessibilityBlockQuoteLevelAttribute])
    22002200            return [NSNumber numberWithInt:m_object->blockquoteLevel()];
     2201        if ([attributeName isEqualToString:@"AXTableLevel"])
     2202            return [NSNumber numberWithInt:m_object->tableLevel()];
    22012203    } else {
    2202         if ([attributeName isEqualToString:NSAccessibilityBlockQuoteLevelAttribute]) {
    2203             AccessibilityObject* parent = m_object->parentObjectUnignored();
    2204             if (!parent)
    2205                 return [NSNumber numberWithInt:0];
    2206             return [parent->wrapper() accessibilityAttributeValue:NSAccessibilityBlockQuoteLevelAttribute];       
    2207         }
     2204        AccessibilityObject* parent = m_object->parentObjectUnignored();
     2205        if (!parent)
     2206            return [NSNumber numberWithInt:0];
     2207       
     2208        if ([attributeName isEqualToString:NSAccessibilityBlockQuoteLevelAttribute])
     2209            return [parent->wrapper() accessibilityAttributeValue:NSAccessibilityBlockQuoteLevelAttribute];
     2210        if ([attributeName isEqualToString:@"AXTableLevel"])
     2211            return [parent->wrapper() accessibilityAttributeValue:@"AXTableLevel"];
    22082212    }
    22092213   
  • trunk/Tools/ChangeLog

    r93224 r93226  
     12011-08-17  Sam White  <samuel.white@rochester.edu>
     2
     3        AccessibilityObject levels are inconsistent
     4        https://bugs.webkit.org/show_bug.cgi?id=66180
     5       
     6        Added the ability to get numeric attribute values using numberAttributeValue. This
     7        function complements the existing stringAttributeValue and boolAttributeValue functions.
     8        The addition of numberAttributeValue was necessary because the stringAttributeValue
     9        function does a type check and will only return strings. This limitation made it
     10        impossible to get values for attributes that returned an NSNumber.
     11
     12        Reviewed by Chris Fleizach.
     13
     14        * DumpRenderTree/AccessibilityUIElement.cpp:
     15        (numberAttributeValueCallback):
     16        (AccessibilityUIElement::getJSClass):
     17        * DumpRenderTree/AccessibilityUIElement.h:
     18        * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
     19        (AccessibilityUIElement::numberAttributeValue):
     20        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
     21        (AccessibilityUIElement::numberAttributeValue):
     22        * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
     23        (AccessibilityUIElement::numberAttributeValue):
     24
    1252011-08-17  Adam Roben  <aroben@apple.com>
    226
  • trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp

    r92571 r93226  
    370370    JSRetainPtr<JSStringRef> stringAttributeValue(Adopt, toAXElement(thisObject)->stringAttributeValue(attribute));
    371371    JSValueRef result = JSValueMakeString(context, stringAttributeValue.get());
     372    if (attribute)
     373        JSStringRelease(attribute);
     374    return result;
     375}
     376
     377static JSValueRef numberAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     378{
     379    JSStringRef attribute = 0;
     380    if (argumentCount == 1)
     381        attribute = JSValueToStringCopy(context, arguments[0], exception);
     382    double val = toAXElement(thisObject)->numberAttributeValue(attribute);
     383    JSValueRef result = JSValueMakeNumber(context, val);
    372384    if (attribute)
    373385        JSStringRelease(attribute);
     
    10091021        { "setSelectedTextRange", setSelectedTextRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    10101022        { "stringAttributeValue", stringAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1023        { "numberAttributeValue", numberAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    10111024        { "boolAttributeValue", boolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    10121025        { "isAttributeSupported", isAttributeSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/Tools/DumpRenderTree/AccessibilityUIElement.h

    r92571 r93226  
    105105    // Attributes - platform-independent implementations
    106106    JSStringRef stringAttributeValue(JSStringRef attribute);
     107    double numberAttributeValue(JSStringRef attribute);
    107108    bool boolAttributeValue(JSStringRef attribute);
    108109    bool isAttributeSupported(JSStringRef attribute);
  • trunk/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp

    r92571 r93226  
    615615}
    616616
     617double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute)
     618{
     619    // FIXME: implement
     620    return 0.0f;
     621}
     622
    617623bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute)
    618624{
  • trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm

    r92571 r93226  
    481481}
    482482
     483double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute)
     484{
     485    BEGIN_AX_OBJC_EXCEPTIONS
     486    id value = [m_element accessibilityAttributeValue:[NSString stringWithJSStringRef:attribute]];
     487    if ([value isKindOfClass:[NSNumber class]])
     488        return [value doubleValue];
     489    END_AX_OBJC_EXCEPTIONS
     490   
     491    return 0;
     492}
     493
    483494bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute)
    484495{
  • trunk/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp

    r92571 r93226  
    514514}
    515515
     516double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute)
     517{
     518    // FIXME: implement
     519    return 0;
     520}
     521
    516522bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute)
    517523{
Note: See TracChangeset for help on using the changeset viewer.