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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/InplaceFormatterEditorAction.js

Issue 2349343002: DevTools: introduce persistence/ module (Closed)
Patch Set: bring sanity to workspace-mapping.html Created 4 years, 2 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
OLDNEW
1 1
2 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 /** 6 /**
7 * @constructor 7 * @constructor
8 * @implements {WebInspector.SourcesView.EditorAction} 8 * @implements {WebInspector.SourcesView.EditorAction}
9 */ 9 */
10 WebInspector.InplaceFormatterEditorAction = function() 10 WebInspector.InplaceFormatterEditorAction = function()
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 /** 63 /**
64 * @param {?WebInspector.UISourceCode} uiSourceCode 64 * @param {?WebInspector.UISourceCode} uiSourceCode
65 * @return {boolean} 65 * @return {boolean}
66 */ 66 */
67 _isFormattable: function(uiSourceCode) 67 _isFormattable: function(uiSourceCode)
68 { 68 {
69 if (!uiSourceCode) 69 if (!uiSourceCode)
70 return false; 70 return false;
71 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSyst em) 71 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSyst em)
72 return true; 72 return true;
73 if (WebInspector.persistence.binding(uiSourceCode))
74 return true;
73 return uiSourceCode.contentType().isStyleSheet() 75 return uiSourceCode.contentType().isStyleSheet()
74 || uiSourceCode.project().type() === WebInspector.projectTypes.Snipp ets; 76 || uiSourceCode.project().type() === WebInspector.projectTypes.Snipp ets;
75 }, 77 },
76 78
77 _formatSourceInPlace: function() 79 _formatSourceInPlace: function()
78 { 80 {
79 var uiSourceCode = this._sourcesView.currentUISourceCode(); 81 var uiSourceCode = this._sourcesView.currentUISourceCode();
80 if (!this._isFormattable(uiSourceCode)) 82 if (!this._isFormattable(uiSourceCode))
81 return; 83 return;
82 84
(...skipping 25 matching lines...) Expand all
108 var start = [0, 0]; 110 var start = [0, 0];
109 if (sourceFrame) { 111 if (sourceFrame) {
110 var selection = sourceFrame.selection(); 112 var selection = sourceFrame.selection();
111 start = formatterMapping.originalToFormatted(selection.startLine , selection.startColumn); 113 start = formatterMapping.originalToFormatted(selection.startLine , selection.startColumn);
112 } 114 }
113 uiSourceCode.setWorkingCopy(formattedContent); 115 uiSourceCode.setWorkingCopy(formattedContent);
114 this._sourcesView.showSourceLocation(uiSourceCode, start[0], start[1 ]); 116 this._sourcesView.showSourceLocation(uiSourceCode, start[0], start[1 ]);
115 } 117 }
116 }, 118 },
117 } 119 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698