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

Unified Diff: third_party/WebKit/Source/devtools/front_end/formatter_worker/FormattedContentBuilder.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, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/formatter_worker/FormattedContentBuilder.js
diff --git a/third_party/WebKit/Source/devtools/front_end/formatter_worker/FormattedContentBuilder.js b/third_party/WebKit/Source/devtools/front_end/formatter_worker/FormattedContentBuilder.js
index 4a5428be4f8849e3ac4762b1ff40448aa37b7ae0..3d1d266e87bf651ba976c86638bff39fec856255 100644
--- a/third_party/WebKit/Source/devtools/front_end/formatter_worker/FormattedContentBuilder.js
+++ b/third_party/WebKit/Source/devtools/front_end/formatter_worker/FormattedContentBuilder.js
@@ -17,7 +17,6 @@ WebInspector.FormattedContentBuilder = function(indentString)
/** @type {!{original: !Array.<number>, formatted: !Array.<number>}} */
this._mapping = { original: [0], formatted: [0] };
- this._lineNumber = 0;
this._nestingLevel = 0;
this._indentString = indentString;
/** @type {!Map<number, string>} */
@@ -31,15 +30,10 @@ WebInspector.FormattedContentBuilder = function(indentString)
WebInspector.FormattedContentBuilder.prototype = {
/**
* @param {string} token
- * @param {number} startPosition
- * @param {number} startLine
- * @param {number} endLine
+ * @param {number} offset
*/
- addToken: function(token, startPosition, startLine, endLine)
+ addToken: function(token, offset)
{
- if (this._lineNumber < startLine)
- this._newLines = Math.max(this._newLines, startLine - this._lineNumber);
-
var last = this._formattedContent.peekLast();
if (last && /\w/.test(last[last.length - 1]) && /\w/.test(token))
this.addSoftSpace();
@@ -47,9 +41,8 @@ WebInspector.FormattedContentBuilder.prototype = {
this._appendFormatting();
// Insert token.
- this._addMappingIfNeeded(startPosition);
+ this._addMappingIfNeeded(offset);
this._addText(token);
- this._lineNumber = endLine;
},
addSoftSpace: function()

Powered by Google App Engine
This is Rietveld 408576698