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

Side by Side 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, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {WebInspector.TargetManager.Observer} 7 * @implements {WebInspector.TargetManager.Observer}
8 * @param {!WebInspector.TargetManager} targetManager 8 * @param {!WebInspector.TargetManager} targetManager
9 * @param {!WebInspector.Workspace} workspace 9 * @param {!WebInspector.Workspace} workspace
10 * @param {!WebInspector.NetworkMapping} networkMapping 10 * @param {!WebInspector.NetworkMapping} networkMapping
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 }, 129 },
130 130
131 /** 131 /**
132 * @param {!WebInspector.CSSProperty} cssProperty 132 * @param {!WebInspector.CSSProperty} cssProperty
133 * @param {boolean} forName 133 * @param {boolean} forName
134 * @return {?WebInspector.UILocation} 134 * @return {?WebInspector.UILocation}
135 */ 135 */
136 propertyUILocation: function(cssProperty, forName) 136 propertyUILocation: function(cssProperty, forName)
137 { 137 {
138 var style = cssProperty.ownerStyle; 138 var style = cssProperty.ownerStyle;
139 if (!style || !style.parentRule || !style.styleSheetId) 139 if (!style || style.type !== WebInspector.CSSStyleDeclaration.Type.Regul ar || !style.styleSheetId)
140 return null; 140 return null;
141
142 var range = cssProperty.range;
143 if (!range)
144 return null;
145
146 var header = style.cssModel().styleSheetHeaderForId(style.styleSheetId); 141 var header = style.cssModel().styleSheetHeaderForId(style.styleSheetId);
147 if (!header) 142 if (!header)
148 return null; 143 return null;
149 144
150 var line = forName ? range.startLine : range.endLine; 145 var range = forName ? cssProperty.nameRange() : cssProperty.valueRange() ;
151 // End of range is exclusive, so subtract 1 from the end offset. 146 if (!range)
152 var column = forName ? range.startColumn : range.endColumn - (cssPropert y.text && cssProperty.text.endsWith(";") ? 2 : 1); 147 return null;
153 var rawLocation = new WebInspector.CSSLocation(header, header.lineNumber InSource(line), header.columnNumberInSource(line, column)); 148
149 var lineNumber = range.startLine;
150 var columnNumber = range.startColumn;
151 var rawLocation = new WebInspector.CSSLocation(header, header.lineNumber InSource(lineNumber), header.columnNumberInSource(lineNumber, columnNumber));
154 return this.rawLocationToUILocation(rawLocation); 152 return this.rawLocationToUILocation(rawLocation);
155 }, 153 },
156 154
157 /** 155 /**
158 * @param {?WebInspector.CSSLocation} rawLocation 156 * @param {?WebInspector.CSSLocation} rawLocation
159 * @return {?WebInspector.UILocation} 157 * @return {?WebInspector.UILocation}
160 */ 158 */
161 rawLocationToUILocation: function(rawLocation) 159 rawLocationToUILocation: function(rawLocation)
162 { 160 {
163 if (!rawLocation) 161 if (!rawLocation)
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 * @param {number} lineNumber 448 * @param {number} lineNumber
451 * @return {boolean} 449 * @return {boolean}
452 */ 450 */
453 uiLineHasMapping: function(uiSourceCode, lineNumber) { } 451 uiLineHasMapping: function(uiSourceCode, lineNumber) { }
454 } 452 }
455 453
456 /** 454 /**
457 * @type {!WebInspector.CSSWorkspaceBinding} 455 * @type {!WebInspector.CSSWorkspaceBinding}
458 */ 456 */
459 WebInspector.cssWorkspaceBinding; 457 WebInspector.cssWorkspaceBinding;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698