| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @param {!WebInspector.FormattedContentBuilder} builder | 7 * @param {!WebInspector.FormattedContentBuilder} builder |
| 8 */ | 8 */ |
| 9 WebInspector.IdentityFormatter = function(builder) | 9 WebInspector.IdentityFormatter = function(builder) |
| 10 { | 10 { |
| 11 this._builder = builder; | 11 this._builder = builder; |
| 12 } | 12 } |
| 13 | 13 |
| 14 WebInspector.IdentityFormatter.prototype = { | 14 WebInspector.IdentityFormatter.prototype = { |
| 15 /** | 15 /** |
| 16 * @param {string} text | 16 * @param {string} text |
| 17 * @param {!Array<number>} lineEndings | 17 * @param {!Array<number>} lineEndings |
| 18 * @param {number} fromOffset | 18 * @param {number} fromOffset |
| 19 * @param {number} toOffset | 19 * @param {number} toOffset |
| 20 */ | 20 */ |
| 21 format: function(text, lineEndings, fromOffset, toOffset) | 21 format: function(text, lineEndings, fromOffset, toOffset) |
| 22 { | 22 { |
| 23 var content = text.substring(fromOffset, toOffset); | 23 var content = text.substring(fromOffset, toOffset); |
| 24 var startLine = lineEndings.lowerBound(fromOffset); | 24 this._builder.addToken(content, fromOffset); |
| 25 var endLine = lineEndings.lowerBound(toOffset); | |
| 26 this._builder.addToken(content, fromOffset, startLine, endLine); | |
| 27 } | 25 } |
| 28 } | 26 } |
| 29 | 27 |
| OLD | NEW |