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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
596 _uiSourceCodeAdded: function(event) | 596 _uiSourceCodeAdded: function(event) |
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 if (!header) |
607 header.updateLocations(); | 607 throw new Error("Header not found for id=" + ids[j]); |
vsevik
2014/07/22 14:59:01
This should never happen and we used to assert in
apavlov
2014/07/22 16:19:53
Done.
| |
608 WebInspector.cssWorkspaceBinding.updateLocations(header); | |
608 } | 609 } |
609 } | 610 } |
610 }, | 611 }, |
611 | 612 |
612 /** | 613 /** |
613 * @param {!WebInspector.Event} event | 614 * @param {!WebInspector.Event} event |
614 */ | 615 */ |
615 _uiSourceCodeContentCommitted: function(event) | 616 _uiSourceCodeContentCommitted: function(event) |
616 { | 617 { |
617 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data .uiSourceCode); | 618 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data .uiSourceCode); |
618 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSyst em) | 619 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSyst em) |
619 this._sassFileSaved(uiSourceCode.url, true); | 620 this._sassFileSaved(uiSourceCode.url, true); |
620 }, | 621 }, |
621 | 622 |
622 _reset: function() | 623 _reset: function() |
623 { | 624 { |
624 this._addingRevisionCounter = 0; | 625 this._addingRevisionCounter = 0; |
625 this._completeSourceMapURLForCSSURL = {}; | 626 this._completeSourceMapURLForCSSURL = {}; |
626 this._cssURLsForSASSURL = {}; | 627 this._cssURLsForSASSURL = {}; |
627 /** @type {!Object.<string, !Array.<function(?WebInspector.SourceMap)>>} */ | 628 /** @type {!Object.<string, !Array.<function(?WebInspector.SourceMap)>>} */ |
628 this._pendingSourceMapLoadingCallbacks = {}; | 629 this._pendingSourceMapLoadingCallbacks = {}; |
629 /** @type {!Object.<string, !{deadlineMs: number, dataByURL: !Object.<st ring, !{timer: number, previousPoll: number}>}>} */ | 630 /** @type {!Object.<string, !{deadlineMs: number, dataByURL: !Object.<st ring, !{timer: number, previousPoll: number}>}>} */ |
630 this._pollDataForSASSURL = {}; | 631 this._pollDataForSASSURL = {}; |
631 /** @type {!Object.<string, !WebInspector.SourceMap>} */ | 632 /** @type {!Object.<string, !WebInspector.SourceMap>} */ |
632 this._sourceMapByURL = {}; | 633 this._sourceMapByURL = {}; |
633 this._sourceMapByStyleSheetURL = {}; | 634 this._sourceMapByStyleSheetURL = {}; |
634 } | 635 } |
635 } | 636 } |
OLD | NEW |