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

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

Issue 2174863003: DevTools: traverse widget hierarchy to reveal views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lcean Created 4 years, 4 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.ThrottledView} 7 * @extends {WebInspector.ThrottledView}
8 */ 8 */
9 WebInspector.AccessibilitySidebarView = function() 9 WebInspector.AccessibilitySidebarView = function()
10 { 10 {
11 WebInspector.ThrottledView.call(this, WebInspector.UIString("Accessibility") ); 11 WebInspector.ThrottledView.call(this, WebInspector.UIString("Accessibility") );
12 this._axNodeSubPane = null; 12 this._axNodeSubPane = null;
13 this._node = null; 13 this._node = null;
14 this._sidebarPaneStack = null; 14 this._sidebarPaneStack = new WebInspector.View.ExpandableStackContainer();
15 this._axNodeSubPane = new WebInspector.AXNodeSubPane();
16 this._sidebarPaneStack.appendView(this._axNodeSubPane, true);
17 this._sidebarPaneStack.show(this.element);
15 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._pul lNode, this); 18 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._pul lNode, this);
16 this._pullNode(); 19 this._pullNode();
17 } 20 }
18 21
19 WebInspector.AccessibilitySidebarView.prototype = { 22 WebInspector.AccessibilitySidebarView.prototype = {
20 /** 23 /**
21 * @return {?WebInspector.DOMNode} 24 * @return {?WebInspector.DOMNode}
22 */ 25 */
23 node: function() 26 node: function()
24 { 27 {
(...skipping 21 matching lines...) Expand all
46 .then(accessibilityNodeCallback.bind(this)) 49 .then(accessibilityNodeCallback.bind(this))
47 }, 50 },
48 51
49 /** 52 /**
50 * @override 53 * @override
51 */ 54 */
52 wasShown: function() 55 wasShown: function()
53 { 56 {
54 WebInspector.ThrottledView.prototype.wasShown.call(this); 57 WebInspector.ThrottledView.prototype.wasShown.call(this);
55 58
56 if (!this._sidebarPaneStack) { 59 this._axNodeSubPane.setNode(this.node());
57 this._axNodeSubPane = new WebInspector.AXNodeSubPane();
58 this._axNodeSubPane.setNode(this.node());
59 this._axNodeSubPane.show(this.element);
60
61 this._sidebarPaneStack = new WebInspector.SidebarPaneStack();
62 this._sidebarPaneStack.element.classList.add("flex-auto");
63 this._sidebarPaneStack.show(this.element);
64 this._sidebarPaneStack.addPane(this._axNodeSubPane);
65 }
66 60
67 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.AttrModified, this._onAttrChange, this); 61 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.AttrModified, this._onAttrChange, this);
68 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.AttrRemoved, this._onAttrChange, this); 62 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.AttrRemoved, this._onAttrChange, this);
69 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this); 63 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this);
70 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this); 64 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this);
71 }, 65 },
72 66
73 /** 67 /**
74 * @override 68 * @override
75 */ 69 */
76 willHide: function() 70 willHide: function()
77 { 71 {
78 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.AttrModified, this._onAttrChange, this); 72 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.AttrModified, this._onAttrChange, this);
79 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.AttrRemoved, this._onAttrChange, this); 73 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.AttrRemoved, this._onAttrChange, this);
80 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this); 74 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this);
81 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this); 75 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this);
82 }, 76 },
83 77
84 _pullNode: function() 78 _pullNode: function()
85 { 79 {
86 this._node = WebInspector.context.flavor(WebInspector.DOMNode); 80 this._node = WebInspector.context.flavor(WebInspector.DOMNode);
87 if (this._axNodeSubPane) 81 this._axNodeSubPane.setNode(this._node);
88 this._axNodeSubPane.setNode(this._node);
89 this.update(); 82 this.update();
90 }, 83 },
91 84
92 /** 85 /**
93 * @param {!WebInspector.Event} event 86 * @param {!WebInspector.Event} event
94 */ 87 */
95 _onAttrChange: function(event) 88 _onAttrChange: function(event)
96 { 89 {
97 if (!this.node()) 90 if (!this.node())
98 return; 91 return;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 this._node = node; 150 this._node = node;
158 }, 151 },
159 152
160 /** 153 /**
161 * @param {string} textContent 154 * @param {string} textContent
162 * @param {string=} className 155 * @param {string=} className
163 * @return {!Element} 156 * @return {!Element}
164 */ 157 */
165 createInfo: function(textContent, className) 158 createInfo: function(textContent, className)
166 { 159 {
167 var classNameOrDefault = className || "info"; 160 var classNameOrDefault = className || "gray-info-message";
168 var info = this.element.createChild("div", classNameOrDefault); 161 var info = this.element.createChild("div", classNameOrDefault);
169 info.textContent = textContent; 162 info.textContent = textContent;
170 return info; 163 return info;
171 }, 164 },
172 165
173 /** 166 /**
174 * @return {!TreeOutline} 167 * @return {!TreeOutline}
175 */ 168 */
176 createTreeOutline: function() 169 createTreeOutline: function()
177 { 170 {
178 var treeOutline = new TreeOutlineInShadow(); 171 var treeOutline = new TreeOutlineInShadow();
179 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css"); 172 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css");
180 treeOutline.registerRequiredCSS("components/objectValue.css"); 173 treeOutline.registerRequiredCSS("components/objectValue.css");
181 174
182 treeOutline.element.classList.add("hidden"); 175 treeOutline.element.classList.add("hidden");
183 this.element.appendChild(treeOutline.element); 176 this.element.appendChild(treeOutline.element);
184 return treeOutline; 177 return treeOutline;
185 }, 178 },
186 179
187 __proto__: WebInspector.View.prototype 180 __proto__: WebInspector.View.prototype
188 } 181 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698