Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityModel.js

Issue 2322413003: Show ancestor hierarchy in accessibility panel (Closed)
Patch Set: Add new test for ancestors Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 /** 6 /**
7 * @constructor 7 * @constructor
8 * @extends {WebInspector.SDKModel} 8 * @extends {WebInspector.SDKModel}
9 * @param {!WebInspector.Target} target 9 * @param {!WebInspector.Target} target
10 */ 10 */
11 WebInspector.AccessibilityModel = function(target) 11 WebInspector.AccessibilityModel = function(target)
12 { 12 {
13 WebInspector.SDKModel.call(this, WebInspector.AccessibilityModel, target); 13 WebInspector.SDKModel.call(this, WebInspector.AccessibilityModel, target);
14 this._agent = target.accessibilityAgent(); 14 this._agent = target.accessibilityAgent();
15 }; 15 };
16 16
17 WebInspector.AccessibilityModel.prototype = { 17 WebInspector.AccessibilityModel.prototype = {
18 /** 18 /**
19 * @param {!DOMAgent.NodeId} nodeId 19 * @param {!DOMAgent.NodeId} nodeId
20 * @return {!Promise.<?AccessibilityAgent.AXNode>} 20 * @return {!Promise.<?Array<!AccessibilityAgent.AXNode>>}
21 */ 21 */
22 getAXNode: function(nodeId) 22 getAXNodeChain: function(nodeId)
23 { 23 {
24 /** 24 /**
25 * @param {?string} error 25 * @param {?string} error
26 * @param {!AccessibilityAgent.AXNode=} value 26 * @param {!Array<!AccessibilityAgent.AXNode>=} nodes
27 * @return {?Array<!AccessibilityAgent.AXNode>}
27 */ 28 */
28 function parsePayload(error, value) 29 function parsePayload(error, nodes)
29 { 30 {
30 if (error) 31 if (error)
31 console.error("AccessibilityAgent.getAXNode(): " + error); 32 console.error("AccessibilityAgent.getAXNodeChain(): " + error);
32 return value || null; 33 return nodes || null;
33 } 34 }
34 return this._agent.getAXNode(nodeId, parsePayload); 35 return this._agent.getAXNodeChain(nodeId, true, parsePayload);
35 }, 36 },
36 37
37 __proto__: WebInspector.SDKModel.prototype 38 __proto__: WebInspector.SDKModel.prototype
38 } 39 }
39 40
40 WebInspector.AccessibilityModel._symbol = Symbol("AccessibilityModel"); 41 WebInspector.AccessibilityModel._symbol = Symbol("AccessibilityModel");
41 /** 42 /**
42 * @param {!WebInspector.Target} target 43 * @param {!WebInspector.Target} target
43 * @return {!WebInspector.AccessibilityModel} 44 * @return {!WebInspector.AccessibilityModel}
44 */ 45 */
45 WebInspector.AccessibilityModel.fromTarget = function(target) 46 WebInspector.AccessibilityModel.fromTarget = function(target)
46 { 47 {
47 if (!target[WebInspector.AccessibilityModel._symbol]) 48 if (!target[WebInspector.AccessibilityModel._symbol])
48 target[WebInspector.AccessibilityModel._symbol] = new WebInspector.Acces sibilityModel(target); 49 target[WebInspector.AccessibilityModel._symbol] = new WebInspector.Acces sibilityModel(target);
49 50
50 return target[WebInspector.AccessibilityModel._symbol]; 51 return target[WebInspector.AccessibilityModel._symbol];
51 } 52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698