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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/source_frame/UISourceCodeFrame.js

Issue 2762443002: DevTools: Only show gutter diff for Network UISourceCodes (Closed)
Patch Set: doc Created 3 years, 9 months 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/source_frame/SourceCodeDiff.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 21 matching lines...) Expand all
32 SourceFrame.UISourceCodeFrame = class extends SourceFrame.SourceFrame { 32 SourceFrame.UISourceCodeFrame = class extends SourceFrame.SourceFrame {
33 /** 33 /**
34 * @param {!Workspace.UISourceCode} uiSourceCode 34 * @param {!Workspace.UISourceCode} uiSourceCode
35 */ 35 */
36 constructor(uiSourceCode) { 36 constructor(uiSourceCode) {
37 super(uiSourceCode.contentURL(), workingCopy); 37 super(uiSourceCode.contentURL(), workingCopy);
38 this._uiSourceCode = uiSourceCode; 38 this._uiSourceCode = uiSourceCode;
39 this.setEditable(this._canEditSource()); 39 this.setEditable(this._canEditSource());
40 40
41 if (Runtime.experiments.isEnabled('sourceDiff')) 41 if (Runtime.experiments.isEnabled('sourceDiff'))
42 this._diff = new SourceFrame.SourceCodeDiff(WorkspaceDiff.workspaceDiff(), uiSourceCode, this.textEditor); 42 this._diff = new SourceFrame.SourceCodeDiff(WorkspaceDiff.workspaceDiff(), this.textEditor);
43 43
44 44
45 /** @type {?UI.AutocompleteConfig} */ 45 /** @type {?UI.AutocompleteConfig} */
46 this._autocompleteConfig = {isWordChar: Common.TextUtils.isWordChar}; 46 this._autocompleteConfig = {isWordChar: Common.TextUtils.isWordChar};
47 Common.moduleSetting('textEditorAutocompletion').addChangeListener(this._upd ateAutocomplete, this); 47 Common.moduleSetting('textEditorAutocompletion').addChangeListener(this._upd ateAutocomplete, this);
48 this._updateAutocomplete(); 48 this._updateAutocomplete();
49 49
50 /** @type {?Persistence.PersistenceBinding} */ 50 /** @type {?Persistence.PersistenceBinding} */
51 this._persistenceBinding = Persistence.persistence.binding(uiSourceCode); 51 this._persistenceBinding = Persistence.persistence.binding(uiSourceCode);
52 52
(...skipping 12 matching lines...) Expand all
65 Persistence.persistence.subscribeForBindingEvent(this._uiSourceCode, this._o nBindingChanged.bind(this)); 65 Persistence.persistence.subscribeForBindingEvent(this._uiSourceCode, this._o nBindingChanged.bind(this));
66 66
67 this.textEditor.addEventListener( 67 this.textEditor.addEventListener(
68 SourceFrame.SourcesTextEditor.Events.EditorBlurred, 68 SourceFrame.SourcesTextEditor.Events.EditorBlurred,
69 () => UI.context.setFlavor(SourceFrame.UISourceCodeFrame, null)); 69 () => UI.context.setFlavor(SourceFrame.UISourceCodeFrame, null));
70 this.textEditor.addEventListener( 70 this.textEditor.addEventListener(
71 SourceFrame.SourcesTextEditor.Events.EditorFocused, 71 SourceFrame.SourcesTextEditor.Events.EditorFocused,
72 () => UI.context.setFlavor(SourceFrame.UISourceCodeFrame, this)); 72 () => UI.context.setFlavor(SourceFrame.UISourceCodeFrame, this));
73 73
74 this._updateStyle(); 74 this._updateStyle();
75 this._updateDiffUISourceCode();
75 76
76 this._errorPopoverHelper = new UI.PopoverHelper(this.element); 77 this._errorPopoverHelper = new UI.PopoverHelper(this.element);
77 this._errorPopoverHelper.initializeCallbacks(this._getErrorAnchor.bind(this) , this._showErrorPopover.bind(this)); 78 this._errorPopoverHelper.initializeCallbacks(this._getErrorAnchor.bind(this) , this._showErrorPopover.bind(this));
78 this._errorPopoverHelper.setHasPadding(true); 79 this._errorPopoverHelper.setHasPadding(true);
79 80
80 this._errorPopoverHelper.setTimeout(100, 100); 81 this._errorPopoverHelper.setTimeout(100, 100);
81 82
82 /** 83 /**
83 * @return {!Promise<?string>} 84 * @return {!Promise<?string>}
84 */ 85 */
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 this._removeMessageFromSource(message); 232 this._removeMessageFromSource(message);
232 Common.EventTarget.removeEventListeners(this._messageAndDecorationListeners) ; 233 Common.EventTarget.removeEventListeners(this._messageAndDecorationListeners) ;
233 234
234 this._persistenceBinding = binding; 235 this._persistenceBinding = binding;
235 236
236 for (var message of this._allMessages()) 237 for (var message of this._allMessages())
237 this._addMessageToSource(message); 238 this._addMessageToSource(message);
238 this._installMessageAndDecorationListeners(); 239 this._installMessageAndDecorationListeners();
239 this._updateStyle(); 240 this._updateStyle();
240 this._decorateAllTypes(); 241 this._decorateAllTypes();
242 this._updateDiffUISourceCode();
241 this.onBindingChanged(); 243 this.onBindingChanged();
242 } 244 }
243 245
244 /** 246 /**
245 * @protected 247 * @protected
246 */ 248 */
247 onBindingChanged() { 249 onBindingChanged() {
248 // Overriden in subclasses. 250 // Overriden in subclasses.
249 } 251 }
250 252
253 _updateDiffUISourceCode() {
254 if (!this._diff)
255 return;
256 if (this._persistenceBinding)
257 this._diff.setUISourceCode(this._persistenceBinding.network);
258 else if (this._uiSourceCode.project().type() === Workspace.projectTypes.Netw ork)
259 this._diff.setUISourceCode(this._uiSourceCode);
260 else
261 this._diff.setUISourceCode(null);
262 }
263
251 _updateStyle() { 264 _updateStyle() {
252 this.element.classList.toggle( 265 this.element.classList.toggle(
253 'source-frame-unsaved-committed-changes', 266 'source-frame-unsaved-committed-changes',
254 Persistence.persistence.hasUnsavedCommittedChanges(this._uiSourceCode)); 267 Persistence.persistence.hasUnsavedCommittedChanges(this._uiSourceCode));
255 this.setEditable(this._canEditSource()); 268 this.setEditable(this._canEditSource());
256 } 269 }
257 270
258 onUISourceCodeContentChanged() { 271 onUISourceCodeContentChanged() {
259 } 272 }
260 273
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 695
683 /** 696 /**
684 * @param {!Workspace.UISourceCode.Message} a 697 * @param {!Workspace.UISourceCode.Message} a
685 * @param {!Workspace.UISourceCode.Message} b 698 * @param {!Workspace.UISourceCode.Message} b
686 * @return {number} 699 * @return {number}
687 */ 700 */
688 Workspace.UISourceCode.Message.messageLevelComparator = function(a, b) { 701 Workspace.UISourceCode.Message.messageLevelComparator = function(a, b) {
689 return Workspace.UISourceCode.Message._messageLevelPriority[a.level()] - 702 return Workspace.UISourceCode.Message._messageLevelPriority[a.level()] -
690 Workspace.UISourceCode.Message._messageLevelPriority[b.level()]; 703 Workspace.UISourceCode.Message._messageLevelPriority[b.level()];
691 }; 704 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/source_frame/SourceCodeDiff.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698