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

Unified Diff: Source/devtools/front_end/sdk/CSSStyleModel.js

Issue 404763002: DevTools: Inject styleSheetId in WebInspector.CSSLocation constructor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | « Source/devtools/front_end/elements/StylesSidebarPane.js ('k') | Source/devtools/front_end/sdk/Linkifier.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sdk/CSSStyleModel.js
diff --git a/Source/devtools/front_end/sdk/CSSStyleModel.js b/Source/devtools/front_end/sdk/CSSStyleModel.js
index 2a9742afe8fb1139701d78d023b0d707e4aa1eb5..bb4e674116086a87b69db3d1da4169b78034e50b 100644
--- a/Source/devtools/front_end/sdk/CSSStyleModel.js
+++ b/Source/devtools/front_end/sdk/CSSStyleModel.js
@@ -732,14 +732,16 @@ WebInspector.CSSStyleModel.LiveLocation.prototype = {
* @implements {WebInspector.RawLocation}
* @extends {WebInspector.SDKObject}
* @param {!WebInspector.Target} target
+ * @param {?CSSAgent.StyleSheetId} styleSheetId
* @param {string} url
* @param {number} lineNumber
* @param {number=} columnNumber
*/
-WebInspector.CSSLocation = function(target, url, lineNumber, columnNumber)
+WebInspector.CSSLocation = function(target, styleSheetId, url, lineNumber, columnNumber)
vsevik 2014/07/18 13:44:54 Let's make CSSLocation that always has a style she
{
WebInspector.SDKObject.call(this, target);
this._cssModel = target.cssModel;
+ this._styleSheetId = styleSheetId;
this.url = url;
this.lineNumber = lineNumber;
this.columnNumber = columnNumber || 0;
@@ -747,13 +749,12 @@ WebInspector.CSSLocation = function(target, url, lineNumber, columnNumber)
WebInspector.CSSLocation.prototype = {
/**
- * @param {?CSSAgent.StyleSheetId} styleSheetId
* @param {function(!WebInspector.UILocation):(boolean|undefined)} updateDelegate
* @return {?WebInspector.LiveLocation}
*/
- createLiveLocation: function(styleSheetId, updateDelegate)
+ createLiveLocation: function(updateDelegate)
{
- var header = styleSheetId ? this._cssModel.styleSheetHeaderForId(styleSheetId) : null;
+ var header = this._styleSheetId ? this._cssModel.styleSheetHeaderForId(this._styleSheetId) : null;
return new WebInspector.CSSStyleModel.LiveLocation(this._cssModel, header, this, updateDelegate);
},
@@ -1109,7 +1110,7 @@ WebInspector.CSSRule.prototype = {
var url = styleSheetHeader.resourceURL();
if (!url)
return;
- this.rawLocation = new WebInspector.CSSLocation(this._cssModel.target(), url, this.lineNumberInSource(0), this.columnNumberInSource(0));
+ this.rawLocation = new WebInspector.CSSLocation(this._cssModel.target(), this.styleSheetId, url, this.lineNumberInSource(0), this.columnNumberInSource(0));
},
/**
@@ -1361,7 +1362,7 @@ WebInspector.CSSProperty.prototype = {
*/
uiLocation: function(forName)
{
- if (!this.range || !this.ownerStyle || !this.ownerStyle.parentRule)
+ if (!this.range || !this.ownerStyle || !this.ownerStyle.parentRule || !this.ownerStyle.styleSheetId)
return null;
var url = this.ownerStyle.parentRule.resourceURL();
@@ -1372,7 +1373,7 @@ WebInspector.CSSProperty.prototype = {
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 - (this.text && this.text.endsWith(";") ? 2 : 1);
- var rawLocation = new WebInspector.CSSLocation(this.ownerStyle._cssModel.target(), url, line, column);
+ var rawLocation = new WebInspector.CSSLocation(this.ownerStyle._cssModel.target(), this.ownerStyle.styleSheetId, url, line, column);
return rawLocation.toUILocation();
}
}
@@ -1617,7 +1618,7 @@ WebInspector.CSSStyleSheetHeader.prototype = {
rawLocationToUILocation: function(lineNumber, columnNumber)
{
var uiLocation = null;
- var rawLocation = new WebInspector.CSSLocation(this._cssModel.target(), this.resourceURL(), lineNumber, columnNumber);
+ var rawLocation = new WebInspector.CSSLocation(this._cssModel.target(), this.id, this.resourceURL(), lineNumber, columnNumber);
for (var i = this._sourceMappings.length - 1; !uiLocation && i >= 0; --i)
uiLocation = this._sourceMappings[i].rawLocationToUILocation(rawLocation);
return uiLocation;
« no previous file with comments | « Source/devtools/front_end/elements/StylesSidebarPane.js ('k') | Source/devtools/front_end/sdk/Linkifier.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698