Title: [207553] trunk
Revision
207553
Author
commit-qu...@webkit.org
Date
2016-10-19 11:59:23 -0700 (Wed, 19 Oct 2016)

Log Message

Web Inspector: AXI: expose computed tree node and heading level
https://bugs.webkit.org/show_bug.cgi?id=130825
<rdar://problem/16442349>

Patch by Aaron Chu <aaron_...@apple.com> on 2016-10-19
Reviewed by Joseph Pecoraro.

Source/_javascript_Core:

Exposing two new accessibility properties: Heading Level and Hierarchical Level.

* inspector/protocol/DOM.json:

Source/WebCore:

Exposing two new accessibility properties: Heading Level and Hierarchical Level.

Updated Test: LayoutTest/inspector/dom/getAccessibilityPropertiesForNode.html

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):

Source/WebInspectorUI:

Updating the Web Accessibility Inspector to display Heading Level and Hierarchical Level.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Models/DOMNode.js:
(WebInspector.DOMNode.prototype.accessibilityProperties.accessibilityPropertiesCallback):
(WebInspector.DOMNode.prototype.accessibilityProperties):
* UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
(WebInspector.DOMNodeDetailsSidebarPanel):
(WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshAccessibility.accessibilityPropertiesCallback):
(WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshAccessibility):

LayoutTests:

Included logging of the two newly exposed accessibility properties:
Heading Level and Hierarchical Level.

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

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (207552 => 207553)


--- trunk/LayoutTests/ChangeLog	2016-10-19 18:56:43 UTC (rev 207552)
+++ trunk/LayoutTests/ChangeLog	2016-10-19 18:59:23 UTC (rev 207553)
@@ -1,3 +1,17 @@
+2016-10-19  Aaron Chu  <aaron_...@apple.com>
+
+        Web Inspector: AXI: expose computed tree node and heading level
+        https://bugs.webkit.org/show_bug.cgi?id=130825
+        <rdar://problem/16442349>
+
+        Reviewed by Joseph Pecoraro.
+
+        Included logging of the two newly exposed accessibility properties:
+        Heading Level and Hierarchical Level.
+
+        * inspector/dom/getAccessibilityPropertiesForNode-expected.txt:
+        * inspector/dom/getAccessibilityPropertiesForNode.html:
+
 2016-10-19  Zalan Bujtas  <za...@apple.com>
 
         Use anonymous table row for new child at RenderTableRow::addChild() if available.

Modified: trunk/LayoutTests/inspector/dom/getAccessibilityPropertiesForNode-expected.txt (207552 => 207553)


--- trunk/LayoutTests/inspector/dom/getAccessibilityPropertiesForNode-expected.txt	2016-10-19 18:56:43 UTC (rev 207552)
+++ trunk/LayoutTests/inspector/dom/getAccessibilityPropertiesForNode-expected.txt	2016-10-19 18:59:23 UTC (rev 207553)
@@ -4,10 +4,10 @@
     exists: true
     label: 
     role: 
-    childNodeIds.length: 43
+    childNodeIds.length: 52
 
 
-Total elements to be tested: 65.
+Total elements to be tested: 81.
 
 <div _onclick_="void(0);">click</div>
     exists: true
@@ -17,6 +17,159 @@
     mouseEventNodeId: exists
     parentNodeId: exists
 
