OLD | NEW |
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 WebInspector.ScriptFormatter.prototype = { | 103 WebInspector.ScriptFormatter.prototype = { |
104 /** | 104 /** |
105 * @param {!MessageEvent} event | 105 * @param {!MessageEvent} event |
106 */ | 106 */ |
107 _didFormatContent: function(event) | 107 _didFormatContent: function(event) |
108 { | 108 { |
109 this._worker.terminate(); | 109 this._worker.terminate(); |
110 var originalContent = this._originalContent; | 110 var originalContent = this._originalContent; |
111 var formattedContent = event.data.content; | 111 var formattedContent = event.data.content; |
112 var mapping = event.data["mapping"]; | 112 var mapping = event.data["mapping"]; |
113 var sourceMapping = new WebInspector.FormatterSourceMappingImpl(original
Content.lineEndings(), formattedContent.lineEndings(), mapping); | 113 var sourceMapping = new WebInspector.FormatterSourceMappingImpl(original
Content.computeLineEndings(), formattedContent.computeLineEndings(), mapping); |
114 this._callback(formattedContent, sourceMapping); | 114 this._callback(formattedContent, sourceMapping); |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 /** | 118 /** |
119 * @constructor | 119 * @constructor |
120 * @implements {WebInspector.Formatter} | 120 * @implements {WebInspector.Formatter} |
121 * @param {string} mimeType | 121 * @param {string} mimeType |
122 * @param {string} content | 122 * @param {string} content |
123 * @param {function(string, !WebInspector.FormatterSourceMapping)} callback | 123 * @param {function(string, !WebInspector.FormatterSourceMapping)} callback |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 */ | 236 */ |
237 _convertPosition: function(positions1, positions2, position) | 237 _convertPosition: function(positions1, positions2, position) |
238 { | 238 { |
239 var index = positions1.upperBound(position) - 1; | 239 var index = positions1.upperBound(position) - 1; |
240 var convertedPosition = positions2[index] + position - positions1[index]
; | 240 var convertedPosition = positions2[index] + position - positions1[index]
; |
241 if (index < positions2.length - 1 && convertedPosition > positions2[inde
x + 1]) | 241 if (index < positions2.length - 1 && convertedPosition > positions2[inde
x + 1]) |
242 convertedPosition = positions2[index + 1]; | 242 convertedPosition = positions2[index + 1]; |
243 return convertedPosition; | 243 return convertedPosition; |
244 } | 244 } |
245 } | 245 } |
OLD | NEW |