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

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

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 WebInspector.ElementsTreeElementHighlighter = class { 7 Elements.ElementsTreeElementHighlighter = class {
8 /** 8 /**
9 * @param {!WebInspector.ElementsTreeOutline} treeOutline 9 * @param {!Elements.ElementsTreeOutline} treeOutline
10 */ 10 */
11 constructor(treeOutline) { 11 constructor(treeOutline) {
12 this._throttler = new WebInspector.Throttler(100); 12 this._throttler = new Common.Throttler(100);
13 this._treeOutline = treeOutline; 13 this._treeOutline = treeOutline;
14 this._treeOutline.addEventListener(TreeOutline.Events.ElementExpanded, this. _clearState, this); 14 this._treeOutline.addEventListener(TreeOutline.Events.ElementExpanded, this. _clearState, this);
15 this._treeOutline.addEventListener(TreeOutline.Events.ElementCollapsed, this ._clearState, this); 15 this._treeOutline.addEventListener(TreeOutline.Events.ElementCollapsed, this ._clearState, this);
16 this._treeOutline.addEventListener( 16 this._treeOutline.addEventListener(
17 WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, this._clear State, this); 17 Elements.ElementsTreeOutline.Events.SelectedNodeChanged, this._clearStat e, this);
18 WebInspector.targetManager.addModelListener( 18 SDK.targetManager.addModelListener(
19 WebInspector.DOMModel, WebInspector.DOMModel.Events.NodeHighlightedInOve rlay, this._highlightNode, this); 19 SDK.DOMModel, SDK.DOMModel.Events.NodeHighlightedInOverlay, this._highli ghtNode, this);
20 this._treeOutline.domModel().addEventListener( 20 this._treeOutline.domModel().addEventListener(
21 WebInspector.DOMModel.Events.InspectModeWillBeToggled, this._clearState, this); 21 SDK.DOMModel.Events.InspectModeWillBeToggled, this._clearState, this);
22 } 22 }
23 23
24 /** 24 /**
25 * @param {!WebInspector.Event} event 25 * @param {!Common.Event} event
26 */ 26 */
27 _highlightNode(event) { 27 _highlightNode(event) {
28 if (!WebInspector.moduleSetting('highlightNodeOnHoverInOverlay').get()) 28 if (!Common.moduleSetting('highlightNodeOnHoverInOverlay').get())
29 return; 29 return;
30 30
31 var domNode = /** @type {!WebInspector.DOMNode} */ (event.data); 31 var domNode = /** @type {!SDK.DOMNode} */ (event.data);
32 32
33 this._throttler.schedule(callback.bind(this)); 33 this._throttler.schedule(callback.bind(this));
34 this._pendingHighlightNode = this._treeOutline.domModel() === domNode.domMod el() ? domNode : null; 34 this._pendingHighlightNode = this._treeOutline.domModel() === domNode.domMod el() ? domNode : null;
35 35
36 /** 36 /**
37 * @this {WebInspector.ElementsTreeElementHighlighter} 37 * @this {Elements.ElementsTreeElementHighlighter}
38 */ 38 */
39 function callback() { 39 function callback() {
40 this._highlightNodeInternal(this._pendingHighlightNode); 40 this._highlightNodeInternal(this._pendingHighlightNode);
41 delete this._pendingHighlightNode; 41 delete this._pendingHighlightNode;
42 return Promise.resolve(); 42 return Promise.resolve();
43 } 43 }
44 } 44 }
45 45
46 /** 46 /**
47 * @param {?WebInspector.DOMNode} node 47 * @param {?SDK.DOMNode} node
48 */ 48 */
49 _highlightNodeInternal(node) { 49 _highlightNodeInternal(node) {
50 this._isModifyingTreeOutline = true; 50 this._isModifyingTreeOutline = true;
51 var treeElement = null; 51 var treeElement = null;
52 52
53 if (this._currentHighlightedElement) { 53 if (this._currentHighlightedElement) {
54 var currentTreeElement = this._currentHighlightedElement; 54 var currentTreeElement = this._currentHighlightedElement;
55 while (currentTreeElement !== this._alreadyExpandedParentElement) { 55 while (currentTreeElement !== this._alreadyExpandedParentElement) {
56 if (currentTreeElement.expanded) 56 if (currentTreeElement.expanded)
57 currentTreeElement.collapse(); 57 currentTreeElement.collapse();
(...skipping 26 matching lines...) Expand all
84 84
85 _clearState() { 85 _clearState() {
86 if (this._isModifyingTreeOutline) 86 if (this._isModifyingTreeOutline)
87 return; 87 return;
88 88
89 delete this._currentHighlightedElement; 89 delete this._currentHighlightedElement;
90 delete this._alreadyExpandedParentElement; 90 delete this._alreadyExpandedParentElement;
91 delete this._pendingHighlightNode; 91 delete this._pendingHighlightNode;
92 } 92 }
93 }; 93 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698