| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 } | 416 } |
| 417 | 417 |
| 418 this._selectedDOMNode = node; | 418 this._selectedDOMNode = node; |
| 419 this._revealAndSelectNode(node, !focus); | 419 this._revealAndSelectNode(node, !focus); |
| 420 | 420 |
| 421 // The _revealAndSelectNode() method might find a different element if t
here is inlined text, | 421 // The _revealAndSelectNode() method might find a different element if t
here is inlined text, |
| 422 // and the select() call would change the selectedDOMNode and reenter th
is setter. So to | 422 // and the select() call would change the selectedDOMNode and reenter th
is setter. So to |
| 423 // avoid calling _selectedNodeChanged() twice, first check if _selectedD
OMNode is the same | 423 // avoid calling _selectedNodeChanged() twice, first check if _selectedD
OMNode is the same |
| 424 // node as the one passed in. | 424 // node as the one passed in. |
| 425 if (this._selectedDOMNode === node) | 425 if (this._selectedDOMNode === node) |
| 426 this._selectedNodeChanged(); | 426 this._selectedNodeChanged(!!focus); |
| 427 }, | 427 }, |
| 428 | 428 |
| 429 /** | 429 /** |
| 430 * @return {boolean} | 430 * @return {boolean} |
| 431 */ | 431 */ |
| 432 editing: function() | 432 editing: function() |
| 433 { | 433 { |
| 434 var node = this.selectedDOMNode(); | 434 var node = this.selectedDOMNode(); |
| 435 if (!node) | 435 if (!node) |
| 436 return false; | 436 return false; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 456 for (var child of children) { | 456 for (var child of children) { |
| 457 var treeElement = this._createElementTreeElement(child); | 457 var treeElement = this._createElementTreeElement(child); |
| 458 this.appendChild(treeElement); | 458 this.appendChild(treeElement); |
| 459 } | 459 } |
| 460 } | 460 } |
| 461 | 461 |
| 462 if (selectedNode) | 462 if (selectedNode) |
| 463 this._revealAndSelectNode(selectedNode, true); | 463 this._revealAndSelectNode(selectedNode, true); |
| 464 }, | 464 }, |
| 465 | 465 |
| 466 _selectedNodeChanged: function() | 466 /** |
| 467 * @param {boolean} focus |
| 468 */ |
| 469 _selectedNodeChanged: function(focus) |
| 467 { | 470 { |
| 468 this.dispatchEventToListeners(WebInspector.ElementsTreeOutline.Events.Se
lectedNodeChanged, this._selectedDOMNode); | 471 this.dispatchEventToListeners(WebInspector.ElementsTreeOutline.Events.Se
lectedNodeChanged, {node: this._selectedDOMNode, focus: focus}); |
| 469 }, | 472 }, |
| 470 | 473 |
| 471 /** | 474 /** |
| 472 * @param {!Array.<!WebInspector.DOMNode>} nodes | 475 * @param {!Array.<!WebInspector.DOMNode>} nodes |
| 473 */ | 476 */ |
| 474 _fireElementsTreeUpdated: function(nodes) | 477 _fireElementsTreeUpdated: function(nodes) |
| 475 { | 478 { |
| 476 this.dispatchEventToListeners(WebInspector.ElementsTreeOutline.Events.El
ementsTreeUpdated, nodes); | 479 this.dispatchEventToListeners(WebInspector.ElementsTreeOutline.Events.El
ementsTreeUpdated, nodes); |
| 477 }, | 480 }, |
| 478 | 481 |
| (...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 if (node) { | 1800 if (node) { |
| 1798 this.treeOutline._selectedDOMNode = node; | 1801 this.treeOutline._selectedDOMNode = node; |
| 1799 this.treeOutline._selectedNodeChanged(); | 1802 this.treeOutline._selectedNodeChanged(); |
| 1800 } | 1803 } |
| 1801 } | 1804 } |
| 1802 return true; | 1805 return true; |
| 1803 }, | 1806 }, |
| 1804 | 1807 |
| 1805 __proto__: TreeElement.prototype | 1808 __proto__: TreeElement.prototype |
| 1806 } | 1809 } |
| OLD | NEW |