| 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));
|
| }
|
| };
|
|
|
|
|