Web Inspector: AXI: expose selectedChildNodeIds of list boxes, tree controls, etc...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Mar 2014 06:00:39 +0000 (06:00 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Mar 2014 06:00:39 +0000 (06:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=130827

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

Source/WebCore:

Test: inspector-protocol/dom/getAccessibilityPropertiesForNode.html

Support for selectedChildNodeIds in inspector-protocol: DOM.getAccessibilityPropertiesForNode.

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
* inspector/protocol/DOM.json:

Source/WebInspectorUI:

UI updates for "Selected Item(s)" and "Child(ren)" rows in accessibility node inspector.

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

Websites/webkit.org:

Updated demo files with attr refresh to show off selected children changing.
Long term fix will be http://webkit.org/b/130883

* blog-files/aria1.0/combobox_with_live_region_status.html:

LayoutTests:

Tests selectedChildNodeIds in inspector-protocol: DOM.getAccessibilityPropertiesForNode.

* inspector-protocol/dom/getAccessibilityPropertiesForNode-expected.txt:
* inspector-protocol/dom/getAccessibilityPropertiesForNode.html:

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector-protocol/dom/getAccessibilityPropertiesForNode-expected.txt
LayoutTests/inspector-protocol/dom/getAccessibilityPropertiesForNode.html
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/inspector/protocol/DOM.json
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Models/DOMNode.js
Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js
Websites/webkit.org/ChangeLog
Websites/webkit.org/blog-files/aria1.0/combobox_with_live_region_status.html

index cb4dd3e..80b64bd 100644 (file)
@@ -1,3 +1,15 @@
+2014-03-27  James Craig  <jcraig@apple.com>
+
+        Web Inspector: AXI: expose selectedChildNodeIds of list boxes, tree controls, etc., and reconcile UI with childNodeIds
+        https://bugs.webkit.org/show_bug.cgi?id=130827
+
+        Reviewed by Timothy Hatcher.
+
+        Tests selectedChildNodeIds in inspector-protocol: DOM.getAccessibilityPropertiesForNode.
+
+        * inspector-protocol/dom/getAccessibilityPropertiesForNode-expected.txt:
+        * inspector-protocol/dom/getAccessibilityPropertiesForNode.html:
+
 2014-03-27  Mark Rowe  <mrowe@apple.com>
 
         <https://webkit.org/b/42704> WebKitTestRunner needs to print history delegate information
index 27a7051..ef5a5df 100644 (file)
@@ -4,10 +4,10 @@ Checking Web Inspector protocol for the Accessibility Node Inspector.
     exists: true
     label: 
     role: 
-    childNodeIds.length: 19
+    childNodeIds.length: 20
 
 
-Total elements to be tested: 57.
+Total elements to be tested: 58.
 
 <li role="treeitem" aria-expanded="undefined">expanded</li>
     exists: true
@@ -16,13 +16,14 @@ Total elements to be tested: 57.
     childNodeIds.length: 1
     parentNodeId: exists
 
-<li role="treeitem" aria-expanded="false" id="activedescendant">collapsed</li>
+<li role="treeitem" aria-expanded="false" id="activedescendant" aria-selected="true">collapsed</li>
     exists: true
     label: 
     role: treeitem
     childNodeIds.length: 1
     expanded: false
     parentNodeId: exists
+    selected: true
 
 <li role="treeitem" aria-expanded="true">expanded</li>
     exists: true
@@ -34,7 +35,7 @@ Total elements to be tested: 57.
 
 <ul role="tree" id="flowedTo1" aria-activedescendant="activedescendant">
     <li role="treeitem" aria-expanded="true">expanded</li>
-    <li role="treeitem" aria-expanded="false" id="activedescendant">collapsed</li>
+    <li role="treeitem" aria-expanded="false" id="activedescendant" aria-selected="true">collapsed</li>
     <li role="treeitem" aria-expanded="undefined">expanded</li>
 </ul>
     exists: true
@@ -43,6 +44,20 @@ Total elements to be tested: 57.
     activeDescendantNodeId: exists
     childNodeIds.length: 3
     parentNodeId: exists
+    selectedChildNodeIds.length: 1
+
+<div role="listbox" aria-multiselectable="true">
+    <div role="option" aria-selected="true">selected</div>
+    <div role="option" aria-selected="false">not selected</div>
+    <div role="option" aria-selected="true">selected</div>
+</div>
+    exists: true
+    label: 
+    role: listbox
+    childNodeIds.length: 3
+    parentNodeId: exists
+    required: false
+    selectedChildNodeIds.length: 2
 
 <div role="tab" aria-selected="false">not selected</div>
     exists: true
@@ -91,6 +106,7 @@ Total elements to be tested: 57.
     childNodeIds.length: 2
     parentNodeId: exists
     required: false
+    selectedChildNodeIds.length: 1
 
 <input role="combobox" aria-owns="ownedlistbox invalidIdRef" aria-controls="ownedlistbox invalidIdRef">
     exists: true
index 675259c..ef25871 100644 (file)
     <div class="ex" role="tab" aria-selected="false">not selected</div>
 </div>
 
+<div role="listbox" class="ex" aria-multiselectable="true">
+    <div role="option" aria-selected="true">selected</div>
+    <div role="option" aria-selected="false">not selected</div>
+    <div role="option" aria-selected="true">selected</div>
+</div>
+
 <ul role="tree" class="ex" id="flowedTo1" aria-activedescendant="activedescendant">
     <li class="ex" role="treeitem" aria-expanded="true">expanded</li>
-    <li class="ex" role="treeitem" aria-expanded="false" id="activedescendant">collapsed</li>
+    <li class="ex" role="treeitem" aria-expanded="false" id="activedescendant" aria-selected="true">collapsed</li>
     <li class="ex" role="treeitem" aria-expanded="undefined">expanded</li>
 </ul>
 
@@ -175,6 +181,7 @@ function test() {
             case "controlledNodeIds":
             case "flowedNodeIds":
             case "ownedNodeIds":
+            case "selectedChildNodeIds":
                 if (typeof value === "object" && value.length)
                     InspectorTest.log("    " + key + ".length: " + value.length);
                 break;
index e1df468..b2d1df3 100644 (file)
@@ -1,3 +1,18 @@
+2014-03-27  James Craig  <jcraig@apple.com>
+
+        Web Inspector: AXI: expose selectedChildNodeIds of list boxes, tree controls, etc., and reconcile UI with childNodeIds
+        https://bugs.webkit.org/show_bug.cgi?id=130827
+
+        Reviewed by Timothy Hatcher.
+
+        Test: inspector-protocol/dom/getAccessibilityPropertiesForNode.html
+
+        Support for selectedChildNodeIds in inspector-protocol: DOM.getAccessibilityPropertiesForNode.
+
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
+        * inspector/protocol/DOM.json:
+
 2014-03-27  Brent Fulgham  <bfulgham@apple.com>
 
         Specify Shadow DOM Pseudo IDs in Media Element Constructors
index 6e30909..b9504a4 100644 (file)
@@ -1445,6 +1445,7 @@ PassRefPtr<TypeBuilder::DOM::AccessibilityProperties> InspectorDOMAgent::buildOb
     bool required = false;
     String role;
     bool selected = false;
+    RefPtr<Inspector::TypeBuilder::Array<int>> selectedChildNodeIds;
     bool supportsChecked = false;
     bool supportsExpanded = false;
     bool supportsPressed = false;
@@ -1552,6 +1553,16 @@ PassRefPtr<TypeBuilder::DOM::AccessibilityProperties> InspectorDOMAgent::buildOb
             
             role = axObject->computedRoleString();
             selected = axObject->isSelected();
+
+            AccessibilityObject::AccessibilityChildrenVector selectedChildren;
+            axObject->selectedChildren(selectedChildren);
+            if (selectedChildren.size()) {
+                selectedChildNodeIds = Inspector::TypeBuilder::Array<int>::create();
+                for (auto& selectedChildObject : selectedChildren) {
+                    if (Node* selectedChildNode = selectedChildObject->node())
+                        selectedChildNodeIds->addItem(pushNodePathToFrontend(selectedChildNode));
+                }
+            }
         }
     }
     
@@ -1598,6 +1609,8 @@ PassRefPtr<TypeBuilder::DOM::AccessibilityProperties> InspectorDOMAgent::buildOb
             value->setRequired(required);
         if (selected)
             value->setSelected(selected);
+        if (selectedChildNodeIds)
+            value->setSelectedChildNodeIds(selectedChildNodeIds);
     }
 
     return value.release();
