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

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

Issue 2058323002: Add ARIA panel to accessibility sidebar pane (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test scaffolding and test Created 4 years, 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 * @constructor 6 * @constructor
7 * @extends {WebInspector.ThrottledWidget} 7 * @extends {WebInspector.ThrottledWidget}
8 */ 8 */
9 WebInspector.AccessibilitySidebarView = function() 9 WebInspector.AccessibilitySidebarView = function()
10 { 10 {
11 WebInspector.ThrottledWidget.call(this); 11 WebInspector.ThrottledWidget.call(this);
12 this._axNodeSubPane = null; 12 this._axNodeSubPane = null;
13 this._ariaSubPane = null;
13 this._node = null; 14 this._node = null;
14 this._sidebarPaneStack = null; 15 this._sidebarPaneStack = null;
15 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._pul lNode, this); 16 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._pul lNode, this);
16 this._pullNode(); 17 this._pullNode();
17 } 18 }
18 19
19 WebInspector.AccessibilitySidebarView.prototype = { 20 WebInspector.AccessibilitySidebarView.prototype = {
20 /** 21 /**
21 * @return {?WebInspector.DOMNode} 22 * @return {?WebInspector.DOMNode}
22 */ 23 */
(...skipping 10 matching lines...) Expand all
33 doUpdate: function() 34 doUpdate: function()
34 { 35 {
35 /** 36 /**
36 * @param {?AccessibilityAgent.AXNode} accessibilityNode 37 * @param {?AccessibilityAgent.AXNode} accessibilityNode
37 * @this {WebInspector.AccessibilitySidebarView} 38 * @this {WebInspector.AccessibilitySidebarView}
38 */ 39 */
39 function accessibilityNodeCallback(accessibilityNode) 40 function accessibilityNodeCallback(accessibilityNode)
40 { 41 {
41 if (this._axNodeSubPane) 42 if (this._axNodeSubPane)
42 this._axNodeSubPane.setAXNode(accessibilityNode); 43 this._axNodeSubPane.setAXNode(accessibilityNode);
44 this._accessibilityNodeUpdatedForTest();
43 } 45 }
44 var node = this.node(); 46 var node = this.node();
45 return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNo de(node.id) 47 return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNo de(node.id)
46 .then(accessibilityNodeCallback.bind(this)) 48 .then(accessibilityNodeCallback.bind(this))
47 }, 49 },
48 50
51 _accessibilityNodeUpdatedForTest: function()
52 {
53 // For sniffing in tests.
54 },
55
49 /** 56 /**
50 * @override 57 * @override
51 */ 58 */
52 wasShown: function() 59 wasShown: function()
53 { 60 {
54 WebInspector.ThrottledWidget.prototype.wasShown.call(this); 61 WebInspector.ThrottledWidget.prototype.wasShown.call(this);
55 62
56 if (!this._sidebarPaneStack) { 63 if (!this._sidebarPaneStack) {
57 this._axNodeSubPane = new WebInspector.AXNodeSubPane(); 64 this._axNodeSubPane = new WebInspector.AXNodeSubPane();
58 this._axNodeSubPane.setNode(this.node()); 65 this._axNodeSubPane.setNode(this.node());
59 this._axNodeSubPane.show(this.element); 66 this._axNodeSubPane.show(this.element);
60 this._axNodeSubPane.expandPane(); 67 this._axNodeSubPane.expandPane();
61 68
69 this._ariaSubPane = new WebInspector.ARIAAttributesPane();
70 this._ariaSubPane.setNode(this.node());
71 this._ariaSubPane.show(this.element);
72 this._ariaSubPane.expandPane();
73
62 this._sidebarPaneStack = new WebInspector.SidebarPaneStack(); 74 this._sidebarPaneStack = new WebInspector.SidebarPaneStack();
63 this._sidebarPaneStack.element.classList.add("flex-auto"); 75 this._sidebarPaneStack.element.classList.add("flex-auto");
64 this._sidebarPaneStack.show(this.element); 76 this._sidebarPaneStack.show(this.element);
77 this._sidebarPaneStack.addPane(this._ariaSubPane);
65 this._sidebarPaneStack.addPane(this._axNodeSubPane); 78 this._sidebarPaneStack.addPane(this._axNodeSubPane);
66 } 79 }
67 80
68 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.AttrModified, this._onAttrChange, this); 81 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.AttrModified, this._onAttrChange, this);
69 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.AttrRemoved, this._onAttrChange, this); 82 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.AttrRemoved, this._onAttrChange, this);
70 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this); 83 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this);
71 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this); 84 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this);
72 }, 85 },
73 86
74 /** 87 /**
75 * @override 88 * @override
76 */ 89 */
77 willHide: function() 90 willHide: function()
78 { 91 {
79 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.AttrModified, this._onAttrChange, this); 92 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.AttrModified, this._onAttrChange, this);
80 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.AttrRemoved, this._onAttrChange, this); 93 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.AttrRemoved, this._onAttrChange, this);
81 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this); 94 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this);
82 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this); 95 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this);
83 }, 96 },
84 97
85 _pullNode: function() 98 _pullNode: function()
86 { 99 {
87 this._node = WebInspector.context.flavor(WebInspector.DOMNode); 100 this._node = WebInspector.context.flavor(WebInspector.DOMNode);
88 if (this._axNodeSubPane) 101 if (this._axNodeSubPane)
89 this._axNodeSubPane.setNode(this._node); 102 this._axNodeSubPane.setNode(this._node);
103 if (this._ariaSubPane)
104 this._ariaSubPane.setNode(this._node);
90 this.update(); 105 this.update();
91 }, 106 },
92 107
93 /** 108 /**
94 * @param {!WebInspector.Event} event 109 * @param {!WebInspector.Event} event
95 */ 110 */
96 _onAttrChange: function(event) 111 _onAttrChange: function(event)
97 { 112 {
98 if (!this.node()) 113 if (!this.node())
99 return; 114 return;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css"); 195 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css");
181 treeOutline.registerRequiredCSS("components/objectValue.css"); 196 treeOutline.registerRequiredCSS("components/objectValue.css");
182 197
183 treeOutline.element.classList.add("hidden"); 198 treeOutline.element.classList.add("hidden");
184 this.element.appendChild(treeOutline.element); 199 this.element.appendChild(treeOutline.element);
185 return treeOutline; 200 return treeOutline;
186 }, 201 },
187 202
188 __proto__: WebInspector.SidebarPane.prototype 203 __proto__: WebInspector.SidebarPane.prototype
189 } 204 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698