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

Side by Side Diff: Source/devtools/front_end/common/TextUtils.js

Issue 1331083002: DevTools: [STRUCT] edit SASS through SourceMaps (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebaseline atop master Created 5 years, 3 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 */ 232 */
233 WebInspector.TokenizerFactory = function() { } 233 WebInspector.TokenizerFactory = function() { }
234 234
235 WebInspector.TokenizerFactory.prototype = { 235 WebInspector.TokenizerFactory.prototype = {
236 /** 236 /**
237 * @param {string} mimeType 237 * @param {string} mimeType
238 * @return {function(string, function(string, ?string, number, number))} 238 * @return {function(string, function(string, ?string, number, number))}
239 */ 239 */
240 createTokenizer: function(mimeType) { } 240 createTokenizer: function(mimeType) { }
241 } 241 }
242
243 /**
244 * @constructor
245 * @param {string} sourceURL
246 * @param {!WebInspector.TextRange} oldRange
247 * @param {string} oldText
248 * @param {string} newText
249 */
250 WebInspector.SourceEdit = function(sourceURL, oldRange, oldText, newText)
251 {
252 this.sourceURL = sourceURL;
253 this.oldRange = oldRange;
254 this.oldText = oldText;
255 this.newText = newText;
256 }
257
258 WebInspector.SourceEdit.prototype = {
259 /**
260 * @return {!WebInspector.TextRange}
261 */
262 newRange: function()
263 {
264 var endLine = this.oldRange.startLine;
265 var endColumn = this.oldRange.startColumn + this.newText.length;
266 var lineEndings = this.newText.lineEndings();
267 if (lineEndings.length > 1) {
268 endLine = this.oldRange.startLine + lineEndings.length - 1;
269 var len = lineEndings.length;
270 endColumn = lineEndings[len - 1] - lineEndings[len - 2] - 1;
271 }
272 return new WebInspector.TextRange(
273 this.oldRange.startLine,
274 this.oldRange.startColumn,
275 endLine,
276 endColumn);
277 },
278
279 applyToText: function(text)
280 {
281 return this.oldRange.replaceInText(text, this.newText);
282 },
283 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/common/TextRange.js ('k') | Source/devtools/front_end/sdk/CSSParser.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698