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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 this._origin = ''; 53 this._origin = '';
54 this._parentURL = ''; 54 this._parentURL = '';
55 this._name = url; 55 this._name = url;
56 } 56 }
57 57
58 this._contentType = contentType; 58 this._contentType = contentType;
59 /** @type {?function(?string)} */ 59 /** @type {?function(?string)} */
60 this._requestContentCallback = null; 60 this._requestContentCallback = null;
61 /** @type {?Promise<?string>} */ 61 /** @type {?Promise<?string>} */
62 this._requestContentPromise = null; 62 this._requestContentPromise = null;
63 /** @type {!Map<string, !Map<number, !Workspace.UISourceCode.LineMarker>>} * / 63 /** @type {!Multimap<string, !Workspace.UISourceCode.LineMarker>} */
64 this._lineDecorations = new Map(); 64 this._decorations = new Multimap();
65 65
66 /** @type {!Array.<!Workspace.Revision>} */ 66 /** @type {!Array.<!Workspace.Revision>} */
67 this.history = []; 67 this.history = [];
68 68
69 /** @type {!Array<!Workspace.UISourceCode.Message>} */ 69 /** @type {!Array<!Workspace.UISourceCode.Message>} */
70 this._messages = []; 70 this._messages = [];
71 } 71 }
72 72
73 /** 73 /**
74 * @return {!Promise<?Workspace.UISourceCodeMetadata>} 74 * @return {!Promise<?Workspace.UISourceCodeMetadata>}
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 for (var message of messages) 601 for (var message of messages)
602 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved , message); 602 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved , message);
603 } 603 }
604 604
605 /** 605 /**
606 * @param {number} lineNumber 606 * @param {number} lineNumber
607 * @param {string} type 607 * @param {string} type
608 * @param {?} data 608 * @param {?} data
609 */ 609 */
610 addLineDecoration(lineNumber, type, data) { 610 addLineDecoration(lineNumber, type, data) {
611 var markers = this._lineDecorations.get(type); 611 this.addDecoration(Common.TextRange.createFromLocation(lineNumber, 0), type, data);
612 if (!markers) {
613 markers = new Map();
614 this._lineDecorations.set(type, markers);
615 }
616 var marker = new Workspace.UISourceCode.LineMarker(lineNumber, type, data);
617 markers.set(lineNumber, marker);
618 this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecorationAd ded, marker);
619 } 612 }
620 613
621 /** 614 /**
622 * @param {number} lineNumber 615 * @param {!Common.TextRange} range
623 * @param {string} type 616 * @param {string} type
617 * @param {?} data
624 */ 618 */
625 removeLineDecoration(lineNumber, type) { 619 addDecoration(range, type, data) {
626 var markers = this._lineDecorations.get(type); 620 var marker = new Workspace.UISourceCode.LineMarker(range, type, data);
627 if (!markers) 621 this._decorations.set(type, marker);
628 return; 622 this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecorationAd ded, marker);
629 var marker = markers.get(lineNumber);
630 if (!marker)
631 return;
632 markers.delete(lineNumber);
633 this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecorationRe moved, marker);
634 if (!markers.size)
635 this._lineDecorations.delete(type);
636 } 623 }
637 624
638 /** 625 /**
639 * @param {string} type 626 * @param {string} type
640 */ 627 */
641 removeAllLineDecorations(type) { 628 removeDecorationsForType(type) {
642 var markers = this._lineDecorations.get(type); 629 var markers = this._decorations.get(type);
643 if (!markers) 630 this._decorations.removeAll(type);
644 return;
645 this._lineDecorations.delete(type);
646 markers.forEach(marker => { 631 markers.forEach(marker => {
647 this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecoration Removed, marker); 632 this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecoration Removed, marker);
648 }); 633 });
649 } 634 }
650 635
651 /** 636 /**
637 * @return {!Array<!Workspace.UISourceCode.LineMarker>}
638 */
639 allDecorations() {
640 return this._decorations.valuesArray();
641 }
642
643 removeAllDecorations() {
644 var decorationList = this._decorations.valuesArray();
645 this._decorations.clear();
646 decorationList.forEach(marker =>
647 this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecorati onRemoved, marker));
648 }
649
650 /**
652 * @param {string} type 651 * @param {string} type
653 * @return {?Map<number, !Workspace.UISourceCode.LineMarker>} 652 * @return {!Set<!Workspace.UISourceCode.LineMarker>}
654 */ 653 */
655 lineDecorations(type) { 654 decorationsForType(type) {
656 return this._lineDecorations.get(type) || null; 655 return this._decorations.get(type);
657 } 656 }
658 }; 657 };
659 658
660 /** @enum {symbol} */ 659 /** @enum {symbol} */
661 Workspace.UISourceCode.Events = { 660 Workspace.UISourceCode.Events = {
662 WorkingCopyChanged: Symbol('WorkingCopyChanged'), 661 WorkingCopyChanged: Symbol('WorkingCopyChanged'),
663 WorkingCopyCommitted: Symbol('WorkingCopyCommitted'), 662 WorkingCopyCommitted: Symbol('WorkingCopyCommitted'),
664 TitleChanged: Symbol('TitleChanged'), 663 TitleChanged: Symbol('TitleChanged'),
665 SourceMappingChanged: Symbol('SourceMappingChanged'), 664 SourceMappingChanged: Symbol('SourceMappingChanged'),
666 MessageAdded: Symbol('MessageAdded'), 665 MessageAdded: Symbol('MessageAdded'),
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 Workspace.UISourceCode.Message.Level = { 898 Workspace.UISourceCode.Message.Level = {
900 Error: 'Error', 899 Error: 'Error',
901 Warning: 'Warning' 900 Warning: 'Warning'
902 }; 901 };
903 902
904 /** 903 /**
905 * @unrestricted 904 * @unrestricted
906 */ 905 */
907 Workspace.UISourceCode.LineMarker = class { 906 Workspace.UISourceCode.LineMarker = class {
908 /** 907 /**
909 * @param {number} line 908 * @param {!Common.TextRange} range
910 * @param {string} type 909 * @param {string} type
911 * @param {?} data 910 * @param {?} data
912 */ 911 */
913 constructor(line, type, data) { 912 constructor(range, type, data) {
914 this._line = line; 913 this._range = range;
915 this._type = type; 914 this._type = type;
916 this._data = data; 915 this._data = data;
917 } 916 }
918 917
919 /** 918 /**
920 * @return {number} 919 * @return {!Common.TextRange}
921 */ 920 */
922 line() { 921 range() {
923 return this._line; 922 return this._range;
924 } 923 }
925 924
926 /** 925 /**
927 * @return {string} 926 * @return {string}
928 */ 927 */
929 type() { 928 type() {
930 return this._type; 929 return this._type;
931 } 930 }
932 931
933 /** 932 /**
(...skipping 10 matching lines...) Expand all
944 Workspace.UISourceCodeMetadata = class { 943 Workspace.UISourceCodeMetadata = class {
945 /** 944 /**
946 * @param {?Date} modificationTime 945 * @param {?Date} modificationTime
947 * @param {?number} contentSize 946 * @param {?number} contentSize
948 */ 947 */
949 constructor(modificationTime, contentSize) { 948 constructor(modificationTime, contentSize) {
950 this.modificationTime = modificationTime; 949 this.modificationTime = modificationTime;
951 this.contentSize = contentSize; 950 this.contentSize = contentSize;
952 } 951 }
953 }; 952 };
OLDNEW
« 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