Changeset 163891 in webkit


Ignore:
Timestamp:
Feb 11, 2014 11:27:12 AM (10 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: AX: Accessibility Node Inspection
https://bugs.webkit.org/show_bug.cgi?id=127447

Patch by James Craig <jcraig@apple.com> on 2014-02-11
Reviewed by Timothy Hatcher.

Source/WebCore:

New methods supporting WebCore::AccessibilityObject::computedRoleString()
used for Accessibility section in WebInspector Node Inspector. Other updates
support the JSON interface for the WebInspectorUI feature.

Test: accessibility/roles-computedRoleString.html

  • accessibility/AccessibilityObject.cpp:

(WebCore::initializeRoleMap):
(WebCore::ariaRoleMap):
(WebCore::reverseAriaRoleMap):
(WebCore::AccessibilityObject::ariaRoleToWebCoreRole):
(WebCore::AccessibilityObject::computedRoleString):

  • accessibility/AccessibilityObject.h:
  • accessibility/mac/WebAccessibilityObjectWrapperMac.mm:

(-[WebAccessibilityObjectWrapper computedRoleString]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

  • inspector/InspectorDOMAgent.cpp:

(WebCore::InspectorDOMAgent::getAccessibilityPropertiesForNode):
(WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):

  • inspector/InspectorDOMAgent.h:
  • inspector/protocol/DOM.json:

Source/WebInspectorUI:

New Accessibility section in WebInspector Node Inspector.
Version 1.0 only shows computed role. Computed label should come soon.

Removed CSS fixed table layout b/c CSS bug: http://webkit.org/b/128294

  • Localizations/en.lproj/localizedStrings.js:
  • UserInterface/DOMNode.js:
  • UserInterface/DOMNodeDetailsSidebarPanel.js:
  • UserInterface/DetailsSection.css:
  • UserInterface/InspectorWebBackendCommands.js:

Tools:

New computedRoleString interfaces in DumpRenderTree/WebKitTestRunner
to support LayoutTest coverage of AccessibilityObject::computedRoleString()

  • DumpRenderTree/AccessibilityUIElement.cpp:
  • DumpRenderTree/AccessibilityUIElement.h:
  • DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
  • DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
  • DumpRenderTree/mac/AccessibilityUIElementMac.mm:
  • DumpRenderTree/win/AccessibilityUIElementWin.cpp:
  • WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
  • WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
  • WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
  • WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
  • WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:

LayoutTests:

New layout verifying AccessibilityObject::computedRoleString()

  • accessibility/roles-computedRoleString-expected.txt: Added.
  • accessibility/roles-computedRoleString.html: Added.
Location:
trunk
Files:
2 added
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r163890 r163891  
     12014-02-11  James Craig  <jcraig@apple.com>
     2
     3        Web Inspector: AX: Accessibility Node Inspection
     4        https://bugs.webkit.org/show_bug.cgi?id=127447
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        New layout verifying AccessibilityObject::computedRoleString()
     9
     10        * accessibility/roles-computedRoleString-expected.txt: Added.
     11        * accessibility/roles-computedRoleString.html: Added.
     12
    1132014-02-10  Oliver Hunt  <oliver@apple.com>
    214
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r163749 r163891  
    13171317webkit.org/b/106316 accessibility/render-counter-text.html [ Failure ]
    13181318
     1319webkit.org/b/128420 accessibility/roles-computedRoleString.html [ Skip ]
     1320
    13191321webkit.org/b/103927 http/tests/w3c/webperf/submission/Intel/resource-timing/test_resource_timing_cross_origin_resource_request.html [ Failure ]
    13201322webkit.org/b/103927 http/tests/w3c/webperf/submission/Intel/resource-timing/test_resource_timing_timing_allow_cross_origin_resource_request.html [ Failure ]
  • trunk/Source/WebCore/ChangeLog

    r163890 r163891  
     12014-02-11  James Craig  <jcraig@apple.com>
     2
     3        Web Inspector: AX: Accessibility Node Inspection
     4        https://bugs.webkit.org/show_bug.cgi?id=127447
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        New methods supporting WebCore::AccessibilityObject::computedRoleString()
     9        used for Accessibility section in WebInspector Node Inspector. Other updates
     10        support the JSON interface for the WebInspectorUI feature.
     11
     12        Test: accessibility/roles-computedRoleString.html
     13
     14        * accessibility/AccessibilityObject.cpp:
     15        (WebCore::initializeRoleMap):
     16        (WebCore::ariaRoleMap):
     17        (WebCore::reverseAriaRoleMap):
     18        (WebCore::AccessibilityObject::ariaRoleToWebCoreRole):
     19        (WebCore::AccessibilityObject::computedRoleString):
     20        * accessibility/AccessibilityObject.h:
     21        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
     22        (-[WebAccessibilityObjectWrapper computedRoleString]):
     23        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
     24        * inspector/InspectorDOMAgent.cpp:
     25        (WebCore::InspectorDOMAgent::getAccessibilityPropertiesForNode):
     26        (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
     27        * inspector/InspectorDOMAgent.h:
     28        * inspector/protocol/DOM.json:
     29
    1302014-02-10  Oliver Hunt  <oliver@apple.com>
    231
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r163882 r163891  
    16111611
    16121612typedef HashMap<String, AccessibilityRole, CaseFoldingHash> ARIARoleMap;
     1613typedef HashMap<AccessibilityRole, String, DefaultHash<int>::Hash, WTF::UnsignedWithZeroKeyHashTraits<int>> ARIAReverseRoleMap;
     1614
     1615static ARIARoleMap* gAriaRoleMap = nullptr;
     1616static ARIAReverseRoleMap* gAriaReverseRoleMap = nullptr;
    16131617
    16141618struct RoleEntry {
     
    16171621};
    16181622
    1619 static ARIARoleMap* createARIARoleMap()
    1620 {
     1623static void initializeRoleMap()
     1624{
     1625    if (gAriaRoleMap)
     1626        return;
     1627    ASSERT(!gAriaReverseRoleMap);
     1628
    16211629    const RoleEntry roles[] = {
    16221630        { "alert", ApplicationAlertRole },
     
    16821690        { "treeitem", TreeItemRole }
    16831691    };
    1684     ARIARoleMap* roleMap = new ARIARoleMap;
    1685 
    1686     for (size_t i = 0; i < WTF_ARRAY_LENGTH(roles); ++i)
    1687         roleMap->set(roles[i].ariaRole, roles[i].webcoreRole);
    1688     return roleMap;
     1692
     1693    gAriaRoleMap = new ARIARoleMap;
     1694    gAriaReverseRoleMap = new ARIAReverseRoleMap;
     1695    size_t roleLength = WTF_ARRAY_LENGTH(roles);
     1696    for (size_t i = 0; i < roleLength; ++i) {
     1697        gAriaRoleMap->set(roles[i].ariaRole, roles[i].webcoreRole);
     1698        gAriaReverseRoleMap->set(roles[i].webcoreRole, roles[i].ariaRole);
     1699    }
     1700}
     1701
     1702static ARIARoleMap& ariaRoleMap()
     1703{
     1704    initializeRoleMap();
     1705    return *gAriaRoleMap;
     1706}
     1707
     1708static ARIAReverseRoleMap& reverseAriaRoleMap()
     1709{
     1710    initializeRoleMap();
     1711    return *gAriaReverseRoleMap;
    16891712}
    16901713
     
    16931716    ASSERT(!value.isEmpty());
    16941717   
    1695     static const ARIARoleMap* roleMap = createARIARoleMap();
    1696 
    16971718    Vector<String> roleVector;
    16981719    value.split(' ', roleVector);
     
    17011722    for (unsigned i = 0; i < size; ++i) {
    17021723        String roleName = roleVector[i];
    1703         role = roleMap->get(roleName);
     1724        role = ariaRoleMap().get(roleName);
    17041725        if (role)
    17051726            return role;
     
    17071728   
    17081729    return role;
     1730}
     1731
     1732String AccessibilityObject::computedRoleString() const
     1733{
     1734    // FIXME: Need a few special cases that aren't in the RoleMap: option, etc. http://webkit.org/b/128296
     1735    return reverseAriaRoleMap().get(roleValue());
    17091736}
    17101737
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r163725 r163891  
    806806    unsigned doAXLineForIndex(unsigned);
    807807
     808    String computedRoleString() const;
     809
    808810    virtual String stringValueForMSAA() const { return String(); }
    809811    virtual String stringRoleForMSAA() const { return String(); }
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r163712 r163891  
    21242124}
    21252125
     2126- (NSString *)computedRoleString
     2127{
     2128    if (!m_object)
     2129        return nil;
     2130    return m_object->computedRoleString();
     2131}
     2132
    21262133- (id)scrollViewParent
    21272134{
     
    21612168    if ([attributeName isEqualToString: NSAccessibilityRoleDescriptionAttribute])
    21622169        return [self roleDescription];
     2170
     2171    // AXARIARole is only used by DumpRenderTree (so far).
     2172    if ([attributeName isEqualToString:@"AXARIARole"])
     2173        return [self computedRoleString];
    21632174   
    21642175    if ([attributeName isEqualToString: NSAccessibilityParentAttribute]) {
  • trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp

    r163844 r163891  
    3535#include "InspectorDOMAgent.h"
    3636
     37#include "AXObjectCache.h"
    3738#include "Attr.h"
    3839#include "CSSComputedStyleDeclaration.h"
     
    875876}
    876877
     878void InspectorDOMAgent::getAccessibilityPropertiesForNode(ErrorString* errorString, int nodeId, RefPtr<Inspector::TypeBuilder::DOM::AccessibilityProperties>& axProperties)
     879{
     880    Node* node = assertNode(errorString, nodeId);
     881    axProperties = buildObjectForAccessibilityProperties(node);
     882}
     883
    877884void InspectorDOMAgent::performSearch(ErrorString* errorString, const String& whitespaceTrimmedQuery, const RefPtr<InspectorArray>* nodeIds, String* searchId, int* resultCount)
    878885{
     
    14001407}
    14011408
     1409PassRefPtr<TypeBuilder::DOM::AccessibilityProperties> InspectorDOMAgent::buildObjectForAccessibilityProperties(Node* node)
     1410{
     1411    ASSERT(node);
     1412    if (!node)
     1413        return nullptr;
     1414
     1415    if (!WebCore::AXObjectCache::accessibilityEnabled())
     1416        WebCore::AXObjectCache::enableAccessibility();
     1417
     1418    bool ignored = true;
     1419
     1420    // Computed ARIA Role
     1421    String role;
     1422
     1423    // Computed Label
     1424    // FIXME: Waiting on http://webkit.org/b/121134
     1425    String label;
     1426
     1427    if (AXObjectCache* axObjectCache = node->document().axObjectCache()) {
     1428        if (AccessibilityObject* axObject = axObjectCache->getOrCreate(node)) {
     1429            ignored = axObject->accessibilityIsIgnored();
     1430            role = axObject->computedRoleString();
     1431        }
     1432    }
     1433   
     1434    RefPtr<Inspector::TypeBuilder::DOM::AccessibilityProperties> value = Inspector::TypeBuilder::DOM::AccessibilityProperties::create()
     1435        .setIgnored(ignored)
     1436        .setRole(role)
     1437        .setLabel(label)
     1438        .setNodeId(pushNodePathToFrontend(node));
     1439
     1440    return value.release();
     1441}
     1442
    14021443Node* InspectorDOMAgent::innerFirstChild(Node* node)
    14031444{
  • trunk/Source/WebCore/inspector/InspectorDOMAgent.h

    r162676 r163891  
    132132    virtual void setNodeValue(ErrorString*, int nodeId, const String& value) override;
    133133    virtual void getEventListenersForNode(ErrorString*, int nodeId, const WTF::String* objectGroup, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::DOM::EventListener>>& listenersArray) override;
     134    virtual void getAccessibilityPropertiesForNode(ErrorString*, int nodeId, RefPtr<Inspector::TypeBuilder::DOM::AccessibilityProperties>& axProperties) override;
    134135    virtual void performSearch(ErrorString*, const String& whitespaceTrimmedQuery, const RefPtr<Inspector::InspectorArray>* nodeIds, String* searchId, int* resultCount) override;
    135136    virtual void getSearchResults(ErrorString*, const String& searchId, int fromIndex, int toIndex, RefPtr<Inspector::TypeBuilder::Array<int>>&) override;
     
    234235    PassRefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::DOM::Node>> buildArrayForContainerChildren(Node* container, int depth, NodeToIdMap* nodesMap);
    235236    PassRefPtr<Inspector::TypeBuilder::DOM::EventListener> buildObjectForEventListener(const RegisteredEventListener&, const AtomicString& eventType, Node*, const String* objectGroupId);
     237    PassRefPtr<Inspector::TypeBuilder::DOM::AccessibilityProperties> buildObjectForAccessibilityProperties(Node*);
    236238
    237239    Node* nodeForPath(const String& path);
  • trunk/Source/WebCore/inspector/protocol/DOM.json

    r161380 r163891  
    5656        },
    5757        {
     58            "id": "AccessibilityProperties",
     59            "description": "A structure holding accessibility properties.",
     60            "type": "object",
     61            "properties": [
     62                { "name": "ignored", "type": "boolean", "description": "Returns whether the accessibility of the DOM node is ignored, whether heuristically or explicitly." },
     63                { "name": "role", "type": "string", "description": "Computed value for first recognized role token, default role per element, or overridden role." },
     64                { "name": "label", "type": "string", "description": "Computed label value for the node, sometimes calculated by referencing other nodes." },
     65                { "name": "nodeId", "$ref": "NodeId", "description": "Target <code>DOMNode</code> id." }
     66            ]
     67        },
     68        {
    5869            "id": "RGBA",
    5970            "type": "object",
     
    189200        },
    190201        {
     202            "name": "getAccessibilityPropertiesForNode",
     203            "description": "Returns a dictionary of accessibility properties for the node.",
     204            "parameters": [
     205                { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node for which to get accessibility properties." }
     206            ],
     207            "returns": [
     208                { "name": "properties", "$ref": "AccessibilityProperties", "description": "Dictionary of relevant accessibility properties." }
     209            ]
     210        },
     211        {
    191212            "name": "getOuterHTML",
    192213            "parameters": [
  • trunk/Source/WebInspectorUI/ChangeLog

    r163812 r163891  
     12014-02-11  James Craig  <jcraig@apple.com>
     2
     3        Web Inspector: AX: Accessibility Node Inspection
     4        https://bugs.webkit.org/show_bug.cgi?id=127447
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        New Accessibility section in WebInspector Node Inspector.
     9        Version 1.0 only shows computed role. Computed label should come soon.
     10
     11        Removed CSS fixed table layout b/c CSS bug: http://webkit.org/b/128294
     12
     13        * Localizations/en.lproj/localizedStrings.js:
     14        * UserInterface/DOMNode.js:
     15        * UserInterface/DOMNodeDetailsSidebarPanel.js:
     16        * UserInterface/DetailsSection.css:
     17        * UserInterface/InspectorWebBackendCommands.js:
     18
    1192014-02-10  Joseph Pecoraro  <pecoraro@apple.com>
    220
  • trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js

    r163735 r163891  
    2424localizedStrings["%fpx²"] = "%fpx²";
    2525localizedStrings["%s Event Dispatched"] = "%s Event Dispatched";
     26localizedStrings["%s (computed)"] = "%s (computed)";
     27localizedStrings["%s (default)"] = "%s (default)";
    2628localizedStrings["(anonymous function)"] = "(anonymous function)";
    2729localizedStrings["(program)"] = "(program)";
    2830localizedStrings["1 match"] = "1 match";
    2931localizedStrings["999+"] = "999+";
     32localizedStrings["Accessibility"] = "Accessibility";
    3033localizedStrings["Action"] = "Action";
    3134localizedStrings["Activity Viewer"] = "Activity Viewer";
     
    216219localizedStrings["JavaScript profiles show where the execution time is spent in your page's JavaScript functions."] = "JavaScript profiles show where the execution time is spent in your page's JavaScript functions.";
    217220localizedStrings["Key"] = "Key";
     221localizedStrings["Label"] = "Label";
    218222localizedStrings["Latency"] = "Latency";
    219223localizedStrings["Layer"] = "Layer";
     
    249253localizedStrings["New Rule"] = "New Rule";
    250254localizedStrings["No"] = "No";
     255localizedStrings["No Accessibility Information"] = "No Accessibility Information";
    251256localizedStrings["No Application Cache information available"] = "No Application Cache information available";
    252257localizedStrings["No Attributes"] = "No Attributes";
     
    255260localizedStrings["No Child Layers"] = "No Child Layers";
    256261localizedStrings["No Event Listeners"] = "No Event Listeners";
     262localizedStrings["No exact ARIA role match."] = "No exact ARIA role match.";
    257263localizedStrings["No Filter Results"] = "No Filter Results";
    258264localizedStrings["No Layer Available"] = "No Layer Available";
     
    314320localizedStrings["Reveal in Debugger Navigation Sidebar"] = "Reveal in Debugger Navigation Sidebar";
    315321localizedStrings["Reveal in Original Resource"] = "Reveal in Original Resource";
     322localizedStrings["Role"] = "Role";
    316323localizedStrings["Rules"] = "Rules";
    317324localizedStrings["Scheme"] = "Scheme";
  • trunk/Source/WebInspectorUI/UserInterface/DOMNode.js

    r151453 r163891  
    442442    },
    443443
     444    accessibilityProperties: function(callback)
     445    {
     446        function accessibilityPropertiesCallback(error, accessibilityProperties)
     447        {
     448            if (!error && callback) {
     449                callback({
     450                    ignored: accessibilityProperties.ignored,
     451                    role: accessibilityProperties.role,
     452                    label: accessibilityProperties.label
     453                });
     454            }
     455        }
     456        DOMAgent.getAccessibilityPropertiesForNode(this.id, accessibilityPropertiesCallback.bind(this));
     457    },
     458
    444459    /**
    445460     * @return {string}
  • trunk/Source/WebInspectorUI/UserInterface/DOMNodeDetailsSidebarPanel.js

    r153894 r163891  
    5252    var eventListenersSection = new WebInspector.DetailsSection("dom-node-event-listeners", WebInspector.UIString("Event Listeners"), [this._eventListenersSectionGroup]);   
    5353
     54    this._accessibilityEmptyRow = new WebInspector.DetailsSectionRow(WebInspector.UIString("No Accessibility Information"));
     55    this._accessibilityNodeComputedLabelRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Label"));
     56    this._accessibilityNodeComputedRoleRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Role"));
     57   
     58    this._accessibilityGroup = new WebInspector.DetailsSectionGroup([this._accessibilityEmptyRow]);
     59    var accessibilitySection = new WebInspector.DetailsSection("dom-node-accessibility", WebInspector.UIString("Accessibility"), [this._accessibilityGroup]);   
     60   
    5461    this.element.appendChild(identitySection.element);
    5562    this.element.appendChild(attributesSection.element);
    5663    this.element.appendChild(propertiesSection.element);
    5764    this.element.appendChild(eventListenersSection.element);
     65    this.element.appendChild(accessibilitySection.element);
    5866};
    5967
     
    7987        this._refreshProperties();
    8088        this._refreshEventListeners();
     89        this._refreshAccessibility();
    8190    },
    8291
     
    224233    },
    225234
     235    _refreshAccessibility: function()
     236    {
     237        var domNode = this.domNode;
     238        if (!domNode)
     239            return;
     240
     241        function accessibilityPropertiesCallback(accessibilityProperties)
     242        {
     243            if (this.domNode !== domNode)
     244                return;
     245
     246            if (accessibilityProperties && !accessibilityProperties.ignored) {
     247                var role = accessibilityProperties.role;
     248
     249                if (role === "" || role === "unknown")
     250                    role = WebInspector.UIString("No exact ARIA role match.");
     251                else if (role) {
     252                    if (!domNode.getAttribute("role"))
     253                        role = WebInspector.UIString("%s (default)").format(role);
     254                    else if (domNode.getAttribute("role") !== role)
     255                        role = WebInspector.UIString("%s (computed)").format(role);
     256                }
     257               
     258                // FIXME: label will always come back as empty. Blocked by http://webkit.org/b/121134
     259                var label = accessibilityProperties.label;
     260                if (label && label !== domNode.getAttribute("aria-label"))
     261                    label = WebInspector.UIString("%s (computed)").format(label);
     262
     263                this._accessibilityNodeComputedLabelRow.value = label;
     264                this._accessibilityNodeComputedRoleRow.value = role;
     265
     266                this._accessibilityGroup.rows = [this._accessibilityNodeComputedLabelRow, this._accessibilityNodeComputedRoleRow];
     267                this._accessibilityEmptyRow.hideEmptyMessage();
     268            } else {
     269                this._accessibilityGroup.rows = [this._accessibilityEmptyRow];
     270                this._accessibilityEmptyRow.showEmptyMessage();
     271            }
     272        }
     273        domNode.accessibilityProperties(accessibilityPropertiesCallback.bind(this));
     274    },
     275
    226276    _attributesChanged: function(event)
    227277    {
     
    229279            return;
    230280        this._refreshAttributes();
     281        this._refreshAccessibility();
    231282    },
    232283
  • trunk/Source/WebInspectorUI/UserInterface/DetailsSection.css

    r162415 r163891  
    124124.details-section > .content {
    125125    display: table;
    126     table-layout: fixed;
    127126    width: 100%;
    128127    border-spacing: 0;
  • trunk/Source/WebInspectorUI/UserInterface/InspectorWebBackendCommands.js

    r163568 r163891  
    8888InspectorBackend.registerCommand("DOM.removeAttribute", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "name", "type": "string", "optional": false}], []);
    8989InspectorBackend.registerCommand("DOM.getEventListenersForNode", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "objectGroup", "type": "string", "optional": true}], ["listeners"]);
     90InspectorBackend.registerCommand("DOM.getAccessibilityPropertiesForNode", [{"name": "nodeId", "type": "number", "optional": false}], ["properties"]);
    9091InspectorBackend.registerCommand("DOM.getOuterHTML", [{"name": "nodeId", "type": "number", "optional": false}], ["outerHTML"]);
    9192InspectorBackend.registerCommand("DOM.setOuterHTML", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "outerHTML", "type": "string", "optional": false}], []);
  • trunk/Tools/ChangeLog

    r163870 r163891  
     12014-02-11  James Craig  <jcraig@apple.com>
     2
     3        Web Inspector: AX: Accessibility Node Inspection
     4        https://bugs.webkit.org/show_bug.cgi?id=127447
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        New computedRoleString interfaces in DumpRenderTree/WebKitTestRunner
     9        to support LayoutTest coverage of AccessibilityObject::computedRoleString()
     10
     11        * DumpRenderTree/AccessibilityUIElement.cpp:
     12        * DumpRenderTree/AccessibilityUIElement.h:
     13        * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
     14        * DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
     15        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
     16        * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
     17        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
     18        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
     19        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
     20        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
     21        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
     22
    1232014-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
    224
  • trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp

    r163632 r163891  
    883883}
    884884
     885static JSValueRef getComputedRoleStringCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
     886{
     887    JSRetainPtr<JSStringRef> compRole(Adopt, toAXElement(thisObject)->computedRoleString());
     888    return JSValueMakeString(context, compRole.get());
     889}
     890
    885891static JSValueRef getTitleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
    886892{
     
    14181424        { "subrole", getSubroleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14191425        { "roleDescription", getRoleDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1426        { "computedRoleString", getComputedRoleStringCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14201427        { "title", getTitleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    14211428        { "description", getDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/Tools/DumpRenderTree/AccessibilityUIElement.h

    r163632 r163891  
    118118    JSStringRef subrole();
    119119    JSStringRef roleDescription();
     120    JSStringRef computedRoleString();
    120121    JSStringRef title();
    121122    JSStringRef description();
  • trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp

    r163632 r163891  
    752752}
    753753
     754JSStringRef AccessibilityUIElement::computedRoleString()
     755{
     756    // FIXME: implement http://webkit.org/b/128420
     757    return nullptr;
     758}
     759
    754760JSStringRef AccessibilityUIElement::title()
    755761{
  • trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm

    r163632 r163891  
    474474}
    475475
     476JSStringRef AccessibilityUIElement::computedRoleString()
     477{
     478    // FIXME: implement
     479    return JSStringCreateWithCharacters(0, 0);
     480}
     481
    476482JSStringRef AccessibilityUIElement::title()
    477483{
  • trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm

    r163632 r163891  
    628628}
    629629
     630JSStringRef AccessibilityUIElement::computedRoleString()
     631{
     632    BEGIN_AX_OBJC_EXCEPTIONS
     633    NSString *computedRoleString = descriptionOfValue([m_element accessibilityAttributeValue:@"AXARIARole"], m_element);
     634    return [computedRoleString createJSStringRef];
     635    END_AX_OBJC_EXCEPTIONS
     636   
     637    return nullptr;
     638}
     639
    630640JSStringRef AccessibilityUIElement::title()
    631641{
  • trunk/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp

    r163632 r163891  
    287287}
    288288
     289JSStringRef AccessibilityUIElement::computedRoleString()
     290{
     291    return 0;
     292}
     293
    289294JSStringRef AccessibilityUIElement::title()
    290295{
  • trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp

    r163632 r163891  
    100100JSRetainPtr<JSStringRef> AccessibilityUIElement::subrole() { return 0; }
    101101JSRetainPtr<JSStringRef> AccessibilityUIElement::roleDescription() { return 0; }
     102JSRetainPtr<JSStringRef> AccessibilityUIElement::computedRoleString() { return 0; }
    102103JSRetainPtr<JSStringRef> AccessibilityUIElement::title() { return 0; }
    103104JSRetainPtr<JSStringRef> AccessibilityUIElement::description() { return 0; }
  • trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h

    r163632 r163891  
    114114    JSRetainPtr<JSStringRef> subrole();
    115115    JSRetainPtr<JSStringRef> roleDescription();
     116    JSRetainPtr<JSStringRef> computedRoleString();
    116117    JSRetainPtr<JSStringRef> title();
    117118    JSRetainPtr<JSStringRef> description();
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl

    r163632 r163891  
    4444    readonly attribute DOMString subrole;
    4545    readonly attribute DOMString roleDescription;
     46    readonly attribute DOMString computedRoleString;
    4647    readonly attribute DOMString title;
    4748    readonly attribute DOMString description;
  • trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp

    r163642 r163891  
    914914}
    915915
     916JSRetainPtr<JSStringRef> AccessibilityUIElement::computedRoleString()
     917{
     918    // FIXME: implement http://webkit.org/b/128420
     919    return JSStringCreateWithCharacters(0, 0);
     920}
     921
    916922JSRetainPtr<JSStringRef> AccessibilityUIElement::title()
    917923{
  • trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm

    r163632 r163891  
    254254}
    255255
     256JSStringRef AccessibilityUIElement::computedRoleString()
     257{
     258    // FIXME: implement
     259    return JSStringCreateWithCharacters(0, 0);
     260}
     261
    256262JSRetainPtr<JSStringRef> AccessibilityUIElement::title()
    257263{
  • trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm

    r163632 r163891  
    672672}
    673673
     674JSRetainPtr<JSStringRef> AccessibilityUIElement::computedRoleString()
     675{
     676    BEGIN_AX_OBJC_EXCEPTIONS
     677    NSString *computedRoleString = descriptionOfValue([m_element accessibilityAttributeValue:@"AXARIARole"], m_element);
     678    return [computedRoleString createJSStringRef];
     679    END_AX_OBJC_EXCEPTIONS
     680   
     681    return nullptr;
     682}
     683
    674684JSRetainPtr<JSStringRef> AccessibilityUIElement::title()
    675685{
Note: See TracChangeset for help on using the changeset viewer.