AX: ARIA 1.1 @aria-current
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Sep 2015 00:47:20 +0000 (00:47 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Sep 2015 00:47:20 +0000 (00:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146012

Patch by Nan Wang <n_wang@apple.com> on 2015-09-11
Reviewed by Chris Fleizach.

Source/JavaScriptCore:

Updated inspector to support aria-current.

* inspector/protocol/DOM.json:

Source/WebCore:

Tests: accessibility/aria-current.html
       inspector/dom/getAccessibilityPropertiesForNode_ariaCurrent.html

Added support for ARIA 1.1 aria-current.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::invalidStatus):
(WebCore::AccessibilityObject::ariaCurrentState):
(WebCore::AccessibilityObject::hasTagName):
* accessibility/AccessibilityObject.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
* html/HTMLAttributeNames.in:
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):

Source/WebInspectorUI:

Added support for ARIA 1.1 aria-current.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Models/DOMNode.js:
* UserInterface/Views/DOMNodeDetailsSidebarPanel.js:

LayoutTests:

* accessibility/aria-current-expected.txt: Added.
* accessibility/aria-current.html: Added.
* inspector/dom/getAccessibilityPropertiesForNode_ariaCurrent-expected.txt: Added.
* inspector/dom/getAccessibilityPropertiesForNode_ariaCurrent.html: Added.
* platform/gtk/TestExpectations:
* platform/win/TestExpectations:

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

19 files changed:
LayoutTests/ChangeLog
LayoutTests/accessibility/aria-current-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/aria-current.html [new file with mode: 0644]
LayoutTests/inspector/dom/getAccessibilityPropertiesForNode_ariaCurrent-expected.txt [new file with mode: 0644]
LayoutTests/inspector/dom/getAccessibilityPropertiesForNode_ariaCurrent.html [new file with mode: 0644]
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/win/TestExpectations
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/DOM.json
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
Source/WebCore/html/HTMLAttributeNames.in
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Models/DOMNode.js
Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js

index 8b3702f..f464f7d 100644 (file)
@@ -1,3 +1,17 @@
+2015-09-11  Nan Wang  <n_wang@apple.com>
+
+        AX: ARIA 1.1 @aria-current
+        https://bugs.webkit.org/show_bug.cgi?id=146012
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/aria-current-expected.txt: Added.
+        * accessibility/aria-current.html: Added.
+        * inspector/dom/getAccessibilityPropertiesForNode_ariaCurrent-expected.txt: Added.
+        * inspector/dom/getAccessibilityPropertiesForNode_ariaCurrent.html: Added.
+        * platform/gtk/TestExpectations:
+        * platform/win/TestExpectations:
+
 2015-09-11  Alexey Proskuryakov  <ap@apple.com>
 
         Mark http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-overridesexpires.html as flaky for
