| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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; |
| OLD | NEW |