| 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 fff83b1dbd5d7b5996a6295f93f7bbae49450319..8bb4a8d4896c4ca45189ddc93e6136ff15b27679 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 {!Map<string, !Map<!Common.TextRange, !Workspace.UISourceCode.LineMarker>>} */
|
| + this._decorations = new Map();
|
|
|
| /** @type {!Array.<!Workspace.Revision>} */
|
| this.history = [];
|
| @@ -606,13 +606,22 @@ Workspace.UISourceCode = class extends Common.Object {
|
| * @param {?} data
|
| */
|
| addLineDecoration(lineNumber, type, data) {
|
| - var markers = this._lineDecorations.get(type);
|
| + this.addDecoration(Common.TextRange.createFromLocation(lineNumber, 0), type, data);
|
| + }
|
| +
|
| + /**
|
| + * @param {!Common.TextRange} range
|
| + * @param {string} type
|
| + * @param {?} data
|
| + */
|
| + addDecoration(range, type, data) {
|
| + var markers = this._decorations.get(type);
|
| if (!markers) {
|
| markers = new Map();
|
| - this._lineDecorations.set(type, markers);
|
| + this._decorations.set(type, markers);
|
| }
|
| - var marker = new Workspace.UISourceCode.LineMarker(lineNumber, type, data);
|
| - markers.set(lineNumber, marker);
|
| + var marker = new Workspace.UISourceCode.LineMarker(range.startLine, type, data);
|
| + markers.set(range, marker);
|
| this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecorationAdded, marker);
|
| }
|
|
|
| @@ -621,37 +630,56 @@ Workspace.UISourceCode = class extends Common.Object {
|
| * @param {string} type
|
| */
|
| removeLineDecoration(lineNumber, type) {
|
| - var markers = this._lineDecorations.get(type);
|
| + this.removeDecoration(Common.TextRange.createFromLocation(lineNumber, 0), type);
|
| + }
|
| +
|
| + /**
|
| + * @param {!Common.TextRange} range
|
| + * @param {string} type
|
| + */
|
| + removeDecoration(range, type) {
|
| + var markers = this._decorations.get(type);
|
| if (!markers)
|
| return;
|
| - var marker = markers.get(lineNumber);
|
| + var marker = markers.get(range);
|
| if (!marker)
|
| return;
|
| - markers.delete(lineNumber);
|
| + markers.delete(range);
|
| this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecorationRemoved, marker);
|
| if (!markers.size)
|
| - this._lineDecorations.delete(type);
|
| + this._decorations.delete(type);
|
| }
|
|
|
| /**
|
| * @param {string} type
|
| */
|
| removeAllLineDecorations(type) {
|
| - var markers = this._lineDecorations.get(type);
|
| + var markers = this._decorations.get(type);
|
| if (!markers)
|
| return;
|
| - this._lineDecorations.delete(type);
|
| + this._decorations.delete(type);
|
| markers.forEach(marker => {
|
| this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecorationRemoved, marker);
|
| });
|
| }
|
|
|
| /**
|
| + * @return {!Map<string, !Map<!Common.TextRange, !Workspace.UISourceCode.LineMarker>>}
|
| + */
|
| + allLineDecorations() {
|
| + return this._decorations;
|
| + }
|
| +
|
| + removeAllDecorations() {
|
| + this._decorations.clear();
|
| + }
|
| +
|
| + /**
|
| * @param {string} type
|
| - * @return {?Map<number, !Workspace.UISourceCode.LineMarker>}
|
| + * @return {?Map<!Common.TextRange, !Workspace.UISourceCode.LineMarker>}
|
| */
|
| lineDecorations(type) {
|
| - return this._lineDecorations.get(type) || null;
|
| + return this._decorations.get(type) || null;
|
| }
|
| };
|
|
|
|
|