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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/SourceFormatter.js

Issue 2886053002: DevTools: do not use Bindings.NetworkProject.styleHeaderForUISourceCode in SourceFormatter (Closed)
Patch Set: nits Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/sources/formatter-css.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/sources/SourceFormatter.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourceFormatter.js b/third_party/WebKit/Source/devtools/front_end/sources/SourceFormatter.js
index 4ce4d5e5c47727ed9d7f1414dee25273f9b841d0..08ad9e70e682f071d123fc2d2ccf0e85c758e3e0 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/SourceFormatter.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/SourceFormatter.js
@@ -239,6 +239,7 @@ Sources.SourceFormatter.ScriptMapping = class {
Sources.SourceFormatter.StyleMapping = class {
constructor() {
Bindings.cssWorkspaceBinding.addSourceMapping(this);
+ this._headersSymbol = Symbol('Sources.SourceFormatter.StyleMapping._headersSymbol');
}
/**
@@ -266,10 +267,8 @@ Sources.SourceFormatter.StyleMapping = class {
if (!formatData)
return [];
var originalLocation = formatData.mapping.formattedToOriginal(uiLocation.lineNumber, uiLocation.columnNumber);
- var header = Bindings.NetworkProject.styleHeaderForUISourceCode(formatData.originalSourceCode);
- if (!header)
- return [];
- return [new SDK.CSSLocation(header, originalLocation[0], originalLocation[1])];
+ var headers = formatData.originalSourceCode[this._headersSymbol];
+ return headers.map(header => new SDK.CSSLocation(header, originalLocation[0], originalLocation[1]));
}
/**
@@ -278,14 +277,18 @@ Sources.SourceFormatter.StyleMapping = class {
*/
_setSourceMappingEnabled(formatData, enable) {
var original = formatData.originalSourceCode;
- var styleHeader = Bindings.NetworkProject.styleHeaderForUISourceCode(original);
- if (!styleHeader)
+ var rawLocations = Bindings.cssWorkspaceBinding.uiLocationToRawLocations(original.uiLocation(0, 0));
+ var headers = rawLocations.map(rawLocation => rawLocation.header()).filter(header => !!header);
+ if (!headers.length)
return;
- if (enable)
- styleHeader[Sources.SourceFormatData._formatDataSymbol] = formatData;
- else
- delete styleHeader[Sources.SourceFormatData._formatDataSymbol];
- Bindings.cssWorkspaceBinding.updateLocations(styleHeader);
+ if (enable) {
+ original[this._headersSymbol] = headers;
+ headers.forEach(header => header[Sources.SourceFormatData._formatDataSymbol] = formatData);
+ } else {
+ original[this._headersSymbol] = null;
+ headers.forEach(header => delete header[Sources.SourceFormatData._formatDataSymbol]);
+ }
+ headers.forEach(header => Bindings.cssWorkspaceBinding.updateLocations(header));
}
};
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/sources/formatter-css.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698