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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/InplaceFormatterEditorAction.js

Issue 2492343002: Devtools: Pretty print fix for CSS coverage decorations. (Closed)
Patch Set: Pretty print fix for CSS coverage decorations. Created 4 years, 1 month 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/sources/InplaceFormatterEditorAction.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/InplaceFormatterEditorAction.js b/third_party/WebKit/Source/devtools/front_end/sources/InplaceFormatterEditorAction.js
index bb98b0119d853385b0d5edd18a319cca7ffe5a0a..9f904e56bb7e86adae6107f1686c0519bcd95d97 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/InplaceFormatterEditorAction.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/InplaceFormatterEditorAction.js
@@ -99,8 +99,36 @@ WebInspector.InplaceFormatterEditorAction = class {
var selection = sourceFrame.selection();
start = formatterMapping.originalToFormatted(selection.startLine, selection.startColumn);
}
+
+ mapCoverageDecorations(formatterMapping);
+
uiSourceCode.setWorkingCopy(formattedContent);
this._sourcesView.showSourceLocation(uiSourceCode, start[0], start[1]);
}
+
+ /**
+ * @param {!WebInspector.FormatterSourceMapping} formatterMapping
+ */
+ function mapCoverageDecorations(formatterMapping) {
+
+ var markers = uiSourceCode._typeDecorations.get('coverage');
caseq 2016/11/11 23:23:39 We treat names starting with underscore as private
lushnikov 2016/11/11 23:28:01 why coverage only? this code should go in Coverage
+ if (!markers)
+ return;
+
+ var needToAdd = [];
+
+ for (var decoration of markers) {
+ uiSourceCode._typeDecorations.remove('coverage', decoration);
+ uiSourceCode._lineDecorations.remove(decoration.line(), decoration);
+
+ var startLine = formatterMapping.originalToFormatted(decoration.line(), decoration.data().startColumn)[0];
+ var endLine = formatterMapping.originalToFormatted(decoration.line(), decoration.data().endColumn)[0];
+
+ for (var line = startLine; line <= endLine; ++line)
+ needToAdd.push({line : line, type : 'coverage', data : decoration.data()});
+ }
+
+ needToAdd.forEach(decoration => uiSourceCode.addLineDecoration(decoration.line, decoration.type, decoration.data));
+ }
}
};

Powered by Google App Engine
This is Rietveld 408576698