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

Unified Diff: third_party/WebKit/Source/devtools/front_end/common/Text.js

Issue 1943763002: DevTools: [SASS] fix CSSWorkspaceBinding.propertyUILocation to account for comments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@super-sass
Patch Set: fix tests Created 4 years, 8 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
Index: third_party/WebKit/Source/devtools/front_end/common/Text.js
diff --git a/third_party/WebKit/Source/devtools/front_end/common/Text.js b/third_party/WebKit/Source/devtools/front_end/common/Text.js
index cc49351d8dac9da1b960ab825743538c618c89b2..670d0e8397e688406ae816dbae4dc223ce761f5a 100644
--- a/third_party/WebKit/Source/devtools/front_end/common/Text.js
+++ b/third_party/WebKit/Source/devtools/front_end/common/Text.js
@@ -75,6 +75,25 @@ WebInspector.Text.prototype = {
},
/**
+ * @param {!WebInspector.SourceRange} sourceRange
+ * @return {!WebInspector.TextRange}
+ */
+ toTextRange: function(sourceRange)
+ {
+ var cursor = new WebInspector.TextCursor(this.lineEndings());
+ var result = WebInspector.TextRange.createFromLocation(0, 0);
+
+ cursor.resetTo(sourceRange.offset);
+ result.startLine = cursor.lineNumber();
+ result.startColumn = cursor.columnNumber();
+
+ cursor.advance(sourceRange.offset + sourceRange.length);
+ result.endLine = cursor.lineNumber();
+ result.endColumn = cursor.columnNumber();
+ return result;
+ },
+
+ /**
* @param {!WebInspector.TextRange} range
* @param {string} replacement
* @return {string}
@@ -93,7 +112,7 @@ WebInspector.Text.prototype = {
{
var sourceRange = this.toSourceRange(range);
return this._value.substr(sourceRange.offset, sourceRange.length);
- },
+ }
}
/**

Powered by Google App Engine
This is Rietveld 408576698