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

Unified Diff: Source/devtools/front_end/PlatformFontsSidebarPane.js

Issue 221253002: DevTools: move off WebInspector.css/domModel in sidebars. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review comment addressed. Created 6 years, 9 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
« no previous file with comments | « Source/devtools/front_end/MetricsSidebarPane.js ('k') | Source/devtools/front_end/StylesSidebarPane.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/PlatformFontsSidebarPane.js
diff --git a/Source/devtools/front_end/PlatformFontsSidebarPane.js b/Source/devtools/front_end/PlatformFontsSidebarPane.js
index 661538da2578502c387b7ccb4c866c903762a55c..e6a9bada6d749453a40db896cddc426d327344f1 100644
--- a/Source/devtools/front_end/PlatformFontsSidebarPane.js
+++ b/Source/devtools/front_end/PlatformFontsSidebarPane.js
@@ -36,9 +36,6 @@ WebInspector.PlatformFontsSidebarPane = function()
{
WebInspector.SidebarPane.call(this, WebInspector.UIString("Fonts"));
this.element.classList.add("platform-fonts");
- WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.AttrModified, this._onNodeChange.bind(this));
- WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.AttrRemoved, this._onNodeChange.bind(this));
- WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.CharacterDataModified, this._onNodeChange.bind(this));
this._sectionTitle = document.createElementWithClass("div", "sidebar-separator");
this.element.insertBefore(this._sectionTitle, this.bodyElement);
@@ -64,9 +61,28 @@ WebInspector.PlatformFontsSidebarPane.prototype = {
return;
}
this._node = node;
+ this._updateTarget(node.target());
this._innerUpdate();
},
+ /**
+ * @param {!WebInspector.Target} target
+ */
+ _updateTarget: function(target)
+ {
+ if (this._target === target)
+ return;
+ if (this._target) {
+ this._target.domModel.removeEventListener(WebInspector.DOMModel.Events.AttrModified, this._onNodeChange, this);
+ this._target.domModel.removeEventListener(WebInspector.DOMModel.Events.AttrRemoved, this._onNodeChange, this);
+ this._target.domModel.removeEventListener(WebInspector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this);
+ }
+ this._target = target;
+ this._target.domModel.addEventListener(WebInspector.DOMModel.Events.AttrModified, this._onNodeChange, this);
+ this._target.domModel.addEventListener(WebInspector.DOMModel.Events.AttrRemoved, this._onNodeChange, this);
+ this._target.domModel.addEventListener(WebInspector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this);
+ },
+
_innerUpdate: function()
{
if (this._innerUpdateTimeout) {
@@ -75,7 +91,7 @@ WebInspector.PlatformFontsSidebarPane.prototype = {
}
if (!this._node)
return;
- WebInspector.cssModel.getPlatformFontsForNode(this._node.id, this._refreshUI.bind(this, this._node));
+ this._target.cssModel.getPlatformFontsForNode(this._node.id, this._refreshUI.bind(this, this._node));
},
/**
« no previous file with comments | « Source/devtools/front_end/MetricsSidebarPane.js ('k') | Source/devtools/front_end/StylesSidebarPane.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698