index 7687440..6fcaac1 100644 (file)
@@ -81,7 +81,8 @@
                 { "name": "readonly", "type": "boolean", "optional": true, "description": "Readonly state of text controls." },
                 { "name": "required", "type": "boolean", "optional": true, "description": "Required state of form controls." },
                 { "name": "role", "type": "string", "description": "Computed value for first recognized role token, default role per element, or overridden role." },
-                { "name": "selected", "type": "boolean", "optional": true, "description": "Selected state of certain form controls." }
+                { "name": "selected", "type": "boolean", "optional": true, "description": "Selected state of certain form controls." },
+                { "name": "selectedChildNodeIds", "type": "array", "items": { "$ref": "NodeId" }, "optional": true, "description": "Array of <code>DOMNode</code> ids of any children marked as selected." }
             ]
         },
         {
index 1795137..83acff1 100644 (file)
@@ -1,3 +1,16 @@
+2014-03-27  James Craig  <jcraig@apple.com>
+
+        Web Inspector: AXI: expose selectedChildNodeIds of list boxes, tree controls, etc., and reconcile UI with childNodeIds
+        https://bugs.webkit.org/show_bug.cgi?id=130827
+
+        Reviewed by Timothy Hatcher.
+
+        UI updates for "Selected Item(s)" and "Child(ren)" rows in accessibility node inspector.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Models/DOMNode.js:
+        * UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
+
 2014-03-27  Antoine Quint  <graouts@webkit.org>
 
         Web Inspector: clearing the console log doesn't update the activity viewer
index 8420422..d421234 100644 (file)
Binary files a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js and b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js differ
index 1c985a6..15d4853 100644 (file)
@@ -476,7 +476,8 @@ WebInspector.DOMNode.prototype = {
                     readonly: accessibilityProperties.readonly,
                     required: accessibilityProperties.required,
                     role: accessibilityProperties.role,
-                    selected: accessibilityProperties.selected
+                    selected: accessibilityProperties.selected,
+                    selectedChildNodeIds: accessibilityProperties.selectedChildNodeIds
                 });
             }
         }
