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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components_lazy/CoverageProfile.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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 WebInspector.CoverageProfile = class { 5 WebInspector.CoverageProfile = class {
6 constructor() { 6 constructor() {
7 this._updateTimer = null; 7 this._updateTimer = null;
8 this.reset(); 8 this.reset();
9 } 9 }
10 10
(...skipping 12 matching lines...) Expand all
23 * @param {!Protocol.CSS.SourceRange} range 23 * @param {!Protocol.CSS.SourceRange} range
24 */ 24 */
25 appendUnusedRule(url, range) { 25 appendUnusedRule(url, range) {
26 if (!url) 26 if (!url)
27 return; 27 return;
28 28
29 var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(url); 29 var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(url);
30 if (!uiSourceCode) 30 if (!uiSourceCode)
31 return; 31 return;
32 32
33 if (range.startColumn)
lushnikov 2016/11/11 23:28:01 why is this?
34 range.startColumn--;
33 for (var line = range.startLine; line <= range.endLine; ++line) 35 for (var line = range.startLine; line <= range.endLine; ++line)
34 uiSourceCode.addLineDecoration(line, WebInspector.CoverageProfile.LineDeco rator.type, range.startColumn); 36 uiSourceCode.addLineDecoration(line, WebInspector.CoverageProfile.LineDeco rator.type, range);
35 } 37 }
36 38
37 reset() { 39 reset() {
38 WebInspector.workspace.uiSourceCodes().forEach( 40 WebInspector.workspace.uiSourceCodes().forEach(
39 uiSourceCode => uiSourceCode.removeAllLineDecorations(WebInspector.Cover ageProfile.LineDecorator.type)); 41 uiSourceCode => uiSourceCode.removeAllLineDecorations(WebInspector.Cover ageProfile.LineDecorator.type));
40 } 42 }
41 }; 43 };
42 44
43 /** 45 /**
44 * @implements {WebInspector.UISourceCodeFrame.LineDecorator} 46 * @implements {WebInspector.UISourceCodeFrame.LineDecorator}
45 */ 47 */
46 WebInspector.CoverageProfile.LineDecorator = class { 48 WebInspector.CoverageProfile.LineDecorator = class {
47 /** 49 /**
48 * @override 50 * @override
49 * @param {!WebInspector.UISourceCode} uiSourceCode 51 * @param {!WebInspector.UISourceCode} uiSourceCode
50 * @param {!WebInspector.CodeMirrorTextEditor} textEditor 52 * @param {!WebInspector.CodeMirrorTextEditor} textEditor
51 */ 53 */
52 decorate(uiSourceCode, textEditor) { 54 decorate(uiSourceCode, textEditor) {
53 var gutterType = 'CodeMirror-gutter-coverage'; 55 var gutterType = 'CodeMirror-gutter-coverage';
54 56
55 var decorations = uiSourceCode.lineDecorations(WebInspector.CoverageProfile. LineDecorator.type); 57 var decorations = uiSourceCode.lineDecorations(WebInspector.CoverageProfile. LineDecorator.type);
56 textEditor.uninstallGutter(gutterType); 58 textEditor.uninstallGutter(gutterType);
57 if (!decorations) 59 if (!decorations || !decorations.size)
58 return; 60 return;
59 61
60 textEditor.installGutter(gutterType, false); 62 textEditor.installGutter(gutterType, false);
61 63
62 for (var decoration of decorations.values()) { 64 for (var decoration of decorations) {
63 var element = createElementWithClass('div', 'text-editor-line-marker-cover age'); 65 var element = createElementWithClass('div', 'text-editor-line-marker-cover age');
64 textEditor.setGutterDecoration(decoration.line(), gutterType, element); 66 textEditor.setGutterDecoration(decoration.line(), gutterType, element);
65 } 67 }
66 } 68 }
67 }; 69 };
68 70
69 WebInspector.CoverageProfile.LineDecorator.type = 'coverage'; 71 WebInspector.CoverageProfile.LineDecorator.type = 'coverage';
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698