Index: third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js b/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js |
index 2b76cbabd63ce62f2aebdbe4fbb9462cd2439ed5..92041e5151b15aecd4ea1211f2e07b44f255a4d2 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js |
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js |
@@ -277,7 +277,13 @@ WebInspector.SourceMap.prototype = { |
{ |
if (a.sourceLineNumber !== b.sourceLineNumber) |
return a.sourceLineNumber - b.sourceLineNumber; |
- return a.sourceColumnNumber - b.sourceColumnNumber; |
+ if (a.sourceColumnNumber !== b.sourceColumnNumber) |
+ return a.sourceColumnNumber - b.sourceColumnNumber; |
+ |
+ if (a.lineNumber !== b.lineNumber) |
+ return a.lineNumber - b.lineNumber; |
+ |
+ return a.columnNumber - b.columnNumber; |
} |
}, |
@@ -388,6 +394,35 @@ WebInspector.SourceMap.prototype = { |
return negative ? -result : result; |
}, |
+ /** |
+ * @param {string} url |
+ * @param {!WebInspector.TextRange} textRange |
+ * @return {!WebInspector.TextRange} |
+ */ |
+ reverseMapTextRange: function(url, textRange) |
+ { |
+ /** |
+ * @param {!{lineNumber: number, columnNumber: number}} position |
+ * @param {!WebInspector.SourceMap.Entry} mapping |
+ * @return {number} |
+ */ |
+ function comparator(position, mapping) |
+ { |
+ if (position.lineNumber !== mapping.sourceLineNumber) |
+ return position.lineNumber - mapping.sourceLineNumber; |
+ |
+ return position.columnNumber - mapping.sourceColumnNumber; |
+ } |
+ |
+ var mappings = this._reversedMappings(url); |
+ var startIndex = mappings.lowerBound({lineNumber: textRange.startLine, columnNumber: textRange.startColumn}, comparator); |
+ var endIndex = mappings.upperBound({lineNumber: textRange.endLine, columnNumber: textRange.endColumn}, comparator); |
+ |
+ var startMapping = mappings[startIndex]; |
+ var endMapping = mappings[endIndex]; |
+ return new WebInspector.TextRange(startMapping.lineNumber, startMapping.columnNumber, endMapping.lineNumber, endMapping.columnNumber); |
+ }, |
+ |
_VLQ_BASE_SHIFT: 5, |
_VLQ_BASE_MASK: (1 << 5) - 1, |
_VLQ_CONTINUATION_MASK: 1 << 5 |