Chromium Code Reviews| 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)); |
| + } |
| } |
| }; |