diff --git a/LayoutTests/accessibility/aria-current-expected.txt b/LayoutTests/accessibility/aria-current-expected.txt
new file mode 100644 (file)
index 0000000..120b354
--- /dev/null
@@ -0,0 +1,41 @@
+Nav1
+Nav2
+Nav3
+Nav4
+Nav5
+Nav6
+Nav7
+Nav8
+Nav9
+Nav10
+Nav11
+Nav12
+Nav13
+Nav14
+Nav15
+Nav16
+This tests that aria-current causes the right attribute to be returned.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS: AXARIACurrent is false
+PASS: AXARIACurrent is false
+PASS: AXARIACurrent is false
+PASS: AXARIACurrent is false
+PASS: AXARIACurrent is false
+PASS: AXARIACurrent is false
+PASS: AXARIACurrent is page
+PASS: AXARIACurrent is step
+PASS: AXARIACurrent is location
+PASS: AXARIACurrent is date
+PASS: AXARIACurrent is time
+PASS: AXARIACurrent is true
+PASS: AXARIACurrent is true
+PASS: AXARIACurrent is true
+PASS: AXARIACurrent is page
+PASS: AXARIACurrent is step
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/aria-current.html b/LayoutTests/accessibility/aria-current.html
new file mode 100644 (file)
index 0000000..3b14bf3
--- /dev/null
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<nav role="navigation">
+    <!-- All of these eval to 'false' -->
+    <ul><li><a class="ex" data-expected="false" href="/">Nav1</a></li></ul>
+    <ul><li><a class="ex" data-expected="false" href="/" aria-current="false">Nav2</a></li></ul>
+    <ul><li><a class="ex" data-expected="false" href="/" aria-current="">Nav3</a></li></ul>
+    <ul><li><a class="ex" data-expected="false" href="/" aria-current=" ">Nav4</a></li></ul>
+    <ul><li><a class="ex" data-expected="false" href="/" aria-current="        ">Nav5</a></li></ul> <!-- tab char -->
+    <ul><li><a class="ex" data-expected="false" href="/" aria-current="
+    ">Nav6</a></li></ul> <!-- newline char -->
+
+    <!-- Known token values in ARIA 1.1 -->
+    <ul><li><a class="ex" data-expected="page" href="/" aria-current="page">Nav7</a></li></ul>
+    <ul><li><a class="ex" data-expected="step" href="/" aria-current="step">Nav8</a></li></ul>
+    <ul><li><a class="ex" data-expected="location" href="/" aria-current="location">Nav9</a></li></ul>
+    <ul><li><a class="ex" data-expected="date" href="/" aria-current="date">Nav10</a></li></ul>
+    <ul><li><a class="ex" data-expected="time" href="/" aria-current="time">Nav11</a></li></ul>
+    <ul><li><a class="ex" data-expected="true" href="/" aria-current="true">Nav12</a></li></ul>
+
+    <!-- All other string values -->
+    <ul><li><a class="ex" data-expected="true" href="/" aria-current="sometext">Nav13</a></li></ul>
+    <ul><li><a class="ex" data-expected="true" href="/" aria-current="page step">Nav14</a></li></ul>
+    <ul><li><a class="ex" data-expected="page" href="/" aria-current="page ">Nav15</a></li></ul>
+    <ul><li><a class="ex" data-expected="step" href="/" aria-current="  step ">Nav16</a></li></ul>
+</nav>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that aria-current causes the right attribute to be returned.");
+
+    function verify(value, expectation, element) {
+      if (value === expectation)
+        debug("PASS: AXARIACurrent is " + value);
+      else
+        debug("FAIL: AXARIACurrent is " + value + ". Expected: " + expectation + ". " + (element ? element.outerHTML : ""));
+    }
+
+    if (window.accessibilityController) {
+        var examples = document.querySelectorAll(".ex");
+        for (var i = 0, c = examples.length; i < c; i++) {
+            var el = examples[i];
+            el.focus();
+            var expectation = el.getAttribute("data-expected");
+            var value = accessibilityController.focusedElement.stringAttributeValue('AXARIACurrent');
+            verify(value, expectation, el);
+        }
+    }
+
+</script>
+
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/inspector/dom/getAccessibilityPropertiesForNode_ariaCurrent-expected.txt b/LayoutTests/inspector/dom/getAccessibilityPropertiesForNode_ariaCurrent-expected.txt
new file mode 100644 (file)
index 0000000..9fcc2b8
--- /dev/null
@@ -0,0 +1,47 @@
+Checking Web Inspector protocol (specifically aria-current attribute) for the Accessibility Node Inspector.
+
+Total elements to be tested: 16.
+
+<a data-expected="step" href="/" aria-current="  step ">Nav16</a>
+    current: step
+
+<a data-expected="page" href="/" aria-current="page ">Nav15</a>
+    current: page
+
+<a data-expected="true" href="/" aria-current="page step">Nav14</a>
+    current: true
+
+<a data-expected="true" href="/" aria-current="sometext">Nav13</a>
+    current: true
+
+<a data-expected="true" href="/" aria-current="true">Nav12</a>
+    current: true
+
+<a data-expected="time" href="/" aria-current="time">Nav11</a>
+    current: time
+
+<a data-expected="date" href="/" aria-current="date">Nav10</a>
+    current: date
+
+<a data-expected="location" href="/" aria-current="location">Nav9</a>
+    current: location
+
+<a data-expected="step" href="/" aria-current="step">Nav8</a>
+    current: step
+
+<a data-expected="page" href="/" aria-current="page">Nav7</a>
+    current: page
+
+<a data-expected="false" href="/" aria-current="
+    ">Nav6</a>
+
+<a data-expected="false" href="/" aria-current="       ">Nav5</a>
+
+<a data-expected="false" href="/" aria-current=" ">Nav4</a>
+
+<a data-expected="false" href="/" aria-current="">Nav3</a>
+
+<a data-expected="false" href="/" aria-current="false">Nav2</a>
+
+<a data-expected="false" href="/">Nav1</a>
+
diff --git a/LayoutTests/inspector/dom/getAccessibilityPropertiesForNode_ariaCurrent.html b/LayoutTests/inspector/dom/getAccessibilityPropertiesForNode_ariaCurrent.html
new file mode 100644 (file)
index 0000000..3bf4ff5
--- /dev/null
@@ -0,0 +1,113 @@
+<html>
+<head>
+<script type="text/javascript" src="../../http/tests/inspector/resources/protocol-test.js"></script>
+</head>
+<body onLoad="runTest()">
+
+<p>Checking Web Inspector protocol (specifically aria-current attribute) for the Accessibility Node Inspector.</p>
+
+<div id="examples">
+
+       <!-- All of these eval to 'false', ARIACurrent should not be set -->
+    <ul><li><a class="ex" data-expected="false" href="/">Nav1</a></li></ul>
+    <ul><li><a class="ex" data-expected="false" href="/" aria-current="false">Nav2</a></li></ul>
+    <ul><li><a class="ex" data-expected="false" href="/" aria-current="">Nav3</a></li></ul>
+    <ul><li><a class="ex" data-expected="false" href="/" aria-current=" ">Nav4</a></li></ul>
+    <ul><li><a class="ex" data-expected="false" href="/" aria-current="        ">Nav5</a></li></ul> <!-- tab char -->
+    <ul><li><a class="ex" data-expected="false" href="/" aria-current="
+    ">Nav6</a></li></ul> <!-- newline char -->
+
+    <!-- Known token values in ARIA 1.1 -->
+    <ul><li><a class="ex" data-expected="page" href="/" aria-current="page">Nav7</a></li></ul>
+    <ul><li><a class="ex" data-expected="step" href="/" aria-current="step">Nav8</a></li></ul>
+    <ul><li><a class="ex" data-expected="location" href="/" aria-current="location">Nav9</a></li></ul>
+    <ul><li><a class="ex" data-expected="date" href="/" aria-current="date">Nav10</a></li></ul>
+    <ul><li><a class="ex" data-expected="time" href="/" aria-current="time">Nav11</a></li></ul>
+    <ul><li><a class="ex" data-expected="true" href="/" aria-current="true">Nav12</a></li></ul>
+
+    <!-- All other string values -->
+    <ul><li><a class="ex" data-expected="true" href="/" aria-current="sometext">Nav13</a></li></ul>
+    <ul><li><a class="ex" data-expected="true" href="/" aria-current="page step">Nav14</a></li></ul>
+    <ul><li><a class="ex" data-expected="page" href="/" aria-current="page ">Nav15</a></li></ul>
+    <ul><li><a class="ex" data-expected="step" href="/" aria-current="  step ">Nav16</a></li></ul>
+
+</div>
+
+<script type="text/javascript">
+
+function $(id) {
+    return document.getElementById(id);
+}
+
+function cleanup() {
+    // Hide the test element container to avoid irrelevant output diffs on subsequent updates.
+    $("examples").style.display = "none";
+}
+
+function test() {
+
+    var examples = [];
+    var documentNodeId = null;
+    var bodyNodeId = null;
+
+    function onGotDocument(response) {
+        InspectorProtocol.checkForError(response);
+        documentNodeId = response.result.root.nodeId;
+        InspectorProtocol.sendCommand("DOM.querySelectorAll", {"nodeId": documentNodeId, "selector": ".ex"}, onGotQuerySelectorAll);
+    }
+
+    function onGotQuerySelectorAll(response) {
+        InspectorProtocol.checkForError(response);
+        examples = response.result.nodeIds;
+        ProtocolTest.log("Total elements to be tested: " + examples.length + ".");
+        loop();
+    }
+
+    function loop() {
+        if (examples.length) {
+            InspectorProtocol.sendCommand("DOM.getOuterHTML", {"nodeId": examples[examples.length-1]}, onGotOuterHTML);
+        } else {
+            finishTest();
+        }
+    }
+
+    function onGotOuterHTML(response) {
+        InspectorProtocol.checkForError(response);
+        var outerHTML = response.result.outerHTML;
+        outerHTML = outerHTML.replace(/ class="ex"/g, ""); // remove any duplicated, unnecessary class attributes
+        ProtocolTest.log("\n" + outerHTML);
+        InspectorProtocol.sendCommand("DOM.getAccessibilityPropertiesForNode", {"nodeId": examples[examples.length-1]}, onGotAccessibilityProperties);
+    }
+
+    function onGotAccessibilityProperties(response) {
+        InspectorProtocol.checkForError(response);
+        logAccessibilityProperties(response.result.properties);
+        examples.pop();
+        loop();
+    }
+
+    function logAccessibilityProperties(properties) {
+        for (var key in properties) {
+            var value = properties[key];
+            switch (key){
+            case "current":
+                ProtocolTest.log("    " + key + ": " + value);
+                break;
+            default:
+                continue;
+            }
+        }
+    }
+
+    function finishTest() {
+        InspectorProtocol.sendCommand("Runtime.evaluate", {"expression": "cleanup()"}, function(){
+            ProtocolTest.completeTest();
+        });
+    }
+
+    InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument);
+
+}
+</script>
+</body>
+</html>
\ No newline at end of file
index bab7ef4..bb7a9fc 100644 (file)
@@ -613,6 +613,8 @@ webkit.org/b/146731 fast/hidpi/filters-invert.html [ ImageOnlyFailure ]
 webkit.org/b/146731 fast/hidpi/filters-multiple.html [ ImageOnlyFailure ]
 webkit.org/b/146731 fast/hidpi/filters-reference.html [ ImageOnlyFailure ]
 
