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

Unified Diff: third_party/WebKit/Source/devtools/front_end/components_lazy/LineLevelProfile.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/components_lazy/LineLevelProfile.js
diff --git a/third_party/WebKit/Source/devtools/front_end/components_lazy/LineLevelProfile.js b/third_party/WebKit/Source/devtools/front_end/components_lazy/LineLevelProfile.js
index bdcaeebbf0b30f836e8a4782cae88799b4e95955..d202c80c06aea5495ca1acec52241ed32935c6a2 100644
--- a/third_party/WebKit/Source/devtools/front_end/components_lazy/LineLevelProfile.js
+++ b/third_party/WebKit/Source/devtools/front_end/components_lazy/LineLevelProfile.js
@@ -67,7 +67,7 @@ Components.LineLevelProfile = class {
// TODO(alph): use scriptId instead of urls for the target.
this._locationPool.disposeAll();
Workspace.workspace.uiSourceCodes().forEach(
- uiSourceCode => uiSourceCode.removeAllLineDecorations(Components.LineLevelProfile.LineDecorator.type));
+ uiSourceCode => uiSourceCode.removeDecorationsForType(Components.LineLevelProfile.LineDecorator.type));
for (var fileInfo of this._files) {
var url = /** @type {string} */ (fileInfo[0]);
var uiSourceCode = Workspace.workspace.uiSourceCodeForURL(url);
@@ -109,10 +109,6 @@ Components.LineLevelProfile.Presentation = class {
* @param {!Bindings.LiveLocation} liveLocation
*/
updateLocation(liveLocation) {
- if (this._uiLocation) {
valih 2016/11/17 01:26:37 it is ok to not remove decorations from the unform
lushnikov 2016/11/17 17:55:52 Doesn't this mean that whenever the formatted file
- this._uiLocation.uiSourceCode.removeLineDecoration(
- this._uiLocation.lineNumber, Components.LineLevelProfile.LineDecorator.type);
- }
this._uiLocation = liveLocation.uiLocation();
if (this._uiLocation) {
this._uiLocation.uiSourceCode.addLineDecoration(
@@ -133,19 +129,19 @@ Components.LineLevelProfile.LineDecorator = class {
*/
decorate(uiSourceCode, textEditor) {
var gutterType = 'CodeMirror-gutter-performance';
- var decorations = uiSourceCode.lineDecorations(Components.LineLevelProfile.LineDecorator.type);
+ var decorations = uiSourceCode.decorationsForType(Components.LineLevelProfile.LineDecorator.type);
textEditor.uninstallGutter(gutterType);
- if (!decorations)
+ if (!decorations.size)
return;
textEditor.installGutter(gutterType, false);
- for (var decoration of decorations.values()) {
+ for (var decoration of decorations) {
var time = /** @type {number} */ (decoration.data());
var text = Common.UIString('%.1f\xa0ms', time);
var intensity = Number.constrain(Math.log10(1 + 2 * time) / 5, 0.02, 1);
var element = createElementWithClass('div', 'text-editor-line-marker-performance');
element.textContent = text;
element.style.backgroundColor = `hsla(44, 100%, 50%, ${intensity.toFixed(3)})`;
- textEditor.setGutterDecoration(decoration.line(), gutterType, element);
+ textEditor.setGutterDecoration(decoration.range().startLine, gutterType, element);
}
}
};

Powered by Google App Engine
This is Rietveld 408576698