OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 /** | 57 /** |
58 * @param {!Common.Event} event | 58 * @param {!Common.Event} event |
59 */ | 59 */ |
60 _sourceMapAttached(event) { | 60 _sourceMapAttached(event) { |
61 var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data); | 61 var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data); |
62 var sourceMap = this._cssModel.sourceMapForHeader(header); | 62 var sourceMap = this._cssModel.sourceMapForHeader(header); |
63 for (var sassURL of sourceMap.sourceURLs()) { | 63 for (var sassURL of sourceMap.sourceURLs()) { |
64 var contentProvider = sourceMap.sourceContentProvider(sassURL, Common.reso urceTypes.SourceMapStyleSheet); | 64 var contentProvider = sourceMap.sourceContentProvider(sassURL, Common.reso urceTypes.SourceMapStyleSheet); |
65 var embeddedContent = sourceMap.embeddedContentByURL(sassURL); | 65 var embeddedContent = sourceMap.embeddedContentByURL(sassURL); |
66 var embeddedContentLength = typeof embeddedContent === 'string' ? embedded Content.length : null; | 66 var embeddedContentLength = typeof embeddedContent === 'string' ? embedded Content.length : null; |
67 this._networkProject.addSourceMapFile( | 67 this._networkProject.addSourceMapFile(contentProvider, header.frameId, fal se, embeddedContentLength); |
68 contentProvider, SDK.ResourceTreeFrame.fromStyleSheet(header), false, embeddedContentLength); | |
dgozman
2017/03/17 19:00:21
I think you can cleanup SDK.ResourceTreeFrame.from
lushnikov
2017/03/17 21:21:47
YAY! Done.
| |
69 } | 68 } |
70 Bindings.cssWorkspaceBinding.updateLocations(header); | 69 Bindings.cssWorkspaceBinding.updateLocations(header); |
71 this._sourceMapAttachedForTest(sourceMap); | 70 this._sourceMapAttachedForTest(sourceMap); |
72 } | 71 } |
73 | 72 |
74 /** | 73 /** |
75 * @param {!Common.Event} event | 74 * @param {!Common.Event} event |
76 */ | 75 */ |
77 _sourceMapDetached(event) { | 76 _sourceMapDetached(event) { |
78 var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data); | 77 var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data.header); |
78 var sourceMap = /** @type {!SDK.SourceMap} */ (event.data.sourceMap); | |
79 Bindings.cssWorkspaceBinding.updateLocations(header); | 79 Bindings.cssWorkspaceBinding.updateLocations(header); |
80 for (var sassURL of sourceMap.sourceURLs()) | |
81 this._networkProject.removeSourceMapFile(sassURL, header.frameId, false); | |
80 } | 82 } |
81 | 83 |
82 /** | 84 /** |
83 * @param {!Common.Event} event | 85 * @param {!Common.Event} event |
84 */ | 86 */ |
85 _sourceMapChanged(event) { | 87 _sourceMapChanged(event) { |
86 var sourceMap = /** @type {!SDK.SourceMap} */ (event.data.sourceMap); | 88 var sourceMap = /** @type {!SDK.SourceMap} */ (event.data.sourceMap); |
87 var newSources = /** @type {!Map<string, string>} */ (event.data.newSources) ; | 89 var newSources = /** @type {!Map<string, string>} */ (event.data.newSources) ; |
88 var headers = this._cssModel.headersForSourceMap(sourceMap); | 90 var headers = this._cssModel.headersForSourceMap(sourceMap); |
89 var handledUISourceCodes = new Set(); | 91 var handledUISourceCodes = new Set(); |
(...skipping 30 matching lines...) Expand all Loading... | |
120 return null; | 122 return null; |
121 var uiSourceCode = Bindings.NetworkProject.uiSourceCodeForStyleURL(this._wor kspace, entry.sourceURL, header); | 123 var uiSourceCode = Bindings.NetworkProject.uiSourceCodeForStyleURL(this._wor kspace, entry.sourceURL, header); |
122 if (!uiSourceCode) | 124 if (!uiSourceCode) |
123 return null; | 125 return null; |
124 return uiSourceCode.uiLocation(entry.sourceLineNumber || 0, entry.sourceColu mnNumber); | 126 return uiSourceCode.uiLocation(entry.sourceLineNumber || 0, entry.sourceColu mnNumber); |
125 } | 127 } |
126 | 128 |
127 dispose() { | 129 dispose() { |
128 Common.EventTarget.removeEventListeners(this._eventListeners); | 130 Common.EventTarget.removeEventListeners(this._eventListeners); |
129 } | 131 } |
130 }; | 132 }; |
OLD | NEW |