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

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: kill trailing space! 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..2fea486178758d3150d436c0746e257709ef1009 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._styleHeaderSymbol = Symbol('Sources.SourceFormatter.StyleMapping');
}
/**
@@ -266,7 +267,7 @@ Sources.SourceFormatter.StyleMapping = class {
if (!formatData)
return [];
var originalLocation = formatData.mapping.formattedToOriginal(uiLocation.lineNumber, uiLocation.columnNumber);
- var header = Bindings.NetworkProject.styleHeaderForUISourceCode(formatData.originalSourceCode);
+ var header = formatData.originalSourceCode[this._styleHeaderSymbol];
if (!header)
return [];
return [new SDK.CSSLocation(header, originalLocation[0], originalLocation[1])];
@@ -278,13 +279,17 @@ Sources.SourceFormatter.StyleMapping = class {
*/
_setSourceMappingEnabled(formatData, enable) {
var original = formatData.originalSourceCode;
- var styleHeader = Bindings.NetworkProject.styleHeaderForUISourceCode(original);
+ var rawLocations = Bindings.cssWorkspaceBinding.uiLocationToRawLocations(original.uiLocation(0, 0));
+ var styleHeader = rawLocations.length ? rawLocations[0].header() : null;
caseq 2017/05/16 23:54:30 Let's take care of all possible headers here?
lushnikov 2017/05/17 00:17:49 Sure!
if (!styleHeader)
return;
- if (enable)
+ if (enable) {
+ original[this._styleHeaderSymbol] = styleHeader;
styleHeader[Sources.SourceFormatData._formatDataSymbol] = formatData;
- else
+ } else {
+ original[this._styleHeaderSymbol] = null;
delete styleHeader[Sources.SourceFormatData._formatDataSymbol];
+ }
Bindings.cssWorkspaceBinding.updateLocations(styleHeader);
}
};
« 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