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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/formatter_worker/IdentityFormatter.js

Issue 1835783002: DevTools: simplify WI.FormattedContentBuilder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaseline tests Created 4 years, 8 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 // 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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698