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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/CSSWorkspaceBinding.js

Issue 2662513003: DevTools: make StylesSourceMapping in charge of creating and removing UISourceCodes (Closed)
Patch Set: pass tests Created 3 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 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 * @implements {SDK.SDKModelObserver<!SDK.CSSModel>} 6 * @implements {SDK.SDKModelObserver<!SDK.CSSModel>}
7 */ 7 */
8 Bindings.CSSWorkspaceBinding = class { 8 Bindings.CSSWorkspaceBinding = class {
9 /** 9 /**
10 * @param {!SDK.TargetManager} targetManager 10 * @param {!SDK.TargetManager} targetManager
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 /** 91 /**
92 * @param {!SDK.CSSModel} cssModel 92 * @param {!SDK.CSSModel} cssModel
93 * @param {!Workspace.Workspace} workspace 93 * @param {!Workspace.Workspace} workspace
94 */ 94 */
95 constructor(cssModel, workspace) { 95 constructor(cssModel, workspace) {
96 this._eventListeners = [ 96 this._eventListeners = [
97 cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetAdded, this._style SheetAdded, this), 97 cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetAdded, this._style SheetAdded, this),
98 cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetRemoved, this._sty leSheetRemoved, this) 98 cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetRemoved, this._sty leSheetRemoved, this)
99 ]; 99 ];
100 100
101 this._workspace = workspace;
102 var networkProject = Bindings.NetworkProject.forTarget(cssModel.target());
101 this._stylesSourceMapping = new Bindings.StylesSourceMapping(cssModel, works pace); 103 this._stylesSourceMapping = new Bindings.StylesSourceMapping(cssModel, works pace);
102 this._sassSourceMapping = 104 this._sassSourceMapping = new Bindings.SASSSourceMapping(cssModel, workspace , networkProject);
103 new Bindings.SASSSourceMapping(cssModel, workspace, Bindings.NetworkProj ect.forTarget(cssModel.target()));
104 105
105 /** @type {!Multimap<!SDK.CSSStyleSheetHeader, !Bindings.CSSWorkspaceBinding .LiveLocation>} */ 106 /** @type {!Multimap<!SDK.CSSStyleSheetHeader, !Bindings.CSSWorkspaceBinding .LiveLocation>} */
106 this._locations = new Multimap(); 107 this._locations = new Multimap();
107 /** @type {!Multimap<string, !Bindings.CSSWorkspaceBinding.LiveLocation>} */ 108 /** @type {!Multimap<string, !Bindings.CSSWorkspaceBinding.LiveLocation>} */
108 this._unboundLocations = new Multimap(); 109 this._unboundLocations = new Multimap();
109 } 110 }
110 111
111 /** 112 /**
112 * @param {!SDK.CSSLocation} rawLocation 113 * @param {!SDK.CSSLocation} rawLocation
113 * @param {function(!Bindings.LiveLocation)} updateDelegate 114 * @param {function(!Bindings.LiveLocation)} updateDelegate
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 176 }
176 177
177 /** 178 /**
178 * @param {!SDK.CSSLocation} rawLocation 179 * @param {!SDK.CSSLocation} rawLocation
179 * @return {?Workspace.UILocation} 180 * @return {?Workspace.UILocation}
180 */ 181 */
181 _rawLocationToUILocation(rawLocation) { 182 _rawLocationToUILocation(rawLocation) {
182 var uiLocation = null; 183 var uiLocation = null;
183 uiLocation = uiLocation || this._sassSourceMapping.rawLocationToUILocation(r awLocation); 184 uiLocation = uiLocation || this._sassSourceMapping.rawLocationToUILocation(r awLocation);
184 uiLocation = uiLocation || this._stylesSourceMapping.rawLocationToUILocation (rawLocation); 185 uiLocation = uiLocation || this._stylesSourceMapping.rawLocationToUILocation (rawLocation);
185 return uiLocation; 186 if (uiLocation)
187 return uiLocation;
188
189 var header = rawLocation.header();
190 if (!header)
191 return null;
192 var uiSourceCode = Bindings.NetworkProject.uiSourceCodeForStyleURL(this._wor kspace, rawLocation.url, header);
193 if (!uiSourceCode)
194 return null;
195 return uiSourceCode.uiLocation(rawLocation.lineNumber, rawLocation.columnNum ber);
186 } 196 }
187 197
188 _dispose() { 198 _dispose() {
189 Common.EventTarget.removeEventListeners(this._eventListeners); 199 Common.EventTarget.removeEventListeners(this._eventListeners);
190 this._stylesSourceMapping.dispose(); 200 this._stylesSourceMapping.dispose();
191 this._sassSourceMapping.dispose(); 201 this._sassSourceMapping.dispose();
192 } 202 }
193 }; 203 };
194 204
195 /** 205 /**
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 */ 246 */
237 isBlackboxed() { 247 isBlackboxed() {
238 return false; 248 return false;
239 } 249 }
240 }; 250 };
241 251
242 /** 252 /**
243 * @type {!Bindings.CSSWorkspaceBinding} 253 * @type {!Bindings.CSSWorkspaceBinding}
244 */ 254 */
245 Bindings.cssWorkspaceBinding; 255 Bindings.cssWorkspaceBinding;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698