| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 CSSTracker.CSSTrackerView = class extends UI.VBox { | 5 CSSTracker.CSSTrackerView = class extends UI.VBox { |
| 6 constructor() { | 6 constructor() { |
| 7 super(true); | 7 super(true); |
| 8 | 8 |
| 9 this.registerRequiredCSS('css_tracker/cssTrackerView.css'); | 9 this.registerRequiredCSS('css_tracker/cssTrackerView.css'); |
| 10 | 10 |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 /** | 388 /** |
| 389 * @override | 389 * @override |
| 390 * @param {!Workspace.UISourceCode} uiSourceCode | 390 * @param {!Workspace.UISourceCode} uiSourceCode |
| 391 * @param {!TextEditor.CodeMirrorTextEditor} textEditor | 391 * @param {!TextEditor.CodeMirrorTextEditor} textEditor |
| 392 */ | 392 */ |
| 393 decorate(uiSourceCode, textEditor) { | 393 decorate(uiSourceCode, textEditor) { |
| 394 var gutterType = 'CodeMirror-gutter-coverage'; | 394 var gutterType = 'CodeMirror-gutter-coverage'; |
| 395 | 395 |
| 396 var decorations = uiSourceCode.decorationsForType(CSSTracker.CSSTrackerView.
LineDecorator.type); | 396 var decorations = uiSourceCode.decorationsForType(CSSTracker.CSSTrackerView.
LineDecorator.type); |
| 397 textEditor.uninstallGutter(gutterType); | 397 textEditor.uninstallGutter(gutterType); |
| 398 if (!decorations.size) | 398 if (!decorations || !decorations.size) |
| 399 return; | 399 return; |
| 400 | 400 |
| 401 textEditor.installGutter(gutterType, false); | 401 textEditor.installGutter(gutterType, false); |
| 402 | 402 |
| 403 for (var decoration of decorations) { | 403 for (var decoration of decorations) { |
| 404 for (var line = decoration.range().startLine; line <= decoration.range().e
ndLine; ++line) { | 404 for (var line = decoration.range().startLine; line <= decoration.range().e
ndLine; ++line) { |
| 405 var element = createElementWithClass('div'); | 405 var element = createElementWithClass('div'); |
| 406 if (decoration.data()) | 406 if (decoration.data()) |
| 407 element.className = 'text-editor-css-rule-used-marker'; | 407 element.className = 'text-editor-css-rule-used-marker'; |
| 408 else | 408 else |
| 409 element.className = 'text-editor-css-rule-unused-marker'; | 409 element.className = 'text-editor-css-rule-unused-marker'; |
| 410 | 410 |
| 411 textEditor.setGutterDecoration(line, gutterType, element); | 411 textEditor.setGutterDecoration(line, gutterType, element); |
| 412 } | 412 } |
| 413 } | 413 } |
| 414 } | 414 } |
| 415 }; | 415 }; |
| 416 | 416 |
| 417 CSSTracker.CSSTrackerView.LineDecorator.type = 'coverage'; | 417 CSSTracker.CSSTrackerView.LineDecorator.type = 'coverage'; |
| OLD | NEW |