+<li role="treeitem">Tree Item Level 2</li>
+    exists: true
+    label: 
+    role: treeitem
+    childNodeIds.length: 1
+    parentNodeId: exists
+    hierarchyLevel: 2
+
+<ul>
+            <li role="treeitem">Tree Item Level 2</li>
+        </ul>
+    exists: true
+    label: 
+    role: group
+    childNodeIds.length: 1
+    parentNodeId: exists
+
+<li role="treeitem">
+        <span>Tree Item Level 1</span>
+        <ul>
+            <li role="treeitem">Tree Item Level 2</li>
+        </ul>
+    </li>
+    exists: true
+    label: 
+    role: treeitem
+    childNodeIds.length: 2
+    parentNodeId: exists
+    hierarchyLevel: 1
+
+<ul role="tree">
+    <li role="treeitem">
+        <span>Tree Item Level 1</span>
+        <ul>
+            <li role="treeitem">Tree Item Level 2</li>
+        </ul>
+    </li>
+</ul>
+    exists: true
+    label: 
+    role: tree
+    childNodeIds.length: 1
+    parentNodeId: exists
+
+<li aria-level="1">List Item Level 1</li>
+    exists: true
+    label: 
+    role: listitem
+    childNodeIds.length: 1
+    parentNodeId: exists
+    hierarchyLevel: 1
+
+<li aria-level="2">List Item Level 2</li>
+    exists: true
+    label: 
+    role: listitem
+    childNodeIds.length: 1
+    parentNodeId: exists
+    hierarchyLevel: 2
+
+<ol>
+            <li aria-level="2">List Item Level 2</li>
+        </ol>
+    exists: true
+    label: 
+    role: list
+    childNodeIds.length: 1
+    parentNodeId: exists
+
+<li aria-level="1">
+        <span>List Item Level 1</span>
+        <ol>
+            <li aria-level="2">List Item Level 2</li>
+        </ol>
+    </li>
+    exists: true
+    label: 
+    role: listitem
+    childNodeIds.length: 2
+    parentNodeId: exists
+    hierarchyLevel: 1
+
+<ul>
+    <li aria-level="1">
+        <span>List Item Level 1</span>
+        <ol>
+            <li aria-level="2">List Item Level 2</li>
+        </ol>
+    </li>
+    <li aria-level="1">List Item Level 1</li>
+</ul>
+    exists: true
+    label: 
+    role: list
+    childNodeIds.length: 2
+    parentNodeId: exists
+
+<h1 style="color: red;" aria-level="8">H1</h1>
+    exists: true
+    label: H1
+    role: heading
+    childNodeIds.length: 1
+    parentNodeId: exists
+    headingLevel: 8
+
+<h6>H6</h6>
+    exists: true
+    label: H6
+    role: heading
+    childNodeIds.length: 1
+    parentNodeId: exists
+    headingLevel: 6
+
+<h5>H5</h5>
+    exists: true
+    label: H5
+    role: heading
+    childNodeIds.length: 1
+    parentNodeId: exists
+    headingLevel: 5
+
+<h4>H4</h4>
+    exists: true
+    label: H4
+    role: heading
+    childNodeIds.length: 1
+    parentNodeId: exists
+    headingLevel: 4
+
+<h3>H3</h3>
+    exists: true
+    label: H3
+    role: heading
+    childNodeIds.length: 1
+    parentNodeId: exists
+    headingLevel: 3
+
+<h2>H2</h2>
+    exists: true
+    label: H2
+    role: heading
+    childNodeIds.length: 1
+    parentNodeId: exists
+    headingLevel: 2
+
+<h1>H1</h1>
+    exists: true
+    label: H1
+    role: heading
+    childNodeIds.length: 1
+    parentNodeId: exists
+    headingLevel: 1
+
 <li role="treeitem" aria-expanded="undefined">expanded</li>
     exists: true
     label: 
@@ -23,6 +176,7 @@
     role: treeitem
     childNodeIds.length: 1
     parentNodeId: exists
+    hierarchyLevel: 1
 
 <li role="treeitem" aria-expanded="false" id="activedescendant" aria-selected="true">collapsed</li>
     exists: true
@@ -32,6 +186,7 @@
     expanded: false
     parentNodeId: exists
     selected: true
+    hierarchyLevel: 1
 
 <li role="treeitem" aria-expanded="true">expanded</li>
     exists: true
@@ -40,6 +195,7 @@
     childNodeIds.length: 1
     expanded: true
     parentNodeId: exists
+    hierarchyLevel: 1
 
 <ul role="tree" id="flowedTo1" aria-activedescendant="activedescendant">
     <li role="treeitem" aria-expanded="true">expanded</li>

Modified: trunk/LayoutTests/inspector/dom/getAccessibilityPropertiesForNode.html (207552 => 207553)


--- trunk/LayoutTests/inspector/dom/getAccessibilityPropertiesForNode.html	2016-10-19 18:56:43 UTC (rev 207552)
+++ trunk/LayoutTests/inspector/dom/getAccessibilityPropertiesForNode.html	2016-10-19 18:59:23 UTC (rev 207553)
@@ -118,6 +118,37 @@
     <li class="ex" role="treeitem" aria-expanded="undefined">expanded</li>
 </ul>
 
+<div>
+<h1 class="ex">H1</h1>
+<h2 class="ex">H2</h2>
+<h3 class="ex">H3</h3>
+<h4 class="ex">H4</h4>
+<h5 class="ex">H5</h5>
+<h6 class="ex">H6</h6>
+
+<h1  class="ex" style="color: red;" aria-level="8">H1</h1>
+
+<ul class="ex">
+    <li class="ex" aria-level="1">
+        <span>List Item Level 1</span>
+        <ol class="ex">
+            <li class="ex" aria-level="2">List Item Level 2</li>
+        </ol>
+    </li>
+    <li class="ex" aria-level="1">List Item Level 1</li>
+</ul>
+
+<ul class="ex" role="tree">
+    <li class="ex" role="treeitem">
+        <span>Tree Item Level 1</span>
+        <ul class="ex">
+            <li class="ex" role="treeitem">Tree Item Level 2</li>
+        </ul>
+    </li>
+</ul>
+
+</div>
+
 <!-- Full test of mouseEventNodeId in getAccessibilityPropertiesForNode_mouseEventNodeId.html. -->
 <div class="ex" _onclick_="void(0);">click</div>
 

