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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeOutline.js

Issue 2449963004: Reland of DevTools: properly restore selected DOMNode in Elements panel. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 } 408 }
409 409
410 this._selectedDOMNode = node; 410 this._selectedDOMNode = node;
411 this._revealAndSelectNode(node, !focus); 411 this._revealAndSelectNode(node, !focus);
412 412
413 // The _revealAndSelectNode() method might find a different element if t here is inlined text, 413 // The _revealAndSelectNode() method might find a different element if t here is inlined text,
414 // and the select() call would change the selectedDOMNode and reenter th is setter. So to 414 // and the select() call would change the selectedDOMNode and reenter th is setter. So to
415 // avoid calling _selectedNodeChanged() twice, first check if _selectedD OMNode is the same 415 // avoid calling _selectedNodeChanged() twice, first check if _selectedD OMNode is the same
416 // node as the one passed in. 416 // node as the one passed in.
417 if (this._selectedDOMNode === node) 417 if (this._selectedDOMNode === node)
418 this._selectedNodeChanged(); 418 this._selectedNodeChanged(!!focus);
419 }, 419 },
420 420
421 /** 421 /**
422 * @return {boolean} 422 * @return {boolean}
423 */ 423 */
424 editing: function() 424 editing: function()
425 { 425 {
426 var node = this.selectedDOMNode(); 426 var node = this.selectedDOMNode();
427 if (!node) 427 if (!node)
428 return false; 428 return false;
(...skipping 19 matching lines...) Expand all
448 for (var child of children) { 448 for (var child of children) {
449 var treeElement = this._createElementTreeElement(child); 449 var treeElement = this._createElementTreeElement(child);
450 this.appendChild(treeElement); 450 this.appendChild(treeElement);
451 } 451 }
452 } 452 }
453 453
454 if (selectedNode) 454 if (selectedNode)
455 this._revealAndSelectNode(selectedNode, true); 455 this._revealAndSelectNode(selectedNode, true);
456 }, 456 },
457 457
458 _selectedNodeChanged: function() 458 /**
459 * @param {boolean} focus
460 */
461 _selectedNodeChanged: function(focus)
459 { 462 {
460 this.dispatchEventToListeners(WebInspector.ElementsTreeOutline.Events.Se lectedNodeChanged, this._selectedDOMNode); 463 this.dispatchEventToListeners(WebInspector.ElementsTreeOutline.Events.Se lectedNodeChanged, {node: this._selectedDOMNode, focus: focus});
461 }, 464 },
462 465
463 /** 466 /**
464 * @param {!Array.<!WebInspector.DOMNode>} nodes 467 * @param {!Array.<!WebInspector.DOMNode>} nodes
465 */ 468 */
466 _fireElementsTreeUpdated: function(nodes) 469 _fireElementsTreeUpdated: function(nodes)
467 { 470 {
468 this.dispatchEventToListeners(WebInspector.ElementsTreeOutline.Events.El ementsTreeUpdated, nodes); 471 this.dispatchEventToListeners(WebInspector.ElementsTreeOutline.Events.El ementsTreeUpdated, nodes);
469 }, 472 },
470 473
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 if (node) { 1792 if (node) {
1790 this.treeOutline._selectedDOMNode = node; 1793 this.treeOutline._selectedDOMNode = node;
1791 this.treeOutline._selectedNodeChanged(); 1794 this.treeOutline._selectedNodeChanged();
1792 } 1795 }
1793 } 1796 }
1794 return true; 1797 return true;
1795 }, 1798 },
1796 1799
1797 __proto__: TreeElement.prototype 1800 __proto__: TreeElement.prototype
1798 }; 1801 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698