Index: Source/devtools/front_end/common/TextRange.js |
diff --git a/Source/devtools/front_end/common/TextRange.js b/Source/devtools/front_end/common/TextRange.js |
index 9c1bcd987e2a5935218523d15168961bda1724a1..2fdecce55970d0f8ed68933eb5bc69c343b64de8 100644 |
--- a/Source/devtools/front_end/common/TextRange.js |
+++ b/Source/devtools/front_end/common/TextRange.js |
@@ -276,6 +276,28 @@ WebInspector.TextRange.prototype = { |
{ |
var sourceRange = this.toSourceRange(text); |
return text.substring(0, sourceRange.offset) + replacement + text.substring(sourceRange.offset + sourceRange.length); |
+ }, |
+ |
+ extract: function(text) |
+ { |
+ var sourceRange = this.toSourceRange(text); |
+ return text.substr(sourceRange.offset, sourceRange.length); |
+ }, |
+ |
+ /** |
+ * @param {number} lineNumber |
+ * @param {number} columnNumber |
+ * @return {boolean} |
+ */ |
+ containsLocation: function(lineNumber, columnNumber) |
+ { |
+ if (this.startLine === this.endLine) |
+ return this.startLine === lineNumber && this.startColumn <= columnNumber && columnNumber <= this.endColumn; |
+ if (this.startLine === lineNumber) |
+ return this.startColumn <= columnNumber; |
+ if (this.endLine === lineNumber) |
+ return columnNumber <= this.endColumn; |
+ return this.startLine < lineNumber && lineNumber < this.endLine; |
} |
} |