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

Side by Side Diff: Source/devtools/front_end/elements/ElementsSidebarPane.js

Issue 1104163003: Devtools: [ElementsPanel] Add dom listeners in sidebars (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@move-force-state
Patch Set: Address comments Created 5 years, 7 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 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.SidebarPane} 7 * @extends {WebInspector.SidebarPane}
8 * @param {string} title 8 * @param {string} title
9 */ 9 */
10 WebInspector.ElementsSidebarPane = function(title) 10 WebInspector.ElementsSidebarPane = function(title)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 { 68 {
69 if (this._target === target) 69 if (this._target === target)
70 return; 70 return;
71 if (this._target) { 71 if (this._target) {
72 this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events .StyleSheetAdded, this.onCSSModelChanged, this); 72 this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events .StyleSheetAdded, this.onCSSModelChanged, this);
73 this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events .StyleSheetRemoved, this.onCSSModelChanged, this); 73 this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events .StyleSheetRemoved, this.onCSSModelChanged, this);
74 this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events .StyleSheetChanged, this.onCSSModelChanged, this); 74 this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events .StyleSheetChanged, this.onCSSModelChanged, this);
75 this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events .MediaQueryResultChanged, this.onCSSModelChanged, this); 75 this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events .MediaQueryResultChanged, this.onCSSModelChanged, this);
76 this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events .PseudoStateForced, this.onCSSModelChanged, this); 76 this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events .PseudoStateForced, this.onCSSModelChanged, this);
77 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Mo delWasEnabled, this.onCSSModelChanged, this); 77 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Mo delWasEnabled, this.onCSSModelChanged, this);
78 this._domModel.removeEventListener(WebInspector.DOMModel.Events.Attr Modified, this._onAttributeChanged, this); 78 this._domModel.removeEventListener(WebInspector.DOMModel.Events.DOMM utated, this.onDOMModelChanged, this);
79 this._domModel.removeEventListener(WebInspector.DOMModel.Events.Attr Removed, this._onAttributeChanged, this);
80 this._domModel.removeEventListener(WebInspector.DOMModel.Events.Char acterDataModified, this._onCharDataChanged, this);
81 this._target.resourceTreeModel.removeEventListener(WebInspector.Reso urceTreeModel.EventTypes.FrameResized, this._onFrameResized, this); 79 this._target.resourceTreeModel.removeEventListener(WebInspector.Reso urceTreeModel.EventTypes.FrameResized, this._onFrameResized, this);
82 } 80 }
83 this._target = target; 81 this._target = target;
84 if (target) { 82 if (target) {
85 this._cssModel = WebInspector.CSSStyleModel.fromTarget(target); 83 this._cssModel = WebInspector.CSSStyleModel.fromTarget(target);
86 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.St yleSheetAdded, this.onCSSModelChanged, this); 84 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.St yleSheetAdded, this.onCSSModelChanged, this);
87 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.St yleSheetRemoved, this.onCSSModelChanged, this); 85 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.St yleSheetRemoved, this.onCSSModelChanged, this);
88 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.St yleSheetChanged, this.onCSSModelChanged, this); 86 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.St yleSheetChanged, this.onCSSModelChanged, this);
89 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Me diaQueryResultChanged, this.onCSSModelChanged, this); 87 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Me diaQueryResultChanged, this.onCSSModelChanged, this);
90 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Ps eudoStateForced, this.onCSSModelChanged, this); 88 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Ps eudoStateForced, this.onCSSModelChanged, this);
91 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Mo delWasEnabled, this.onCSSModelChanged, this); 89 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Mo delWasEnabled, this.onCSSModelChanged, this);
92 this._domModel = WebInspector.DOMModel.fromTarget(target); 90 this._domModel = WebInspector.DOMModel.fromTarget(target);
93 this._domModel.addEventListener(WebInspector.DOMModel.Events.AttrMod ified, this._onAttributeChanged, this); 91 this._domModel.addEventListener(WebInspector.DOMModel.Events.DOMMuta ted, this.onDOMModelChanged, this);
94 this._domModel.addEventListener(WebInspector.DOMModel.Events.AttrRem oved, this._onAttributeChanged, this);
95 this._domModel.addEventListener(WebInspector.DOMModel.Events.Charact erDataModified, this._onCharDataChanged, this);
96 this._target.resourceTreeModel.addEventListener(WebInspector.Resourc eTreeModel.EventTypes.FrameResized, this._onFrameResized, this); 92 this._target.resourceTreeModel.addEventListener(WebInspector.Resourc eTreeModel.EventTypes.FrameResized, this._onFrameResized, this);
97 } 93 }
98 }, 94 },
99 95
100 /** 96 /**
101 * @param {!WebInspector.Event} event 97 * @param {!WebInspector.Event} event
102 */ 98 */
103 _onAttributeChanged: function(event)
104 {
105 this.onDOMNodeChanged(/** @type {!WebInspector.DOMNode} */(event.data.no de));
106 },
107
108 /**
109 * @param {!WebInspector.Event} event
110 */
111 _onCharDataChanged: function(event)
112 {
113 this.onDOMNodeChanged(/** @type {!WebInspector.DOMNode} */(event.data));
114 },
115
116 /**
117 * @param {!WebInspector.Event} event
118 */
119 _onFrameResized: function(event) 99 _onFrameResized: function(event)
120 { 100 {
121 /** 101 /**
122 * @this {WebInspector.ElementsSidebarPane} 102 * @this {WebInspector.ElementsSidebarPane}
123 */ 103 */
124 function refreshContents() 104 function refreshContents()
125 { 105 {
126 this.onFrameResizedThrottled(); 106 this.onFrameResizedThrottled();
127 delete this._frameResizedTimer; 107 delete this._frameResizedTimer;
128 } 108 }
129 109
130 if (this._frameResizedTimer) 110 if (this._frameResizedTimer)
131 clearTimeout(this._frameResizedTimer); 111 clearTimeout(this._frameResizedTimer);
132 112
133 this._frameResizedTimer = setTimeout(refreshContents.bind(this), 100); 113 this._frameResizedTimer = setTimeout(refreshContents.bind(this), 100);
134 }, 114 },
135 115
136 /** 116 onDOMModelChanged: function() { },
137 * @param {!WebInspector.DOMNode} changedNode
138 */
139 onDOMNodeChanged: function(changedNode) { },
140 117
141 onCSSModelChanged: function() { }, 118 onCSSModelChanged: function() { },
142 119
143 onFrameResizedThrottled: function() { }, 120 onFrameResizedThrottled: function() { },
144 121
145 __proto__: WebInspector.SidebarPane.prototype 122 __proto__: WebInspector.SidebarPane.prototype
146 } 123 }
147 124
148 /** 125 /**
149 * @constructor 126 * @constructor
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 * @override 218 * @override
242 * @return {!WebInspector.Widget} 219 * @return {!WebInspector.Widget}
243 */ 220 */
244 view: function() 221 view: function()
245 { 222 {
246 return this; 223 return this;
247 }, 224 },
248 225
249 __proto__: WebInspector.Widget.prototype 226 __proto__: WebInspector.Widget.prototype
250 } 227 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/elements/ElementsPanel.js ('k') | Source/devtools/front_end/elements/MetricsSidebarPane.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698