+webkit.org/b/149016 accessibility/aria-current.html [ Skip ]
+
 #////////////////////////////////////////////////////////////////////////////////////////
 # End of Expected failures
 #////////////////////////////////////////////////////////////////////////////////////////
index 85c0050..6832fef 100644 (file)
@@ -618,6 +618,9 @@ animations/trigger-parsing.html [ Skip ]
 animations/trigger-container-scroll-simple.html [ Skip ]
 animations/trigger-container-scroll-boundaries.html [ Skip ]
 
+# TODO aria-current is not supported
+webkit.org/b/149018 accessibility/aria-current.html [ Skip ]
+
 ################################################################################
 ###########    End Missing Functionality Prevents Testing         ##############
 ################################################################################
index 4abca50..e061fd5 100644 (file)
@@ -1,3 +1,14 @@
+2015-09-11  Nan Wang  <n_wang@apple.com>
+
+        AX: ARIA 1.1 @aria-current
+        https://bugs.webkit.org/show_bug.cgi?id=146012
+
+        Reviewed by Chris Fleizach.
+
+        Updated inspector to support aria-current.
+
+        * inspector/protocol/DOM.json:
+
 2015-09-11  Sukolsak Sakshuwong  <sukolsak@gmail.com>
 
         Add initial support for floats in WebAsssembly
