Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 }, | 61 }, |
| 62 | 62 |
| 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) |
|
dgozman
2016/09/22 19:55:53
Let's add a possible follow-up to remove this laye
lushnikov
2016/09/23 21:56:13
Done: https://docs.google.com/document/d/12EU7HgFN
| |
| 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 Loading... | |
| 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 } |
| OLD | NEW |