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

Unified Diff: third_party/WebKit/Source/devtools/front_end/bindings/CSSWorkspaceBinding.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: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/bindings/CSSWorkspaceBinding.js
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/CSSWorkspaceBinding.js b/third_party/WebKit/Source/devtools/front_end/bindings/CSSWorkspaceBinding.js
index 41bb76a811b7f39a09dad3473dce066013fb535b..6edcfa4946619f4d91e9c17958e38ba553f5421e 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/CSSWorkspaceBinding.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/CSSWorkspaceBinding.js
@@ -140,17 +140,28 @@ WebInspector.CSSWorkspaceBinding.prototype = {
return null;
var range = cssProperty.range;
- if (!range)
- return null;
-
+ var text = cssProperty.text;
var header = style.cssModel().styleSheetHeaderForId(style.styleSheetId);
- if (!header)
+ if (!range || !text || !header)
return null;
- var line = forName ? range.startLine : range.endLine;
- // End of range is exclusive, so subtract 1 from the end offset.
- var column = forName ? range.startColumn : range.endColumn - (cssProperty.text && cssProperty.text.endsWith(";") ? 2 : 1);
- var rawLocation = new WebInspector.CSSLocation(header, header.lineNumberInSource(line), header.columnNumberInSource(line, column));
+ var textCursor = new WebInspector.TextCursor(cssProperty.text.computeLineEndings());
+ if (forName) {
+ var nameIndex = text.indexOf(cssProperty.name);
+ textCursor.resetTo(nameIndex);
+ } else {
+ var valueIndex = text.lastIndexOf(cssProperty.value);
+ textCursor.resetTo(valueIndex + cssProperty.value.length);
pfeldman 2016/05/03 17:52:29 You want to accompany this with a test. Otherwise
lushnikov 2016/05/03 23:19:27 Done.
+ }
+ var lineNumber = range.startLine;
+ var columnNumber = range.startColumn;
+ if (textCursor.lineNumber() === 0) {
+ columnNumber += textCursor.columnNumber();
+ } else {
+ lineNumber += textCursor.lineNumber();
+ columnNumber = textCursor.columnNumber();
+ }
+ var rawLocation = new WebInspector.CSSLocation(header, header.lineNumberInSource(lineNumber), header.columnNumberInSource(lineNumber, columnNumber));
return this.rawLocationToUILocation(rawLocation);
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698