index b32b4e2..f1880db 100644 (file)
@@ -80,6 +80,7 @@
                 { "name": "checked", "type": "string", "optional": true, "enum": ["true", "false", "mixed"], "description": "Checked state of certain form controls." },
                 { "name": "childNodeIds", "type": "array", "items": { "$ref": "NodeId" }, "optional": true, "description": "Array of <code>DOMNode</code> ids of the accessibility tree children if available." },
                 { "name": "controlledNodeIds", "type": "array", "items": { "$ref": "NodeId" }, "optional": true, "description": "Array of <code>DOMNode</code> ids of any nodes referenced via @aria-controls." },
+                { "name": "current", "type": "string", "optional": true, "enum": ["true", "false", "page", "step", "location", "date", "time"], "description": "Current item within a container or set of related elements." },
                 { "name": "disabled", "type": "boolean", "optional": true, "description": "Disabled state of form controls." },
                 { "name": "exists", "type": "boolean", "description": "Indicates whether there is an existing AX object for the DOM node. If this is false, all the other properties will be default values." },
                 { "name": "expanded", "type": "boolean", "optional": true, "description": "Expanded state." },
index 6d24f9b..f6ce24f 100644 (file)
@@ -1,3 +1,27 @@
+2015-09-11  Nan Wang  <n_wang@apple.com>
+
+        AX: ARIA 1.1 @aria-current
+        https://bugs.webkit.org/show_bug.cgi?id=146012
+
+        Reviewed by Chris Fleizach.
+
+        Tests: accessibility/aria-current.html
+               inspector/dom/getAccessibilityPropertiesForNode_ariaCurrent.html
+
+        Added support for ARIA 1.1 aria-current.
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::invalidStatus):
+        (WebCore::AccessibilityObject::ariaCurrentState):
+        (WebCore::AccessibilityObject::hasTagName):
+        * accessibility/AccessibilityObject.h:
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+        * html/HTMLAttributeNames.in:
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
+
 2015-09-11  Chris Dumez  <cdumez@apple.com>
 
         DOMTokenList update steps for classList don't follow the spec