Modified: trunk/Source/_javascript_Core/ChangeLog (207552 => 207553)


--- trunk/Source/_javascript_Core/ChangeLog	2016-10-19 18:56:43 UTC (rev 207552)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-10-19 18:59:23 UTC (rev 207553)
@@ -1,3 +1,15 @@
+2016-10-19  Aaron Chu  <aaron_...@apple.com>
+
+        Web Inspector: AXI: expose computed tree node and heading level
+        https://bugs.webkit.org/show_bug.cgi?id=130825
+        <rdar://problem/16442349>
+
+        Reviewed by Joseph Pecoraro.
+
+        Exposing two new accessibility properties: Heading Level and Hierarchical Level.
+
+        * inspector/protocol/DOM.json:
+
 2016-10-18  Filip Pizlo  <fpi...@apple.com>
 
         DFG worklist should use AutomaticThread

Modified: trunk/Source/_javascript_Core/inspector/protocol/DOM.json (207552 => 207553)


--- trunk/Source/_javascript_Core/inspector/protocol/DOM.json	2016-10-19 18:56:43 UTC (rev 207552)
+++ trunk/Source/_javascript_Core/inspector/protocol/DOM.json	2016-10-19 18:59:23 UTC (rev 207553)
@@ -89,6 +89,8 @@
                 { "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": "headingLevel", "type": "number", "optional": true, "description": "Heading level of a heading element." },
+                { "name": "hierarchyLevel", "type": "number", "optional": true, "description": "The hierarchical level of an element." },
                 { "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." },
                 { "name": "flowedNodeIds", "type": "array", "items": { "$ref": "NodeId" }, "optional": true, "description": "Array of <code>DOMNode</code> ids of any nodes referenced via @aria-flowto." },

Modified: trunk/Source/WebCore/ChangeLog (207552 => 207553)


--- trunk/Source/WebCore/ChangeLog	2016-10-19 18:56:43 UTC (rev 207552)
+++ trunk/Source/WebCore/ChangeLog	2016-10-19 18:59:23 UTC (rev 207553)
@@ -1,3 +1,18 @@
+2016-10-19  Aaron Chu  <aaron_...@apple.com>
+
+        Web Inspector: AXI: expose computed tree node and heading level
+        https://bugs.webkit.org/show_bug.cgi?id=130825
+        <rdar://problem/16442349>
+
+        Reviewed by Joseph Pecoraro.
+
+        Exposing two new accessibility properties: Heading Level and Hierarchical Level.
+
+        Updated Test: LayoutTest/inspector/dom/getAccessibilityPropertiesForNode.html
+
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
+
 2016-10-19  Adam Bergkvist  <adam.bergkv...@ericsson.com>
 
         WebRTC: Implement MediaEndpointPeerConnection::stop()

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (207552 => 207553)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2016-10-19 18:56:43 UTC (rev 207552)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2016-10-19 18:59:23 UTC (rev 207553)
@@ -1599,6 +1599,9 @@
     bool supportsPressed = false;
     bool supportsRequired = false;
     bool supportsFocused = false;
+    int headingLevel = 0;
+    unsigned hierarchicalLevel = 0;
+    unsigned level = 0;
 
     if (AXObjectCache* axObjectCache = node->document().axObjectCache()) {
         if (AccessibilityObject* axObject = axObjectCache->getOrCreate(node)) {
@@ -1772,6 +1775,11 @@
                         selectedChildNodeIds->addItem(pushNodePathToFrontend(selectedChildNode));
                 }
             }
+            
+            headingLevel = axObject->headingLevel();
+            hierarchicalLevel = axObject->hierarchicalLevel();
+            
+            level = hierarchicalLevel ? hierarchicalLevel : headingLevel;
         }
     }
     
@@ -1833,6 +1841,15 @@
             value->setSelected(selected);
         if (selectedChildNodeIds)
             value->setSelectedChildNodeIds(selectedChildNodeIds);
+        
+        // H1 -- H6 always have a headingLevel property that can be complimented by a hierarchicalLevel
+        // property when aria-level is set on the element, in which case we want to remain calling
+        // this value the "Heading Level" in the inspector.
+        // Also, we do not want it to say Hierarchy Level: 0
+        if (headingLevel)
+            value->setHeadingLevel(level);
+        else if (level)
+            value->setHierarchyLevel(level);
     }
 
     return WTFMove(value);

