Skip to content

Commit

Permalink
DevTools: support sourceMappingURL for the inline stylesheets
Browse files Browse the repository at this point in the history
This patch properly linkifies inline stylesheet URLs if they have attached
sourcemap.

BUG=649679
R=dgozman

Review-Url: https://codereview.chromium.org/2545883005
Cr-Commit-Position: refs/heads/master@{#436416}
  • Loading branch information
aslushnikov authored and Commit bot committed Dec 5, 2016
1 parent 070d3e6 commit 563ec62
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
8 changes: 5 additions & 3 deletions front_end/elements/StylesSidebarPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,10 @@ Elements.StylePropertiesSection = class {
this.editable = false;
} else {
// Check this is a real CSSRule, not a bogus object coming from Elements.BlankStylePropertiesSection.
if (rule.styleSheetId)
this.navigable = !!rule.resourceURL();
if (rule.styleSheetId) {
var header = rule.cssModel().styleSheetHeaderForId(rule.styleSheetId);
this.navigable = !header.isAnonymousInlineStyleSheet();
}
}
}

Expand Down Expand Up @@ -655,7 +657,7 @@ Elements.StylePropertiesSection = class {
}

var header = rule.styleSheetId ? matchedStyles.cssModel().styleSheetHeaderForId(rule.styleSheetId) : null;
if (ruleLocation && rule.styleSheetId && header && header.resourceURL()) {
if (ruleLocation && rule.styleSheetId && header && !header.isAnonymousInlineStyleSheet()) {
return Elements.StylePropertiesSection._linkifyRuleLocation(
matchedStyles.cssModel(), linkifier, rule.styleSheetId, ruleLocation);
}
Expand Down
7 changes: 7 additions & 0 deletions front_end/sdk/CSSRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ SDK.CSSRule = class {
isRegular() {
return this.origin === Protocol.CSS.StyleSheetOrigin.Regular;
}

/**
* @return {!SDK.CSSModel}
*/
cssModel() {
return this._cssModel;
}
};

/**
Expand Down
7 changes: 7 additions & 0 deletions front_end/sdk/CSSStyleSheetHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ SDK.CSSStyleSheetHeader = class {
return this._cssModel;
}

/**
* @return {boolean}
*/
isAnonymousInlineStyleSheet() {
return !this.resourceURL() && !this._cssModel.sourceMapForHeader(this);
}

/**
* @return {string}
*/
Expand Down

0 comments on commit 563ec62

Please sign in to comment.