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

Unified Diff: Source/devtools/front_end/common/TextRange.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/bindings/module.json ('k') | Source/devtools/front_end/common/TextUtils.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
}
« no previous file with comments | « Source/devtools/front_end/bindings/module.json ('k') | Source/devtools/front_end/common/TextUtils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698