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

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

Issue 2142653003: DevTools: move functionality away from ElementsPanel for better DOM tree control reuse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeOutline.js
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeOutline.js b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeOutline.js
index 8f653af2e59216c911c4006d20fc45a4a797927a..1e32c4f8afc18de4828b1fa9aa118d9fd4e263df 100644
--- a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeOutline.js
+++ b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeOutline.js
@@ -81,6 +81,17 @@ WebInspector.ElementsTreeOutline = function(domModel, omitRootDOMNode, selectEna
this._domModel.addEventListener(WebInspector.DOMModel.Events.MarkersChanged, this._markersChanged, this);
}
+WebInspector.ElementsTreeOutline._treeOutlineSymbol = Symbol("treeOutline");
+
+/**
+ * @param {!WebInspector.DOMModel} domModel
+ * @return {?WebInspector.ElementsTreeOutline}
+ */
+WebInspector.ElementsTreeOutline.forDOMModel = function(domModel)
+{
+ return domModel[WebInspector.ElementsTreeOutline._treeOutlineSymbol] || null;
+}
+
/** @typedef {{node: !WebInspector.DOMNode, isCut: boolean}} */
WebInspector.ElementsTreeOutline.ClipboardData;
@@ -1066,6 +1077,7 @@ WebInspector.ElementsTreeOutline.prototype = {
wireToDOMModel: function()
{
+ this._domModel[WebInspector.ElementsTreeOutline._treeOutlineSymbol] = this;
this._domModel.addEventListener(WebInspector.DOMModel.Events.NodeInserted, this._nodeInserted, this);
this._domModel.addEventListener(WebInspector.DOMModel.Events.NodeRemoved, this._nodeRemoved, this);
this._domModel.addEventListener(WebInspector.DOMModel.Events.AttrModified, this._attributeModified, this);
@@ -1086,6 +1098,7 @@ WebInspector.ElementsTreeOutline.prototype = {
this._domModel.removeEventListener(WebInspector.DOMModel.Events.DocumentUpdated, this._documentUpdated, this);
this._domModel.removeEventListener(WebInspector.DOMModel.Events.ChildNodeCountUpdated, this._childNodeCountUpdated, this);
this._domModel.removeEventListener(WebInspector.DOMModel.Events.DistributedNodesChanged, this._distributedNodesChanged, this);
+ delete this._domModel[WebInspector.ElementsTreeOutline._treeOutlineSymbol];
},
/**

Powered by Google App Engine
This is Rietveld 408576698