| 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Accessibility.AXNodeSubPane = class extends Accessibility.AccessibilitySubPane { | 7 Accessibility.AXNodeSubPane = class extends Accessibility.AccessibilitySubPane { |
| 8 constructor() { | 8 constructor() { |
| 9 super(Common.UIString('Computed Properties')); | 9 super(Common.UIString('Computed Properties')); |
| 10 | 10 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } else { | 181 } else { |
| 182 nameElement.textContent = name; | 182 nameElement.textContent = name; |
| 183 nameElement.classList.add('ax-name'); | 183 nameElement.classList.add('ax-name'); |
| 184 nameElement.classList.add('monospace'); | 184 nameElement.classList.add('monospace'); |
| 185 } | 185 } |
| 186 this.listItemElement.appendChild(nameElement); | 186 this.listItemElement.appendChild(nameElement); |
| 187 } | 187 } |
| 188 | 188 |
| 189 /** | 189 /** |
| 190 * @param {!Protocol.Accessibility.AXValue} value | 190 * @param {!Protocol.Accessibility.AXValue} value |
| 191 * @return {?Element} | |
| 192 */ | 191 */ |
| 193 appendValueElement(value) { | 192 appendValueElement(value) { |
| 194 var AXValueType = Protocol.Accessibility.AXValueType; | 193 var AXValueType = Protocol.Accessibility.AXValueType; |
| 195 if (value.type === AXValueType.Idref || value.type === AXValueType.Node || v
alue.type === AXValueType.IdrefList || | 194 if (value.type === AXValueType.Idref || value.type === AXValueType.Node || v
alue.type === AXValueType.IdrefList || |
| 196 value.type === AXValueType.NodeList) { | 195 value.type === AXValueType.NodeList) { |
| 197 this.appendRelatedNodeListValueElement(value); | 196 this.appendRelatedNodeListValueElement(value); |
| 198 if (!value.value) | 197 return; |
| 199 return null; | |
| 200 } else if (value.sources) { | 198 } else if (value.sources) { |
| 201 var sources = value.sources; | 199 var sources = value.sources; |
| 202 for (var i = 0; i < sources.length; i++) { | 200 for (var i = 0; i < sources.length; i++) { |
| 203 var source = sources[i]; | 201 var source = sources[i]; |
| 204 var child = new Accessibility.AXValueSourceTreeElement(source, this._axN
ode); | 202 var child = new Accessibility.AXValueSourceTreeElement(source, this._axN
ode); |
| 205 this.appendChild(child); | 203 this.appendChild(child); |
| 206 } | 204 } |
| 207 this.expand(); | 205 this.expand(); |
| 208 } | 206 } |
| 209 var element = Accessibility.AXNodePropertyTreeElement.createSimpleValueEleme
nt(value.type, String(value.value)); | 207 var element = Accessibility.AXNodePropertyTreeElement.createSimpleValueEleme
nt(value.type, String(value.value)); |
| 210 this.listItemElement.appendChild(element); | 208 this.listItemElement.appendChild(element); |
| 211 return element; | |
| 212 } | 209 } |
| 213 | 210 |
| 214 /** | 211 /** |
| 215 * @param {!Protocol.Accessibility.AXRelatedNode} relatedNode | 212 * @param {!Protocol.Accessibility.AXRelatedNode} relatedNode |
| 216 * @param {number} index | 213 * @param {number} index |
| 217 */ | 214 */ |
| 218 appendRelatedNode(relatedNode, index) { | 215 appendRelatedNode(relatedNode, index) { |
| 219 var deferredNode = new SDK.DeferredDOMNode(this._axNode.target(), relatedNod
e.backendDOMNodeId); | 216 var deferredNode = new SDK.DeferredDOMNode(this._axNode.target(), relatedNod
e.backendDOMNodeId); |
| 220 var nodeTreeElement = new Accessibility.AXRelatedNodeSourceTreeElement({defe
rredNode: deferredNode}, relatedNode); | 217 var nodeTreeElement = new Accessibility.AXRelatedNodeSourceTreeElement({defe
rredNode: deferredNode}, relatedNode); |
| 221 this.appendChild(nodeTreeElement); | 218 this.appendChild(nodeTreeElement); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 this._update(); | 293 this._update(); |
| 297 } | 294 } |
| 298 | 295 |
| 299 _update() { | 296 _update() { |
| 300 this.listItemElement.removeChildren(); | 297 this.listItemElement.removeChildren(); |
| 301 | 298 |
| 302 this.appendNameElement(this._property.name); | 299 this.appendNameElement(this._property.name); |
| 303 | 300 |
| 304 this.listItemElement.createChild('span', 'separator').textContent = ':\u00A0
'; | 301 this.listItemElement.createChild('span', 'separator').textContent = ':\u00A0
'; |
| 305 | 302 |
| 306 var valueElement = this.appendValueElement(this._property.value); | 303 this.appendValueElement(this._property.value); |
| 307 if (this._property.name === 'name') | |
| 308 valueElement.classList.add('ax-computed-text'); | |
| 309 } | 304 } |
| 310 }; | 305 }; |
| 311 | 306 |
| 312 /** | 307 /** |
| 313 * @unrestricted | 308 * @unrestricted |
| 314 */ | 309 */ |
| 315 Accessibility.AXValueSourceTreeElement = class extends Accessibility.AXNodePrope
rtyTreeElement { | 310 Accessibility.AXValueSourceTreeElement = class extends Accessibility.AXNodePrope
rtyTreeElement { |
| 316 /** | 311 /** |
| 317 * @param {!Protocol.Accessibility.AXValueSource} source | 312 * @param {!Protocol.Accessibility.AXValueSource} source |
| 318 * @param {!Accessibility.AccessibilityNode} axNode | 313 * @param {!Accessibility.AccessibilityNode} axNode |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 this.appendSourceNameElement(this._source); | 438 this.appendSourceNameElement(this._source); |
| 444 | 439 |
| 445 this.listItemElement.createChild('span', 'separator').textContent = ':\u00a0
'; | 440 this.listItemElement.createChild('span', 'separator').textContent = ':\u00a0
'; |
| 446 | 441 |
| 447 if (this._source.attributeValue) { | 442 if (this._source.attributeValue) { |
| 448 this.appendValueElement(this._source.attributeValue); | 443 this.appendValueElement(this._source.attributeValue); |
| 449 this.listItemElement.createTextChild('\u00a0'); | 444 this.listItemElement.createTextChild('\u00a0'); |
| 450 } else if (this._source.nativeSourceValue) { | 445 } else if (this._source.nativeSourceValue) { |
| 451 this.appendValueElement(this._source.nativeSourceValue); | 446 this.appendValueElement(this._source.nativeSourceValue); |
| 452 this.listItemElement.createTextChild('\u00a0'); | 447 this.listItemElement.createTextChild('\u00a0'); |
| 448 if (this._source.value) |
| 449 this.appendValueElement(this._source.value); |
| 453 } else if (this._source.value) { | 450 } else if (this._source.value) { |
| 454 this.appendValueElement(this._source.value); | 451 this.appendValueElement(this._source.value); |
| 455 } else { | 452 } else { |
| 456 var valueElement = Accessibility.AXNodePropertyTreeElement.createSimpleVal
ueElement( | 453 var valueElement = Accessibility.AXNodePropertyTreeElement.createSimpleVal
ueElement( |
| 457 Protocol.Accessibility.AXValueType.ValueUndefined, Common.UIString('No
t specified')); | 454 Protocol.Accessibility.AXValueType.ValueUndefined, Common.UIString('No
t specified')); |
| 458 this.listItemElement.appendChild(valueElement); | 455 this.listItemElement.appendChild(valueElement); |
| 459 this.listItemElement.classList.add('ax-value-source-unused'); | 456 this.listItemElement.classList.add('ax-value-source-unused'); |
| 460 } | 457 } |
| 461 | 458 |
| 462 if (this._source.value && this._source.superseded) | 459 if (this._source.value && this._source.superseded) |
| 463 this.listItemElement.classList.add('ax-value-source-superseded'); | 460 this.listItemElement.classList.add('ax-value-source-superseded'); |
| 464 } | 461 } |
| 465 | |
| 466 /** | |
| 467 * @param {!Protocol.Accessibility.AXValue} value | |
| 468 * @return {!Element} | |
| 469 * @override | |
| 470 */ | |
| 471 appendValueElement(value) { | |
| 472 var element = super.appendValueElement(value); | |
| 473 if (!element) { | |
| 474 element = Accessibility.AXNodePropertyTreeElement.createSimpleValueElement
(value.type, String(value.value)); | |
| 475 this.listItemElement.appendChild(element); | |
| 476 } | |
| 477 return element; | |
| 478 } | |
| 479 }; | 462 }; |
| 480 | 463 |
| 481 /** | 464 /** |
| 482 * @unrestricted | 465 * @unrestricted |
| 483 */ | 466 */ |
| 484 Accessibility.AXRelatedNodeSourceTreeElement = class extends UI.TreeElement { | 467 Accessibility.AXRelatedNodeSourceTreeElement = class extends UI.TreeElement { |
| 485 /** | 468 /** |
| 486 * @param {{deferredNode: (!SDK.DeferredDOMNode|undefined), idref: (string|und
efined)}} node | 469 * @param {{deferredNode: (!SDK.DeferredDOMNode|undefined), idref: (string|und
efined)}} node |
| 487 * @param {!Protocol.Accessibility.AXRelatedNode=} value | 470 * @param {!Protocol.Accessibility.AXRelatedNode=} value |
| 488 */ | 471 */ |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 | 631 |
| 649 this._reasonElement = | 632 this._reasonElement = |
| 650 Accessibility.AXNodeIgnoredReasonTreeElement.createReasonElement(this._p
roperty.name, this._axNode); | 633 Accessibility.AXNodeIgnoredReasonTreeElement.createReasonElement(this._p
roperty.name, this._axNode); |
| 651 this.listItemElement.appendChild(this._reasonElement); | 634 this.listItemElement.appendChild(this._reasonElement); |
| 652 | 635 |
| 653 var value = this._property.value; | 636 var value = this._property.value; |
| 654 if (value.type === Protocol.Accessibility.AXValueType.Idref) | 637 if (value.type === Protocol.Accessibility.AXValueType.Idref) |
| 655 this.appendRelatedNodeListValueElement(value); | 638 this.appendRelatedNodeListValueElement(value); |
| 656 } | 639 } |
| 657 }; | 640 }; |
| OLD | NEW |