OLD | NEW |
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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 return this.startLine === lineNumber && this.startColumn <= columnNu
mber && columnNumber <= this.endColumn; | 272 return this.startLine === lineNumber && this.startColumn <= columnNu
mber && columnNumber <= this.endColumn; |
273 if (this.startLine === lineNumber) | 273 if (this.startLine === lineNumber) |
274 return this.startColumn <= columnNumber; | 274 return this.startColumn <= columnNumber; |
275 if (this.endLine === lineNumber) | 275 if (this.endLine === lineNumber) |
276 return columnNumber <= this.endColumn; | 276 return columnNumber <= this.endColumn; |
277 return this.startLine < lineNumber && lineNumber < this.endLine; | 277 return this.startLine < lineNumber && lineNumber < this.endLine; |
278 } | 278 } |
279 } | 279 } |
280 | 280 |
281 /** | 281 /** |
| 282 * @constructor |
| 283 * @param {!WebInspector.TextRange} textRange |
| 284 * @param {string} content |
| 285 */ |
| 286 WebInspector.TextRangeWithContent = function(textRange, content) |
| 287 { |
| 288 this.textRange = textRange; |
| 289 this.content = content; |
| 290 } |
| 291 |
| 292 /** |
282 * @param {!WebInspector.TextRange} oldRange | 293 * @param {!WebInspector.TextRange} oldRange |
283 * @param {string} newText | 294 * @param {string} newText |
284 * @return {!WebInspector.TextRange} | 295 * @return {!WebInspector.TextRange} |
285 */ | 296 */ |
286 WebInspector.TextRange.fromEdit = function(oldRange, newText) | 297 WebInspector.TextRange.fromEdit = function(oldRange, newText) |
287 { | 298 { |
288 var endLine = oldRange.startLine; | 299 var endLine = oldRange.startLine; |
289 var endColumn = oldRange.startColumn + newText.length; | 300 var endColumn = oldRange.startColumn + newText.length; |
290 var lineEndings = newText.computeLineEndings(); | 301 var lineEndings = newText.computeLineEndings(); |
291 if (lineEndings.length > 1) { | 302 if (lineEndings.length > 1) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 347 |
337 /** | 348 /** |
338 * @param {!WebInspector.SourceEdit} edit1 | 349 * @param {!WebInspector.SourceEdit} edit1 |
339 * @param {!WebInspector.SourceEdit} edit2 | 350 * @param {!WebInspector.SourceEdit} edit2 |
340 * @return {number} | 351 * @return {number} |
341 */ | 352 */ |
342 WebInspector.SourceEdit.comparator = function(edit1, edit2) | 353 WebInspector.SourceEdit.comparator = function(edit1, edit2) |
343 { | 354 { |
344 return WebInspector.TextRange.comparator(edit1.oldRange, edit2.oldRange); | 355 return WebInspector.TextRange.comparator(edit1.oldRange, edit2.oldRange); |
345 } | 356 } |
OLD | NEW |