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

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: 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/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..7ea5ac403888f99254551d961378e46dc0a966b5 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/CSSWorkspaceBinding.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/CSSWorkspaceBinding.js
@@ -136,21 +136,19 @@ WebInspector.CSSWorkspaceBinding.prototype = {
propertyUILocation: function(cssProperty, forName)
{
var style = cssProperty.ownerStyle;
- if (!style || !style.parentRule || !style.styleSheetId)
+ if (!style || style.type !== WebInspector.CSSStyleDeclaration.Type.Regular || !style.styleSheetId)
return null;
-
- var range = cssProperty.range;
- if (!range)
- return null;
-
var header = style.cssModel().styleSheetHeaderForId(style.styleSheetId);
if (!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 range = forName ? cssProperty.nameRange() : cssProperty.valueRange();
+ if (!range)
+ return null;
+
+ var lineNumber = range.startLine;
+ var columnNumber = range.startColumn;
+ var rawLocation = new WebInspector.CSSLocation(header, header.lineNumberInSource(lineNumber), header.columnNumberInSource(lineNumber, columnNumber));
return this.rawLocationToUILocation(rawLocation);
},

Powered by Google App Engine
This is Rietveld 408576698