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

Unified Diff: third_party/WebKit/Source/devtools/front_end/bindings/SASSSourceMapping.js

Issue 2856233002: DevTools: support uiLocationToRawLocations for CSS (Closed)
Patch Set: Created 3 years, 8 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/bindings/SASSSourceMapping.js
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/SASSSourceMapping.js b/third_party/WebKit/Source/devtools/front_end/bindings/SASSSourceMapping.js
index a4917740196ddb73631a302f2f9e8efb1e20b2c2..844bcd3bd87ce4c085d24d0558f9dbc1d58f87e9 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/SASSSourceMapping.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/SASSSourceMapping.js
@@ -87,7 +87,9 @@ Bindings.SASSSourceMapping = class {
var contentProvider = sourceMap.sourceContentProvider(sassURL, Common.resourceTypes.SourceMapStyleSheet);
var embeddedContent = sourceMap.embeddedContentByURL(sassURL);
var embeddedContentLength = typeof embeddedContent === 'string' ? embeddedContent.length : null;
- this._networkProject.addSourceMapFile(contentProvider, header.frameId, false, embeddedContentLength);
+ var uiSourceCode =
+ this._networkProject.addSourceMapFile(contentProvider, header.frameId, false, embeddedContentLength);
+ uiSourceCode[Bindings.SASSSourceMapping._sourceMapSymbol] = sourceMap;
}
Bindings.cssWorkspaceBinding.updateLocations(header);
this._sourceMapAttachedForTest(sourceMap);
@@ -127,6 +129,7 @@ Bindings.SASSSourceMapping = class {
if (handledUISourceCodes.has(uiSourceCode))
continue;
handledUISourceCodes.add(uiSourceCode);
+ uiSourceCode[Bindings.SASSSourceMapping._sourceMapSymbol] = sourceMap;
var sassText = /** @type {string} */ (newSources.get(sourceURL));
uiSourceCode.setWorkingCopy(sassText);
}
@@ -154,7 +157,24 @@ Bindings.SASSSourceMapping = class {
return uiSourceCode.uiLocation(entry.sourceLineNumber || 0, entry.sourceColumnNumber);
}
+ /**
+ * @override
+ * @param {!Workspace.UILocation} uiLocation
+ * @return {!Array<!SDK.CSSLocation>}
+ */
+ uiLocationToRawLocations(uiLocation) {
+ var sourceMap = uiLocation.uiSourceCode[Bindings.SASSSourceMapping._sourceMapSymbol];
+ if (!sourceMap)
+ return [];
+ var headers = this._sourceMapManager.clientsForSourceMap(sourceMap);
+ var entry =
+ sourceMap.findReverseEntry(uiLocation.uiSourceCode.url(), uiLocation.lineNumber, uiLocation.columnNumber);
dgozman 2017/05/04 00:04:56 Could there be multiple?
+ return headers.map(header => new SDK.CSSLocation(header, entry.lineNumber, entry.columnNumber));
+ }
+
dispose() {
Common.EventTarget.removeEventListeners(this._eventListeners);
}
-};
+};
+
+Bindings.SASSSourceMapping._sourceMapSymbol = Symbol('sourceMap');

Powered by Google App Engine
This is Rietveld 408576698