Modified: trunk/Source/WebInspectorUI/ChangeLog (207552 => 207553)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-10-19 18:56:43 UTC (rev 207552)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-10-19 18:59:23 UTC (rev 207553)
@@ -1,3 +1,22 @@
+2016-10-19  Aaron Chu  <aaron_...@apple.com>
+
+        Web Inspector: AXI: expose computed tree node and heading level
+        https://bugs.webkit.org/show_bug.cgi?id=130825
+        <rdar://problem/16442349>
+
+        Reviewed by Joseph Pecoraro.
+
+        Updating the Web Accessibility Inspector to display Heading Level and Hierarchical Level.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Models/DOMNode.js:
+        (WebInspector.DOMNode.prototype.accessibilityProperties.accessibilityPropertiesCallback):
+        (WebInspector.DOMNode.prototype.accessibilityProperties):
+        * UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
+        (WebInspector.DOMNodeDetailsSidebarPanel):
+        (WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshAccessibility.accessibilityPropertiesCallback):
+        (WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshAccessibility):
+
 2016-10-18  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: Styles Sidebar highlights "translate" but not "translateX"

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (207552 => 207553)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2016-10-19 18:56:43 UTC (rev 207552)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2016-10-19 18:59:23 UTC (rev 207553)
@@ -393,6 +393,8 @@
 localizedStrings["HTTP"] = "HTTP";
 localizedStrings["Heap Snapshot Object (@%d)"] = "Heap Snapshot Object (@%d)";
 localizedStrings["Height"] = "Height";
+localizedStrings["Heading Level"] = "Heading Level";
+localizedStrings["Hierarchy Level"] = "Hierarchy Level";
 localizedStrings["Hide compositing borders"] = "Hide compositing borders";
 localizedStrings["Hide shadow DOM nodes"] = "Hide shadow DOM nodes";
 localizedStrings["Hide the details sidebar (%s)"] = "Hide the details sidebar (%s)";

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js (207552 => 207553)


--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js	2016-10-19 18:56:43 UTC (rev 207552)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js	2016-10-19 18:59:23 UTC (rev 207553)
@@ -517,6 +517,8 @@
                     ignored: accessibilityProperties.ignored,
                     ignoredByDefault: accessibilityProperties.ignoredByDefault,
                     invalid: accessibilityProperties.invalid,
+                    headingLevel: accessibilityProperties.headingLevel,
+                    hierarchyLevel: accessibilityProperties.hierarchyLevel,
                     hidden: accessibilityProperties.hidden,
                     label: accessibilityProperties.label,
                     liveRegionAtomic: accessibilityProperties.liveRegionAtomic,

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js (207552 => 207553)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js	2016-10-19 18:56:43 UTC (rev 207552)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js	2016-10-19 18:59:23 UTC (rev 207553)
@@ -73,6 +73,8 @@
             this._accessibilityNodeExpandedRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Expanded"));
             this._accessibilityNodeFlowsRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Flows"));
             this._accessibilityNodeFocusedRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Focused"));
+            this._accessibilityNodeHeadingLevelRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Heading Level"));
+            this._accessibilityNodehierarchyLevelRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Hierarchy Level"));
             this._accessibilityNodeIgnoredRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Ignored"));
             this._accessibilityNodeInvalidRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Invalid"));
             this._accessibilityNodeLiveRegionStatusRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Live"));
@@ -501,6 +503,8 @@
                 var selected = booleanValueToLocalizedStringIfTrue("selected");
                 var selectedChildNodeLinkList = linkListForNodeIds(accessibilityProperties.selectedChildNodeIds);
 
+                var headingLevel = accessibilityProperties.headingLevel;
+                var hierarchyLevel = accessibilityProperties.hierarchyLevel;
                 // Assign all the properties to their respective views.
                 this._accessibilityNodeActiveDescendantRow.value = activeDescendantLink || "";
                 this._accessibilityNodeBusyRow.value = busy;
@@ -512,6 +516,8 @@
                 this._accessibilityNodeExpandedRow.value = expanded;
                 this._accessibilityNodeFlowsRow.value = flowedNodeLinkList || "";
                 this._accessibilityNodeFocusedRow.value = focused;
+                this._accessibilityNodeHeadingLevelRow.value = headingLevel || "";
+                this._accessibilityNodehierarchyLevelRow.value = hierarchyLevel || "";
                 this._accessibilityNodeIgnoredRow.value = ignored;
                 this._accessibilityNodeInvalidRow.value = invalid;
                 this._accessibilityNodeLabelRow.value = label;
@@ -549,6 +555,8 @@
                     this._accessibilityNodeFlowsRow,
                     this._accessibilityNodeMouseEventRow,
                     this._accessibilityNodeFocusedRow,
+                    this._accessibilityNodeHeadingLevelRow,
+                    this._accessibilityNodehierarchyLevelRow,
                     this._accessibilityNodeBusyRow,
                     this._accessibilityNodeLiveRegionStatusRow,
                     this._accessibilityNodeCurrentRow,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to