index 61620b8..02b5b32 100644 (file)
@@ -1820,6 +1820,30 @@ String AccessibilityObject::invalidStatus() const
     return trueValue;
 }
  
+AccessibilityARIACurrentState AccessibilityObject::ariaCurrentState() const
+{
+    // aria-current can return false (default), true, page, step, location, date or time.
+    String currentStateValue = stripLeadingAndTrailingHTMLSpaces(getAttribute(aria_currentAttr));
+    
+    // If "false", empty, or missing, return false state.
+    if (currentStateValue.isEmpty() || currentStateValue == "false")
+        return ARIACurrentFalse;
+    
+    if (currentStateValue == "page")
+        return ARIACurrentPage;
+    if (currentStateValue == "step")
+        return ARIACurrentStep;
+    if (currentStateValue == "location")
+        return ARIACurrentLocation;
+    if (currentStateValue == "date")
+        return ARIACurrentDate;
+    if (currentStateValue == "time")
+        return ARIACurrentTime;
+    
+    // Any value not included in the list of allowed values should be treated as "true".
+    return ARIACurrentTrue;
+}
+
 bool AccessibilityObject::hasTagName(const QualifiedName& tagName) const
 {
     Node* node = this->node();
index a789414..5f0d3c9 100644 (file)
@@ -436,6 +436,8 @@ struct AccessibilitySelectTextCriteria {
 enum AccessibilityMathScriptObjectType { Subscript, Superscript };
 enum AccessibilityMathMultiscriptObjectType { PreSubscript, PreSuperscript, PostSubscript, PostSuperscript };
 
+enum AccessibilityARIACurrentState { ARIACurrentFalse, ARIACurrentTrue, ARIACurrentPage, ARIACurrentStep, ARIACurrentLocation, ARIACurrentDate, ARIACurrentTime };
+
 class AccessibilityObject : public RefCounted<AccessibilityObject> {
 protected:
     AccessibilityObject();
@@ -623,6 +625,7 @@ public:
     String identifierAttribute() const;
     void classList(Vector<String>&) const;
     const AtomicString& roleDescription() const;
+    AccessibilityARIACurrentState ariaCurrentState() const;
     
     bool supportsARIASetSize() const;
     bool supportsARIAPosInSet() const;
index 9d437d9..f3ef827 100644 (file)
@@ -248,6 +248,10 @@ using namespace HTMLNames;
 #define NSAccessibilityDOMIdentifierAttribute @"AXDOMIdentifier"
 #define NSAccessibilityDOMClassListAttribute @"AXDOMClassList"
 
+#ifndef NSAccessibilityARIACurrentAttribute
+#define NSAccessibilityARIACurrentAttribute @"AXARIACurrent"
+#endif
+
 // Search
 #ifndef NSAccessibilityImmediateDescendantsOnly
 #define NSAccessibilityImmediateDescendantsOnly @"AXImmediateDescendantsOnly"
@@ -1696,6 +1700,10 @@ static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, const Visibl
     if ([additionalAttributes count])
         objectAttributes = [objectAttributes arrayByAddingObjectsFromArray:additionalAttributes];
     
+    // Only expose AXARIACurrent attribute when the element is set to be current item.
+    if (m_object->ariaCurrentState() != ARIACurrentFalse)
+        [objectAttributes arrayByAddingObjectsFromArray:@[ NSAccessibilityARIACurrentAttribute ]];
+    
     return objectAttributes;
 }
 
@@ -2870,6 +2878,26 @@ static NSString* roleValueToNSString(AccessibilityRole value)
     if ([attributeName isEqualToString: NSAccessibilitySelectedAttribute])
         return [NSNumber numberWithBool:m_object->isSelected()];
     
+    if ([attributeName isEqualToString: NSAccessibilityARIACurrentAttribute]) {
+        switch (m_object->ariaCurrentState()) {
+        case ARIACurrentFalse:
+            return @"false";
+        case ARIACurrentPage:
+            return @"page";
+        case ARIACurrentStep:
+            return @"step";
+        case ARIACurrentLocation:
+            return @"location";
+        case ARIACurrentTime:
+            return @"time";
+        case ARIACurrentDate:
+            return @"date";
+        default:
+        case ARIACurrentTrue:
+            return @"true";
+        }
+    }
+    
     if ([attributeName isEqualToString: NSAccessibilityServesAsTitleForUIElementsAttribute] && m_object->isMenuButton()) {
         AccessibilityObject* uiElement = downcast<AccessibilityRenderObject>(*m_object).menuForMenuButton();
         if (uiElement)
index 9ed84f0..e4d77a6 100644 (file)
@@ -18,6 +18,7 @@ aria-atomic
 aria-busy
 aria-checked
 aria-controls
+aria-current
 aria-describedby
 aria-disabled
 aria-dropeffect
index 58b2c3b..673244c 100644 (file)
@@ -1523,6 +1523,7 @@ RefPtr<Inspector::Protocol::DOM::AccessibilityProperties> InspectorDOMAgent::bui
     auto checked = Inspector::Protocol::DOM::AccessibilityProperties::Checked::False;
     RefPtr<Inspector::Protocol::Array<int>> childNodeIds;
     RefPtr<Inspector::Protocol::Array<int>> controlledNodeIds;
+    auto currentState = Inspector::Protocol::DOM::AccessibilityProperties::Current::False;
     bool exists = false;
     bool expanded = false;
     bool disabled = false;
@@ -1587,6 +1588,31 @@ RefPtr<Inspector::Protocol::DOM::AccessibilityProperties> InspectorDOMAgent::bui
                         controlledNodeIds->addItem(pushNodePathToFrontend(controlledElement));
                 }
             }
+            
+            switch (axObject->ariaCurrentState()) {
+            case ARIACurrentFalse:
+                currentState = Inspector::Protocol::DOM::AccessibilityProperties::Current::False;
+                break;
+            case ARIACurrentPage:
+                currentState = Inspector::Protocol::DOM::AccessibilityProperties::Current::Page;
+                break;
+            case ARIACurrentStep:
+                currentState = Inspector::Protocol::DOM::AccessibilityProperties::Current::Step;
+                break;
+            case ARIACurrentLocation:
+                currentState = Inspector::Protocol::DOM::AccessibilityProperties::Current::Location;
+                break;
+            case ARIACurrentDate:
+                currentState = Inspector::Protocol::DOM::AccessibilityProperties::Current::Date;
+                break;
+            case ARIACurrentTime:
+                currentState = Inspector::Protocol::DOM::AccessibilityProperties::Current::Time;
+                break;
+            default:
+            case ARIACurrentTrue:
+                currentState = Inspector::Protocol::DOM::AccessibilityProperties::Current::True;
+                break;
+            }
 
             disabled = !axObject->isEnabled(); 
             exists = true;
@@ -1724,6 +1750,8 @@ RefPtr<Inspector::Protocol::DOM::AccessibilityProperties> InspectorDOMAgent::bui
             value->setChildNodeIds(childNodeIds);
         if (controlledNodeIds)
             value->setControlledNodeIds(controlledNodeIds);
+        if (currentState != Inspector::Protocol::DOM::AccessibilityProperties::Current::False)
+            value->setCurrent(currentState);
         if (disabled)
             value->setDisabled(disabled);
         if (supportsExpanded)
index b3c85d8..01616fa 100644 (file)
@@ -1,3 +1,16 @@
+2015-09-11  Nan Wang  <n_wang@apple.com>
+
+        AX: ARIA 1.1 @aria-current
+        https://bugs.webkit.org/show_bug.cgi?id=146012
+
+        Reviewed by Chris Fleizach.
+
+        Added support for ARIA 1.1 aria-current.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Models/DOMNode.js:
+        * UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
+
 2015-09-10  Devin Rousso  <dcrousso+webkit@gmail.com>
 
         Web Inspector: Styles sidebar says Media: all when it should say Media: screen
index a1b9665..8cb6b8c 100644 (file)
Binary files a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js and b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js differ
index c26d1be..0311e7a 100644 (file)
@@ -426,6 +426,7 @@ WebInspector.DOMNode = class DOMNode extends WebInspector.Object
                     checked: accessibilityProperties.checked,
                     childNodeIds: accessibilityProperties.childNodeIds,
                     controlledNodeIds: accessibilityProperties.controlledNodeIds,
+                    current: accessibilityProperties.current,
                     disabled: accessibilityProperties.disabled,
                     exists: accessibilityProperties.exists,
                     expanded: accessibilityProperties.expanded,
index 9a9919a..e617997 100644 (file)
@@ -67,6 +67,7 @@ WebInspector.DOMNodeDetailsSidebarPanel = class DOMNodeDetailsSidebarPanel exten
             this._accessibilityNodeCheckedRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Checked"));
             this._accessibilityNodeChildrenRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Children"));
             this._accessibilityNodeControlsRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Controls"));
+            this._accessibilityNodeCurrentRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Current"));
             this._accessibilityNodeDisabledRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Disabled"));
             this._accessibilityNodeExpandedRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Expanded"));
             this._accessibilityNodeFlowsRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Flows"));
@@ -346,6 +347,31 @@ WebInspector.DOMNodeDetailsSidebarPanel = class DOMNodeDetailsSidebarPanel exten
                 var childNodeLinkList = linkListForNodeIds(accessibilityProperties.childNodeIds);
                 
                 var controlledNodeLinkList = linkListForNodeIds(accessibilityProperties.controlledNodeIds);
+                
+                var current = "";
+                switch (accessibilityProperties.current) {
+                case DOMAgent.AccessibilityPropertiesCurrent.True:
+                    current = WebInspector.UIString("True");
+                    break;
+                case DOMAgent.AccessibilityPropertiesCurrent.Page:
+                    current = WebInspector.UIString("Page");
+                    break;
+                case DOMAgent.AccessibilityPropertiesCurrent.Location:
+                    current = WebInspector.UIString("Location");
+                    break;
+                case DOMAgent.AccessibilityPropertiesCurrent.Step:
+                    current = WebInspector.UIString("Step");
+                    break;
+                case DOMAgent.AccessibilityPropertiesCurrent.Date:
+                    current = WebInspector.UIString("Date");
+                    break;
+                case DOMAgent.AccessibilityPropertiesCurrent.Time:
+                    current = WebInspector.UIString("Time");
+                    break;
+                default:
+                    current = "";
+                }
+                
                 var disabled = booleanValueToLocalizedStringIfTrue("disabled");
                 var expanded = booleanValueToLocalizedStringIfPropertyDefined("expanded");
                 var flowedNodeLinkList = linkListForNodeIds(accessibilityProperties.flowedNodeIds);
@@ -462,6 +488,7 @@ WebInspector.DOMNodeDetailsSidebarPanel = class DOMNodeDetailsSidebarPanel exten
                 this._accessibilityNodeCheckedRow.value = checked;
                 this._accessibilityNodeChildrenRow.value = childNodeLinkList || "";
                 this._accessibilityNodeControlsRow.value = controlledNodeLinkList || "";
+                this._accessibilityNodeCurrentRow.value = current;
                 this._accessibilityNodeDisabledRow.value = disabled;
                 this._accessibilityNodeExpandedRow.value = expanded;
                 this._accessibilityNodeFlowsRow.value = flowedNodeLinkList || "";
@@ -505,6 +532,7 @@ WebInspector.DOMNodeDetailsSidebarPanel = class DOMNodeDetailsSidebarPanel exten
                     this._accessibilityNodeFocusedRow,
                     this._accessibilityNodeBusyRow,
                     this._accessibilityNodeLiveRegionStatusRow,
+                    this._accessibilityNodeCurrentRow,
 
                     // Properties exposed for all input-type elements.
                     this._accessibilityNodeDisabledRow,