Chromium Code Reviews| 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); |
| } |
| }; |