| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 270 |
| 271 /** | 271 /** |
| 272 * @param {!WebInspector.SourceMap.Entry} a | 272 * @param {!WebInspector.SourceMap.Entry} a |
| 273 * @param {!WebInspector.SourceMap.Entry} b | 273 * @param {!WebInspector.SourceMap.Entry} b |
| 274 * @return {number} | 274 * @return {number} |
| 275 */ | 275 */ |
| 276 function sourceMappingComparator(a, b) | 276 function sourceMappingComparator(a, b) |
| 277 { | 277 { |
| 278 if (a.sourceLineNumber !== b.sourceLineNumber) | 278 if (a.sourceLineNumber !== b.sourceLineNumber) |
| 279 return a.sourceLineNumber - b.sourceLineNumber; | 279 return a.sourceLineNumber - b.sourceLineNumber; |
| 280 return a.sourceColumnNumber - b.sourceColumnNumber; | 280 if (a.sourceColumnNumber !== b.sourceColumnNumber) |
| 281 return a.sourceColumnNumber - b.sourceColumnNumber; |
| 282 |
| 283 if (a.lineNumber !== b.lineNumber) |
| 284 return a.lineNumber - b.lineNumber; |
| 285 |
| 286 return a.columnNumber - b.columnNumber; |
| 281 } | 287 } |
| 282 }, | 288 }, |
| 283 | 289 |
| 284 /** | 290 /** |
| 285 * @param {!SourceMapV3} map | 291 * @param {!SourceMapV3} map |
| 286 * @param {number} lineNumber | 292 * @param {number} lineNumber |
| 287 * @param {number} columnNumber | 293 * @param {number} columnNumber |
| 288 */ | 294 */ |
| 289 _parseMap: function(map, lineNumber, columnNumber) | 295 _parseMap: function(map, lineNumber, columnNumber) |
| 290 { | 296 { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 result += (digit & this._VLQ_BASE_MASK) << shift; | 387 result += (digit & this._VLQ_BASE_MASK) << shift; |
| 382 shift += this._VLQ_BASE_SHIFT; | 388 shift += this._VLQ_BASE_SHIFT; |
| 383 } while (digit & this._VLQ_CONTINUATION_MASK); | 389 } while (digit & this._VLQ_CONTINUATION_MASK); |
| 384 | 390 |
| 385 // Fix the sign. | 391 // Fix the sign. |
| 386 var negative = result & 1; | 392 var negative = result & 1; |
| 387 result >>= 1; | 393 result >>= 1; |
| 388 return negative ? -result : result; | 394 return negative ? -result : result; |
| 389 }, | 395 }, |
| 390 | 396 |
| 397 /** |
| 398 * @param {string} url |
| 399 * @param {!WebInspector.TextRange} textRange |
| 400 * @return {!WebInspector.TextRange} |
| 401 */ |
| 402 reverseMapTextRange: function(url, textRange) |
| 403 { |
| 404 /** |
| 405 * @param {!{lineNumber: number, columnNumber: number}} position |
| 406 * @param {!WebInspector.SourceMap.Entry} mapping |
| 407 * @return {number} |
| 408 */ |
| 409 function comparator(position, mapping) |
| 410 { |
| 411 if (position.lineNumber !== mapping.sourceLineNumber) |
| 412 return position.lineNumber - mapping.sourceLineNumber; |
| 413 |
| 414 return position.columnNumber - mapping.sourceColumnNumber; |
| 415 } |
| 416 |
| 417 var mappings = this._reversedMappings(url); |
| 418 var startIndex = mappings.lowerBound({lineNumber: textRange.startLine, c
olumnNumber: textRange.startColumn}, comparator); |
| 419 var endIndex = mappings.upperBound({lineNumber: textRange.endLine, colum
nNumber: textRange.endColumn}, comparator); |
| 420 |
| 421 var startMapping = mappings[startIndex]; |
| 422 var endMapping = mappings[endIndex]; |
| 423 return new WebInspector.TextRange(startMapping.lineNumber, startMapping.
columnNumber, endMapping.lineNumber, endMapping.columnNumber); |
| 424 }, |
| 425 |
| 391 _VLQ_BASE_SHIFT: 5, | 426 _VLQ_BASE_SHIFT: 5, |
| 392 _VLQ_BASE_MASK: (1 << 5) - 1, | 427 _VLQ_BASE_MASK: (1 << 5) - 1, |
| 393 _VLQ_CONTINUATION_MASK: 1 << 5 | 428 _VLQ_CONTINUATION_MASK: 1 << 5 |
| 394 } | 429 } |
| 395 | 430 |
| 396 /** | 431 /** |
| 397 * @constructor | 432 * @constructor |
| 398 * @param {string} string | 433 * @param {string} string |
| 399 */ | 434 */ |
| 400 WebInspector.SourceMap.StringCharIterator = function(string) | 435 WebInspector.SourceMap.StringCharIterator = function(string) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 */ | 475 */ |
| 441 WebInspector.SourceMap.Entry = function(lineNumber, columnNumber, sourceURL, sou
rceLineNumber, sourceColumnNumber, name) | 476 WebInspector.SourceMap.Entry = function(lineNumber, columnNumber, sourceURL, sou
rceLineNumber, sourceColumnNumber, name) |
| 442 { | 477 { |
| 443 this.lineNumber = lineNumber; | 478 this.lineNumber = lineNumber; |
| 444 this.columnNumber = columnNumber; | 479 this.columnNumber = columnNumber; |
| 445 this.sourceURL = sourceURL; | 480 this.sourceURL = sourceURL; |
| 446 this.sourceLineNumber = sourceLineNumber; | 481 this.sourceLineNumber = sourceLineNumber; |
| 447 this.sourceColumnNumber = sourceColumnNumber; | 482 this.sourceColumnNumber = sourceColumnNumber; |
| 448 this.name = name; | 483 this.name = name; |
| 449 } | 484 } |
| OLD | NEW |