index fd2995f..4c9992a 100644 (file)
@@ -76,6 +76,7 @@ WebInspector.DOMNodeDetailsSidebarPanel = function() {
         this._accessibilityNodeRequiredRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Required"));
         this._accessibilityNodeRoleRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Role"));
         this._accessibilityNodeSelectedRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Selected"));
+        this._accessibilityNodeSelectedChildrenRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Selected Items"));
     
         this._accessibilityGroup = new WebInspector.DetailsSectionGroup([this._accessibilityEmptyRow]);
         var accessibilitySection = new WebInspector.DetailsSection("dom-node-accessibility", WebInspector.UIString("Accessibility"), [this._accessibilityGroup]);    
@@ -380,6 +381,7 @@ WebInspector.DOMNodeDetailsSidebarPanel.prototype = {
                 }
 
                 var selected = booleanValueToLocalizedStringIfTrue("selected");
+                var selectedChildNodeLinkList = linkListForNodeIds(accessibilityProperties.selectedChildNodeIds);
 
                 // Assign all the properties to their respective views.
                 this._accessibilityNodeActiveDescendantRow.value = activeDescendantLink || "";
@@ -401,6 +403,11 @@ WebInspector.DOMNodeDetailsSidebarPanel.prototype = {
                 this._accessibilityNodeRoleRow.value = role;
                 this._accessibilityNodeSelectedRow.value = selected;
 
+                this._accessibilityNodeSelectedChildrenRow.label = WebInspector.UIString("Selected Items");
+                this._accessibilityNodeSelectedChildrenRow.value = selectedChildNodeLinkList || "";
+                if (selectedChildNodeLinkList && accessibilityProperties.selectedChildNodeIds.length === 1)
+                    this._accessibilityNodeSelectedChildrenRow.label = WebInspector.UIString("Selected Item");                
+
                 // Display order, not alphabetical as above.
                 this._accessibilityGroup.rows = [
                     // Global properties for all elements.
@@ -408,8 +415,9 @@ WebInspector.DOMNodeDetailsSidebarPanel.prototype = {
                     this._accessibilityNodeRoleRow,
                     this._accessibilityNodeLabelRow,
                     this._accessibilityNodeParentRow,
-                    this._accessibilityNodeChildrenRow,
                     this._accessibilityNodeActiveDescendantRow,
+                    this._accessibilityNodeSelectedChildrenRow,
+                    this._accessibilityNodeChildrenRow,
                     this._accessibilityNodeOwnsRow,
                     this._accessibilityNodeControlsRow,
                     this._accessibilityNodeFlowsRow,
index 9df4cb0..ea8613d 100644 (file)
@@ -1,3 +1,15 @@
+2014-03-27  James Craig  <jcraig@apple.com>
+
+        Web Inspector: AXI: expose selectedChildNodeIds of list boxes, tree controls, etc., and reconcile UI with childNodeIds
+        https://bugs.webkit.org/show_bug.cgi?id=130827
+
+        Reviewed by Timothy Hatcher.
+
+        Updated demo files with attr refresh to show off selected children changing. 
+        Long term fix will be http://webkit.org/b/130883
+
+        * blog-files/aria1.0/combobox_with_live_region_status.html:
+
 2014-03-25  James Craig  <jcraig@apple.com>
 
         Blog-files: combobox demo needs aria-expanded support
index f20902e..24fd9db 100644 (file)
         var clearSelectedOption = function (){
             if (selectedOption) {
                 field.removeAttribute('aria-activedescendant');
+                list.removeAttribute('data-selection');
                 selectedOption.removeAttribute('aria-selected');
             }
             selectedOption = null;
             }
             if (selectedOption) selectedOption.removeAttribute('aria-selected');
             selectedOption = el;
+            list.setAttribute('data-selection', el.id);
             el.setAttribute('aria-selected', 'true');
             field.setAttribute('aria-activedescendant', el.id);
         };