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

Unified Diff: third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
diff --git a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
index 60e4f4fe32593213ead4c32aca19740254c33b70..99209626d2de29ad548f7a9b75fa2644981ca10c 100644
--- a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
+++ b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
@@ -60,8 +60,8 @@ Workspace.UISourceCode = class extends Common.Object {
this._requestContentCallback = null;
/** @type {?Promise<?string>} */
this._requestContentPromise = null;
- /** @type {!Map<string, !Map<number, !Workspace.UISourceCode.LineMarker>>} */
- this._lineDecorations = new Map();
+ /** @type {!Multimap<string, !Workspace.UISourceCode.LineMarker>} */
+ this._decorations = new Multimap();
/** @type {!Array.<!Workspace.Revision>} */
this.history = [];
@@ -608,52 +608,51 @@ Workspace.UISourceCode = class extends Common.Object {
* @param {?} data
*/
addLineDecoration(lineNumber, type, data) {
- var markers = this._lineDecorations.get(type);
- if (!markers) {
- markers = new Map();
- this._lineDecorations.set(type, markers);
- }
- var marker = new Workspace.UISourceCode.LineMarker(lineNumber, type, data);
- markers.set(lineNumber, marker);
- this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecorationAdded, marker);
+ this.addDecoration(Common.TextRange.createFromLocation(lineNumber, 0), type, data);
}
/**
- * @param {number} lineNumber
+ * @param {!Common.TextRange} range
* @param {string} type
+ * @param {?} data
*/
- removeLineDecoration(lineNumber, type) {
- var markers = this._lineDecorations.get(type);
- if (!markers)
- return;
- var marker = markers.get(lineNumber);
- if (!marker)
- return;
- markers.delete(lineNumber);
- this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecorationRemoved, marker);
- if (!markers.size)
- this._lineDecorations.delete(type);
+ addDecoration(range, type, data) {
+ var marker = new Workspace.UISourceCode.LineMarker(range, type, data);
+ this._decorations.set(type, marker);
+ this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecorationAdded, marker);
}
/**
* @param {string} type
*/
- removeAllLineDecorations(type) {
- var markers = this._lineDecorations.get(type);
- if (!markers)
- return;
- this._lineDecorations.delete(type);
+ removeDecorationsForType(type) {
+ var markers = this._decorations.get(type);
+ this._decorations.removeAll(type);
markers.forEach(marker => {
this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecorationRemoved, marker);
});
}
/**
+ * @return {!Array<!Workspace.UISourceCode.LineMarker>}
+ */
+ allDecorations() {
+ return this._decorations.valuesArray();
+ }
+
+ removeAllDecorations() {
+ var decorationList = this._decorations.valuesArray();
+ this._decorations.clear();
+ decorationList.forEach(marker =>
+ this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecorationRemoved, marker));
+ }
+
+ /**
* @param {string} type
- * @return {?Map<number, !Workspace.UISourceCode.LineMarker>}
+ * @return {!Set<!Workspace.UISourceCode.LineMarker>}
*/
- lineDecorations(type) {
- return this._lineDecorations.get(type) || null;
+ decorationsForType(type) {
+ return this._decorations.get(type);
}
};
@@ -906,21 +905,21 @@ Workspace.UISourceCode.Message.Level = {
*/
Workspace.UISourceCode.LineMarker = class {
/**
- * @param {number} line
+ * @param {!Common.TextRange} range
* @param {string} type
* @param {?} data
*/
- constructor(line, type, data) {
- this._line = line;
+ constructor(range, type, data) {
+ this._range = range;
this._type = type;
this._data = data;
}
/**
- * @return {number}
+ * @return {!Common.TextRange}
*/
- line() {
- return this._line;
+ range() {
+ return this._range;
}
/**
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698