| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 delete this._completeSourceMapURLForCSSURL[sourceURL]; | 412 delete this._completeSourceMapURLForCSSURL[sourceURL]; |
| 413 for (var sassURL in this._cssURLsForSASSURL) { | 413 for (var sassURL in this._cssURLsForSASSURL) { |
| 414 var urls = this._cssURLsForSASSURL[sassURL]; | 414 var urls = this._cssURLsForSASSURL[sassURL]; |
| 415 urls.remove(sourceURL); | 415 urls.remove(sourceURL); |
| 416 if (!urls.length) | 416 if (!urls.length) |
| 417 delete this._cssURLsForSASSURL[sassURL]; | 417 delete this._cssURLsForSASSURL[sassURL]; |
| 418 } | 418 } |
| 419 var completeSourceMapURL = WebInspector.ParsedURL.completeURL(sourceURL,
header.sourceMapURL); | 419 var completeSourceMapURL = WebInspector.ParsedURL.completeURL(sourceURL,
header.sourceMapURL); |
| 420 if (completeSourceMapURL) | 420 if (completeSourceMapURL) |
| 421 delete this._sourceMapByURL[completeSourceMapURL]; | 421 delete this._sourceMapByURL[completeSourceMapURL]; |
| 422 header.updateLocations(); | 422 WebInspector.cssWorkspaceBinding.updateLocations(header); |
| 423 }, | 423 }, |
| 424 | 424 |
| 425 /** | 425 /** |
| 426 * @param {!Array.<!WebInspector.CSSStyleSheetHeader>} headersWithSameSource
URL | 426 * @param {!Array.<!WebInspector.CSSStyleSheetHeader>} headersWithSameSource
URL |
| 427 * @param {boolean} forceRebind | 427 * @param {boolean} forceRebind |
| 428 * @param {string} completeSourceMapURL | 428 * @param {string} completeSourceMapURL |
| 429 */ | 429 */ |
| 430 _loadSourceMapAndBindUISourceCode: function(headersWithSameSourceURL, forceR
ebind, completeSourceMapURL) | 430 _loadSourceMapAndBindUISourceCode: function(headersWithSameSourceURL, forceR
ebind, completeSourceMapURL) |
| 431 { | 431 { |
| 432 console.assert(headersWithSameSourceURL.length); | 432 console.assert(headersWithSameSourceURL.length); |
| 433 var sourceURL = headersWithSameSourceURL[0].sourceURL; | 433 var sourceURL = headersWithSameSourceURL[0].sourceURL; |
| 434 this._loadSourceMapForStyleSheet(completeSourceMapURL, sourceURL, forceR
ebind, sourceMapLoaded.bind(this)); | 434 this._loadSourceMapForStyleSheet(completeSourceMapURL, sourceURL, forceR
ebind, sourceMapLoaded.bind(this)); |
| 435 | 435 |
| 436 /** | 436 /** |
| 437 * @param {?WebInspector.SourceMap} sourceMap | 437 * @param {?WebInspector.SourceMap} sourceMap |
| 438 * @this {WebInspector.SASSSourceMapping} | 438 * @this {WebInspector.SASSSourceMapping} |
| 439 */ | 439 */ |
| 440 function sourceMapLoaded(sourceMap) | 440 function sourceMapLoaded(sourceMap) |
| 441 { | 441 { |
| 442 if (!sourceMap) | 442 if (!sourceMap) |
| 443 return; | 443 return; |
| 444 | 444 |
| 445 this._sourceMapByStyleSheetURL[sourceURL] = sourceMap; | 445 this._sourceMapByStyleSheetURL[sourceURL] = sourceMap; |
| 446 for (var i = 0; i < headersWithSameSourceURL.length; ++i) { | 446 for (var i = 0; i < headersWithSameSourceURL.length; ++i) { |
| 447 if (forceRebind) | 447 if (forceRebind) |
| 448 headersWithSameSourceURL[i].updateLocations(); | 448 WebInspector.cssWorkspaceBinding.updateLocations(headersWith
SameSourceURL[i]); |
| 449 else | 449 else |
| 450 this._bindUISourceCode(headersWithSameSourceURL[i], sourceMa
p); | 450 this._bindUISourceCode(headersWithSameSourceURL[i], sourceMa
p); |
| 451 } | 451 } |
| 452 } | 452 } |
| 453 }, | 453 }, |
| 454 | 454 |
| 455 /** | 455 /** |
| 456 * @param {string} cssURL | 456 * @param {string} cssURL |
| 457 * @param {string} sassURL | 457 * @param {string} sassURL |
| 458 */ | 458 */ |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 callbacks[i](sourceMap); | 512 callbacks[i](sourceMap); |
| 513 } | 513 } |
| 514 }, | 514 }, |
| 515 | 515 |
| 516 /** | 516 /** |
| 517 * @param {!WebInspector.CSSStyleSheetHeader} header | 517 * @param {!WebInspector.CSSStyleSheetHeader} header |
| 518 * @param {!WebInspector.SourceMap} sourceMap | 518 * @param {!WebInspector.SourceMap} sourceMap |
| 519 */ | 519 */ |
| 520 _bindUISourceCode: function(header, sourceMap) | 520 _bindUISourceCode: function(header, sourceMap) |
| 521 { | 521 { |
| 522 header.pushSourceMapping(this); | 522 WebInspector.cssWorkspaceBinding.pushSourceMapping(header, this); |
| 523 var rawURL = header.sourceURL; | 523 var rawURL = header.sourceURL; |
| 524 var sources = sourceMap.sources(); | 524 var sources = sourceMap.sources(); |
| 525 for (var i = 0; i < sources.length; ++i) { | 525 for (var i = 0; i < sources.length; ++i) { |
| 526 var url = sources[i]; | 526 var url = sources[i]; |
| 527 this._addCSSURLforSASSURL(rawURL, url); | 527 this._addCSSURLforSASSURL(rawURL, url); |
| 528 if (!this._workspace.hasMappingForURL(url) && !this._workspace.uiSou
rceCodeForURL(url)) { | 528 if (!this._workspace.hasMappingForURL(url) && !this._workspace.uiSou
rceCodeForURL(url)) { |
| 529 var contentProvider = sourceMap.sourceContentProvider(url, WebIn
spector.resourceTypes.Stylesheet); | 529 var contentProvider = sourceMap.sourceContentProvider(url, WebIn
spector.resourceTypes.Stylesheet); |
| 530 this._networkWorkspaceBinding.addFileForURL(url, contentProvider
); | 530 this._networkWorkspaceBinding.addFileForURL(url, contentProvider
); |
| 531 } | 531 } |
| 532 } | 532 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 { | 597 { |
| 598 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
); | 598 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
); |
| 599 var cssURLs = this._cssURLsForSASSURL[uiSourceCode.url]; | 599 var cssURLs = this._cssURLsForSASSURL[uiSourceCode.url]; |
| 600 if (!cssURLs) | 600 if (!cssURLs) |
| 601 return; | 601 return; |
| 602 for (var i = 0; i < cssURLs.length; ++i) { | 602 for (var i = 0; i < cssURLs.length; ++i) { |
| 603 var ids = this._cssModel.styleSheetIdsForURL(cssURLs[i]); | 603 var ids = this._cssModel.styleSheetIdsForURL(cssURLs[i]); |
| 604 for (var j = 0; j < ids.length; ++j) { | 604 for (var j = 0; j < ids.length; ++j) { |
| 605 var header = this._cssModel.styleSheetHeaderForId(ids[j]); | 605 var header = this._cssModel.styleSheetHeaderForId(ids[j]); |
| 606 console.assert(header); | 606 console.assert(header); |
| 607 header.updateLocations(); | 607 WebInspector.cssWorkspaceBinding.updateLocations(/** @type {!Web
Inspector.CSSStyleSheetHeader} */ (header)); |
| 608 } | 608 } |
| 609 } | 609 } |
| 610 }, | 610 }, |
| 611 | 611 |
| 612 /** | 612 /** |
| 613 * @param {!WebInspector.Event} event | 613 * @param {!WebInspector.Event} event |
| 614 */ | 614 */ |
| 615 _uiSourceCodeContentCommitted: function(event) | 615 _uiSourceCodeContentCommitted: function(event) |
| 616 { | 616 { |
| 617 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
.uiSourceCode); | 617 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
.uiSourceCode); |
| 618 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSyst
em) | 618 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSyst
em) |
| 619 this._sassFileSaved(uiSourceCode.url, true); | 619 this._sassFileSaved(uiSourceCode.url, true); |
| 620 }, | 620 }, |
| 621 | 621 |
| 622 _reset: function() | 622 _reset: function() |
| 623 { | 623 { |
| 624 this._addingRevisionCounter = 0; | 624 this._addingRevisionCounter = 0; |
| 625 this._completeSourceMapURLForCSSURL = {}; | 625 this._completeSourceMapURLForCSSURL = {}; |
| 626 this._cssURLsForSASSURL = {}; | 626 this._cssURLsForSASSURL = {}; |
| 627 /** @type {!Object.<string, !Array.<function(?WebInspector.SourceMap)>>}
*/ | 627 /** @type {!Object.<string, !Array.<function(?WebInspector.SourceMap)>>}
*/ |
| 628 this._pendingSourceMapLoadingCallbacks = {}; | 628 this._pendingSourceMapLoadingCallbacks = {}; |
| 629 /** @type {!Object.<string, !{deadlineMs: number, dataByURL: !Object.<st
ring, !{timer: number, previousPoll: number}>}>} */ | 629 /** @type {!Object.<string, !{deadlineMs: number, dataByURL: !Object.<st
ring, !{timer: number, previousPoll: number}>}>} */ |
| 630 this._pollDataForSASSURL = {}; | 630 this._pollDataForSASSURL = {}; |
| 631 /** @type {!Object.<string, !WebInspector.SourceMap>} */ | 631 /** @type {!Object.<string, !WebInspector.SourceMap>} */ |
| 632 this._sourceMapByURL = {}; | 632 this._sourceMapByURL = {}; |
| 633 this._sourceMapByStyleSheetURL = {}; | 633 this._sourceMapByStyleSheetURL = {}; |
| 634 } | 634 } |
| 635 } | 635 } |
| OLD | NEW |