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

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 b703d279eb5cec8055e0a3d25cdda210bc4dd2c6..d424ba078113d6870624fd3b35b9d8e0121612f3 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/InplaceFormatterEditorAction.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/InplaceFormatterEditorAction.js
@@ -99,7 +99,42 @@ Sources.InplaceFormatterEditorAction = class {
start = formatterMapping.originalToFormatted(selection.startLine, selection.startColumn);
}
uiSourceCode.setWorkingCopy(formattedContent);
+ this._formatDecorations(uiSourceCode, formatterMapping);
+
this._sourcesView.showSourceLocation(uiSourceCode, start[0], start[1]);
}
}
+
+ /**
+ * @param {!Workspace.UISourceCode} uiSourceCode
+ * @param {!Sources.FormatterSourceMapping} sourceMapping
+ */
+ _formatDecorations(uiSourceCode, sourceMapping) {
+ if (!uiSourceCode.allDecorations())
+ return;
+
+ /** @type {!Array<!Workspace.UISourceCode.LineMarker>} */
+ var decorationList = [];
+
+ uiSourceCode.allDecorations().forEach(decoration => decorationList.push(decoration));
lushnikov 2016/11/17 17:55:52 let's do the following: _formatDecorations(uiSour
+
+ uiSourceCode.removeAllDecorations();
+
+ for (var decoration of decorationList) {
+ var formattedStartLine = sourceMapping.originalToFormatted(decoration.range().startLine,
+ decoration.range().startColumn)[0];
+ var formattedStartColumn = sourceMapping.originalToFormatted(decoration.range().startLine,
+ decoration.range().startColumn)[1];
+
+ var formattedEndLine = sourceMapping.originalToFormatted(decoration.range().endLine,
+ decoration.range().endColumn)[0];
+ var formattedEndColumn = sourceMapping.originalToFormatted(decoration.range().endLine,
+ decoration.range().endColumn)[1];
+
+ uiSourceCode.addDecoration(new Common.TextRange(formattedStartLine, formattedStartColumn,
+ formattedEndLine, formattedEndColumn),
+ /** @type {string} */ (decoration.type()),
+ decoration.data());
+ }
+ }
};

Powered by Google App Engine
This is Rietveld 408576698