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

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

Issue 1403853002: Devtools: DOM inspection follows inspect cursor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 5 years, 2 months 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
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 this._updateSidebarPosition(); 92 this._updateSidebarPosition();
93 this._loadSidebarViews(); 93 this._loadSidebarViews();
94 94
95 /** @type {!Array.<!WebInspector.ElementsTreeOutline>} */ 95 /** @type {!Array.<!WebInspector.ElementsTreeOutline>} */
96 this._treeOutlines = []; 96 this._treeOutlines = [];
97 /** @type {!Map.<!WebInspector.DOMModel, !WebInspector.ElementsTreeOutline>} */ 97 /** @type {!Map.<!WebInspector.DOMModel, !WebInspector.ElementsTreeOutline>} */
98 this._modelToTreeOutline = new Map(); 98 this._modelToTreeOutline = new Map();
99 WebInspector.targetManager.observeTargets(this); 99 WebInspector.targetManager.observeTargets(this);
100 WebInspector.moduleSetting("showUAShadowDOM").addChangeListener(this._showUA ShadowDOMChanged.bind(this)); 100 WebInspector.moduleSetting("showUAShadowDOM").addChangeListener(this._showUA ShadowDOMChanged.bind(this));
101 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec tor.DOMModel.Events.DocumentUpdated, this._documentUpdatedEvent, this); 101 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec tor.DOMModel.Events.DocumentUpdated, this._documentUpdatedEvent, this);
102 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec tor.DOMModel.Events.NodeHighlightedInOverlay, this._highlightNode, this);
102 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E vents.SidebarPaneAdded, this._extensionSidebarPaneAdded, this); 103 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E vents.SidebarPaneAdded, this._extensionSidebarPaneAdded, this);
103 } 104 }
104 105
105 WebInspector.ElementsPanel._elementsSidebarViewTitleSymbol = Symbol("title"); 106 WebInspector.ElementsPanel._elementsSidebarViewTitleSymbol = Symbol("title");
106 107
107 WebInspector.ElementsPanel.prototype = { 108 WebInspector.ElementsPanel.prototype = {
108 /** 109 /**
109 * @param {?WebInspector.Widget} widget 110 * @param {?WebInspector.Widget} widget
110 */ 111 */
111 showToolbarPane: function(widget) 112 showToolbarPane: function(widget)
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 { 690 {
690 for (var i = 0; i < this._treeOutlines.length; ++i) { 691 for (var i = 0; i < this._treeOutlines.length; ++i) {
691 var treeOutline = this._treeOutlines[i]; 692 var treeOutline = this._treeOutlines[i];
692 if (treeOutline.selectedDOMNode()) 693 if (treeOutline.selectedDOMNode())
693 return treeOutline.selectedDOMNode(); 694 return treeOutline.selectedDOMNode();
694 } 695 }
695 return null; 696 return null;
696 }, 697 },
697 698
698 /** 699 /**
700 * @param {!WebInspector.Event} event
701 */
702 _highlightNode: function(event)
703 {
704 var domNode = /** @type {!WebInspector.DOMNode} */ (event.data);
705 for (var i = 0; i < this._treeOutlines.length; ++i) {
706 var treeOutline = this._treeOutlines[i];
707 treeOutline.highlightNode(treeOutline.domModel() === domNode.domMode l() ? domNode : null);
708 }
709 },
710
711 /**
699 * @param {!WebInspector.DOMNode} node 712 * @param {!WebInspector.DOMNode} node
700 * @param {boolean=} focus 713 * @param {boolean=} focus
701 */ 714 */
702 selectDOMNode: function(node, focus) 715 selectDOMNode: function(node, focus)
703 { 716 {
704 for (var i = 0; i < this._treeOutlines.length; ++i) { 717 for (var i = 0; i < this._treeOutlines.length; ++i) {
705 var treeOutline = this._treeOutlines[i]; 718 var treeOutline = this._treeOutlines[i];
706 if (treeOutline.domModel() === node.domModel()) 719 if (treeOutline.domModel() === node.domModel())
707 treeOutline.selectDOMNode(node, focus); 720 treeOutline.selectDOMNode(node, focus);
708 else 721 else
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 * @override 1284 * @override
1272 */ 1285 */
1273 wasShown: function() 1286 wasShown: function()
1274 { 1287 {
1275 this._toolbarItem.setToggled(true); 1288 this._toolbarItem.setToggled(true);
1276 this._nodeChanged(); 1289 this._nodeChanged();
1277 }, 1290 },
1278 1291
1279 __proto__: WebInspector.Widget.prototype 1292 __proto__: WebInspector.Widget.prototype
1280 } 1293 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698