| 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.AXTreePane = class extends Accessibility.AccessibilitySubPane { | 7 Accessibility.AXTreePane = class extends Accessibility.AccessibilitySubPane { |
| 8 constructor() { | 8 constructor() { |
| 9 super(Common.UIString('Accessibility Tree')); | 9 super(Common.UIString('Accessibility Tree')); |
| 10 | 10 |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 this._expandSiblingsButton = new Accessibility.ExpandSiblingsButton(this, nu
mSiblings); | 350 this._expandSiblingsButton = new Accessibility.ExpandSiblingsButton(this, nu
mSiblings); |
| 351 this._partiallyExpanded = false; | 351 this._partiallyExpanded = false; |
| 352 } | 352 } |
| 353 | 353 |
| 354 /** | 354 /** |
| 355 * @override | 355 * @override |
| 356 */ | 356 */ |
| 357 onattach() { | 357 onattach() { |
| 358 super.onattach(); | 358 super.onattach(); |
| 359 if (this._treePane.isExpanded(this._axNode.backendDOMNodeId())) | 359 if (this._treePane.isExpanded(this._axNode.backendDOMNodeId())) |
| 360 this._listItemNode.classList.add('siblings-expanded'); | 360 this.listItemElement.classList.add('siblings-expanded'); |
| 361 if (this._axNode.numChildren() > 1) | 361 if (this._axNode.numChildren() > 1) |
| 362 this._listItemNode.insertBefore(this._expandSiblingsButton.element, this._
inspectNodeButton.element); | 362 this.listItemElement.insertBefore(this._expandSiblingsButton.element, this
._inspectNodeButton.element); |
| 363 } | 363 } |
| 364 | 364 |
| 365 /** | 365 /** |
| 366 * @param {boolean} altKey | 366 * @param {boolean} altKey |
| 367 * @return {boolean} | 367 * @return {boolean} |
| 368 * @override | 368 * @override |
| 369 */ | 369 */ |
| 370 descendOrExpand(altKey) { | 370 descendOrExpand(altKey) { |
| 371 if (!this.expanded || !this._partiallyExpanded) | 371 if (!this.expanded || !this._partiallyExpanded) |
| 372 return super.descendOrExpand(altKey); | 372 return super.descendOrExpand(altKey); |
| 373 | 373 |
| 374 this.expandSiblings(); | 374 this.expandSiblings(); |
| 375 if (altKey) | 375 if (altKey) |
| 376 this.expandRecursively(); | 376 this.expandRecursively(); |
| 377 return true; | 377 return true; |
| 378 } | 378 } |
| 379 | 379 |
| 380 /** | 380 /** |
| 381 * @override | 381 * @override |
| 382 */ | 382 */ |
| 383 expand() { | 383 expand() { |
| 384 super.expand(); | 384 super.expand(); |
| 385 this._partiallyExpanded = true; | 385 this._partiallyExpanded = true; |
| 386 } | 386 } |
| 387 | 387 |
| 388 expandSiblings() { | 388 expandSiblings() { |
| 389 this._listItemNode.classList.add('siblings-expanded'); | 389 this.listItemElement.classList.add('siblings-expanded'); |
| 390 this.appendSiblings(); | 390 this.appendSiblings(); |
| 391 this.expanded = true; | 391 this.expanded = true; |
| 392 this._partiallyExpanded = false; | 392 this._partiallyExpanded = false; |
| 393 this._treePane.setExpanded(this._axNode.backendDOMNodeId(), true); | 393 this._treePane.setExpanded(this._axNode.backendDOMNodeId(), true); |
| 394 } | 394 } |
| 395 | 395 |
| 396 appendSiblings() { | 396 appendSiblings() { |
| 397 var inspectedAXNode = this._inspectedNodeTreeElement.axNode(); | 397 var inspectedAXNode = this._inspectedNodeTreeElement.axNode(); |
| 398 var nextIndex = 0; | 398 var nextIndex = 0; |
| 399 var foundInspectedNode = false; | 399 var foundInspectedNode = false; |
| 400 for (var sibling of this._axNode.children()) { | 400 for (var sibling of this._axNode.children()) { |
| 401 var siblingTreeElement = null; | 401 var siblingTreeElement = null; |
| 402 if (sibling === inspectedAXNode) { | 402 if (sibling === inspectedAXNode) { |
| 403 foundInspectedNode = true; | 403 foundInspectedNode = true; |
| 404 continue; | 404 continue; |
| 405 } | 405 } |
| 406 siblingTreeElement = new Accessibility.AXNodeTreeElement(sibling, this._tr
eePane); | 406 siblingTreeElement = new Accessibility.AXNodeTreeElement(sibling, this._tr
eePane); |
| 407 if (foundInspectedNode) | 407 if (foundInspectedNode) |
| 408 this.appendChild(siblingTreeElement); | 408 this.appendChild(siblingTreeElement); |
| 409 else | 409 else |
| 410 this.insertChild(siblingTreeElement, nextIndex++); | 410 this.insertChild(siblingTreeElement, nextIndex++); |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 }; | 413 }; |
| OLD | NEW |