OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.AccessibilitySubPane} | 7 * @extends {WebInspector.AccessibilitySubPane} |
8 */ | 8 */ |
9 WebInspector.AXNodeSubPane = function() | 9 WebInspector.AXNodeSubPane = function() |
10 { | 10 { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 /** | 214 /** |
215 * @param {!AccessibilityAgent.AXValue} value | 215 * @param {!AccessibilityAgent.AXValue} value |
216 * @return {?Element} | 216 * @return {?Element} |
217 */ | 217 */ |
218 appendValueElement: function(value) | 218 appendValueElement: function(value) |
219 { | 219 { |
220 var AXValueType = AccessibilityAgent.AXValueType; | 220 var AXValueType = AccessibilityAgent.AXValueType; |
221 if (value.type === AXValueType.Idref || value.type === AXValueType.Node
|| | 221 if (value.type === AXValueType.Idref || value.type === AXValueType.Node
|| |
222 value.type === AXValueType.IdrefList || value.type === AXValueType.N
odeList) { | 222 value.type === AXValueType.IdrefList || value.type === AXValueType.N
odeList) { |
223 this.appendRelatedNodeListValueElement(value); | 223 this.appendRelatedNodeListValueElement(value); |
224 return null; | 224 if (!value.value) |
| 225 return null; |
225 } else if (value.sources) { | 226 } else if (value.sources) { |
226 var sources = value.sources; | 227 var sources = value.sources; |
227 for (var i = 0; i < sources.length; i++) { | 228 for (var i = 0; i < sources.length; i++) { |
228 var source = sources[i]; | 229 var source = sources[i]; |
229 var child = new WebInspector.AXValueSourceTreeElement(source, th
is._target); | 230 var child = new WebInspector.AXValueSourceTreeElement(source, th
is._target); |
230 this.appendChild(child); | 231 this.appendChild(child); |
231 } | 232 } |
232 this.expand(); | 233 this.expand(); |
233 } | 234 } |
234 var element = WebInspector.AXNodePropertyTreeElement.createSimpleValueEl
ement(value.type, String(value.value)); | 235 var element = WebInspector.AXNodePropertyTreeElement.createSimpleValueEl
ement(value.type, String(value.value)); |
235 this.listItemElement.appendChild(element); | 236 this.listItemElement.appendChild(element); |
236 return element; | 237 return element; |
237 }, | 238 }, |
238 | 239 |
239 /** | 240 /** |
240 * @param {!AccessibilityAgent.AXRelatedNode} relatedNode | 241 * @param {!AccessibilityAgent.AXRelatedNode} relatedNode |
241 * @param {number} index | 242 * @param {number} index |
242 */ | 243 */ |
243 appendRelatedNode: function(relatedNode, index) | 244 appendRelatedNode: function(relatedNode, index) |
244 { | 245 { |
245 if (index > 0) | 246 var deferredNode = new WebInspector.DeferredDOMNode(this._target, relate
dNode.backendNodeId); |
246 this.listItemElement.createTextChild(",\u00a0"); | 247 var nodeTreeElement = new WebInspector.AXRelatedNodeSourceTreeElement({
deferredNode: deferredNode }, relatedNode); |
| 248 this.appendChild(nodeTreeElement); |
| 249 }, |
247 | 250 |
| 251 /** |
| 252 * @param {!AccessibilityAgent.AXRelatedNode} relatedNode |
| 253 */ |
| 254 appendRelatedNodeInline: function(relatedNode) |
| 255 { |
248 var deferredNode = new WebInspector.DeferredDOMNode(this._target, relate
dNode.backendNodeId); | 256 var deferredNode = new WebInspector.DeferredDOMNode(this._target, relate
dNode.backendNodeId); |
249 var linkedNode = new WebInspector.AXRelatedNodeElement({ deferredNode: d
eferredNode }, relatedNode); | 257 var linkedNode = new WebInspector.AXRelatedNodeElement({ deferredNode: d
eferredNode }, relatedNode); |
250 this.listItemElement.appendChild(linkedNode.render()); | 258 this.listItemElement.appendChild(linkedNode.render()); |
251 }, | 259 }, |
252 | 260 |
253 /** | 261 /** |
254 * @param {!AccessibilityAgent.AXValue} value | 262 * @param {!AccessibilityAgent.AXValue} value |
255 */ | 263 */ |
256 appendRelatedNodeListValueElement: function(value) | 264 appendRelatedNodeListValueElement: function(value) |
257 { | 265 { |
| 266 if (value.relatedNodes.length === 1 && !value.value) { |
| 267 this.appendRelatedNodeInline(value.relatedNodes[0]); |
| 268 return; |
| 269 } |
| 270 |
258 value.relatedNodes.forEach(this.appendRelatedNode, this); | 271 value.relatedNodes.forEach(this.appendRelatedNode, this); |
| 272 if (value.relatedNodes.length <= 3) |
| 273 this.expand(); |
| 274 else |
| 275 this.collapse(); |
259 }, | 276 }, |
260 | 277 |
261 __proto__: TreeElement.prototype | 278 __proto__: TreeElement.prototype |
262 }; | 279 }; |
263 | 280 |
264 /** | 281 /** |
265 * @constructor | 282 * @constructor |
266 * @extends {WebInspector.AXNodePropertyTreeElement} | 283 * @extends {WebInspector.AXNodePropertyTreeElement} |
267 * @param {!AccessibilityAgent.AXProperty} property | 284 * @param {!AccessibilityAgent.AXProperty} property |
268 * @param {!WebInspector.Target} target | 285 * @param {!WebInspector.Target} target |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 * @override | 337 * @override |
321 */ | 338 */ |
322 onattach: function() | 339 onattach: function() |
323 { | 340 { |
324 this._update(); | 341 this._update(); |
325 }, | 342 }, |
326 | 343 |
327 /** | 344 /** |
328 * @param {!AccessibilityAgent.AXRelatedNode} relatedNode | 345 * @param {!AccessibilityAgent.AXRelatedNode} relatedNode |
329 * @param {number} index | 346 * @param {number} index |
330 * @override | |
331 */ | |
332 appendRelatedNode: function(relatedNode, index) | |
333 { | |
334 var deferredNode = new WebInspector.DeferredDOMNode(this._target, relate
dNode.backendNodeId); | |
335 var nodeTreeElement = new WebInspector.AXRelatedNodeSourceTreeElement({
deferredNode: deferredNode }, relatedNode); | |
336 this.appendChild(nodeTreeElement); | |
337 }, | |
338 | |
339 /** | |
340 * @param {!AccessibilityAgent.AXRelatedNode} relatedNode | |
341 * @param {number} index | |
342 * @param {string} idref | 347 * @param {string} idref |
343 */ | 348 */ |
344 appendRelatedNodeWithIdref: function(relatedNode, index, idref) | 349 appendRelatedNodeWithIdref: function(relatedNode, index, idref) |
345 { | 350 { |
346 var deferredNode = new WebInspector.DeferredDOMNode(this._target, relate
dNode.backendNodeId); | 351 var deferredNode = new WebInspector.DeferredDOMNode(this._target, relate
dNode.backendNodeId); |
347 var nodeTreeElement = new WebInspector.AXRelatedNodeSourceTreeElement({
deferredNode: deferredNode, idref: idref }, relatedNode); | 352 var nodeTreeElement = new WebInspector.AXRelatedNodeSourceTreeElement({
deferredNode: deferredNode, idref: idref }, relatedNode); |
348 this.appendChild(nodeTreeElement); | 353 this.appendChild(nodeTreeElement); |
349 }, | 354 }, |
350 | 355 |
351 /** | 356 /** |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 reasonElement = WebInspector.formatLocalized("Static text node is used a
s name for\u00a0", []); | 676 reasonElement = WebInspector.formatLocalized("Static text node is used a
s name for\u00a0", []); |
672 break; | 677 break; |
673 case "uninteresting": | 678 case "uninteresting": |
674 reasonElement = WebInspector.formatLocalized("Element not interesting fo
r accessibility.", []); | 679 reasonElement = WebInspector.formatLocalized("Element not interesting fo
r accessibility.", []); |
675 break; | 680 break; |
676 } | 681 } |
677 if (reasonElement) | 682 if (reasonElement) |
678 reasonElement.classList.add("ax-reason"); | 683 reasonElement.classList.add("ax-reason"); |
679 return reasonElement; | 684 return reasonElement; |
680 }; | 685 }; |
OLD | NEW |