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

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

Issue 2856233002: DevTools: support uiLocationToRawLocations for CSS (Closed)
Patch Set: review comments addressed 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/StylesSourceMapping.js
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js b/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js
index f13a4524cb06a264b72ce0d1e3a7b4e4dc55aee8..41c26e1c3de7a24b730082d135723bd4c94dcda8 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js
@@ -74,7 +74,7 @@ Bindings.StylesSourceMapping = class {
return null;
var lineNumber = rawLocation.lineNumber;
var columnNumber = rawLocation.columnNumber;
- if (header && header.isInline && header.hasSourceURL) {
+ if (header.isInline && header.hasSourceURL) {
lineNumber -= header.lineNumberInSource(0);
columnNumber -= header.columnNumberInSource(lineNumber, 0);
}
@@ -82,6 +82,25 @@ Bindings.StylesSourceMapping = class {
}
/**
+ * @override
+ * @param {!Workspace.UILocation} uiLocation
+ * @return {!Array<!SDK.CSSLocation>}
+ */
+ uiLocationToRawLocations(uiLocation) {
+ // TODO(caseq,lushnikov): return multiple raw locations.
+ var header = Bindings.NetworkProject.styleHeaderForUISourceCode(uiLocation.uiSourceCode);
+ if (!header)
+ return [];
+ var lineNumber = uiLocation.lineNumber;
+ var columnNumber = uiLocation.columnNumber;
+ if (header.isInline && header.hasSourceURL) {
+ columnNumber = header.columnNumberInSource(lineNumber, columnNumber);
+ lineNumber = header.lineNumberInSource(lineNumber);
+ }
+ return [new SDK.CSSLocation(header, lineNumber, columnNumber)];
+ }
+
+ /**
* @param {!Common.Event} event
*/
_styleSheetAdded(event) {

Powered by Google App Engine
This is Rietveld 408576698