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 12 matching lines...) Expand all Loading... |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @implements {WebInspector.SourceMapping} | 33 * @implements {WebInspector.CSSSourceMapping} |
34 * @param {!WebInspector.CSSStyleModel} cssModel | 34 * @param {!WebInspector.CSSStyleModel} cssModel |
35 * @param {!WebInspector.Workspace} workspace | 35 * @param {!WebInspector.Workspace} workspace |
36 * @param {!WebInspector.NetworkWorkspaceBinding} networkWorkspaceBinding | 36 * @param {!WebInspector.NetworkWorkspaceBinding} networkWorkspaceBinding |
37 */ | 37 */ |
38 WebInspector.SASSSourceMapping = function(cssModel, workspace, networkWorkspaceB
inding) | 38 WebInspector.SASSSourceMapping = function(cssModel, workspace, networkWorkspaceB
inding) |
39 { | 39 { |
40 this.pollPeriodMs = 5000; | 40 this.pollPeriodMs = 5000; |
41 this.pollIntervalMs = 200; | 41 this.pollIntervalMs = 200; |
42 | 42 |
43 this._cssModel = cssModel; | 43 this._cssModel = cssModel; |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
533 }, | 533 }, |
534 | 534 |
535 /** | 535 /** |
536 * @param {!WebInspector.RawLocation} rawLocation | 536 * @param {!WebInspector.CSSLocation} rawLocation |
537 * @return {?WebInspector.UILocation} | 537 * @return {?WebInspector.UILocation} |
538 */ | 538 */ |
539 rawLocationToUILocation: function(rawLocation) | 539 rawLocationToUILocation: function(rawLocation) |
540 { | 540 { |
541 var location = /** @type WebInspector.CSSLocation */ (rawLocation); | |
542 var entry; | 541 var entry; |
543 var sourceMap = this._sourceMapByStyleSheetURL[location.url]; | 542 var sourceMap = this._sourceMapByStyleSheetURL[rawLocation.url]; |
544 if (!sourceMap) | 543 if (!sourceMap) |
545 return null; | 544 return null; |
546 entry = sourceMap.findEntry(location.lineNumber, location.columnNumber); | 545 entry = sourceMap.findEntry(rawLocation.lineNumber, rawLocation.columnNu
mber); |
547 if (!entry || entry.length === 2) | 546 if (!entry || entry.length === 2) |
548 return null; | 547 return null; |
549 var uiSourceCode = this._workspace.uiSourceCodeForURL(entry[2]); | 548 var uiSourceCode = this._workspace.uiSourceCodeForURL(entry[2]); |
550 if (!uiSourceCode) | 549 if (!uiSourceCode) |
551 return null; | 550 return null; |
552 return uiSourceCode.uiLocation(entry[3], entry[4]); | 551 return uiSourceCode.uiLocation(entry[3], entry[4]); |
553 }, | 552 }, |
554 | 553 |
555 /** | 554 /** |
556 * @param {!WebInspector.UISourceCode} uiSourceCode | 555 * @param {!WebInspector.UISourceCode} uiSourceCode |
557 * @param {number} lineNumber | 556 * @param {number} lineNumber |
558 * @param {number} columnNumber | 557 * @param {number} columnNumber |
559 * @return {!WebInspector.RawLocation} | 558 * @return {!WebInspector.CSSLocation} |
560 */ | 559 */ |
561 uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) | 560 uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) |
562 { | 561 { |
563 // FIXME: Implement this when ui -> raw mapping has clients. | 562 // FIXME: Implement this when ui -> raw mapping has clients. |
564 return new WebInspector.CSSLocation(this._cssModel.target(), null, uiSou
rceCode.url || "", lineNumber, columnNumber); | 563 return new WebInspector.CSSLocation(this._cssModel.target(), null, uiSou
rceCode.url || "", lineNumber, columnNumber); |
565 }, | 564 }, |
566 | 565 |
567 /** | 566 /** |
568 * @return {boolean} | 567 * @return {boolean} |
569 */ | 568 */ |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 this._cssURLsForSASSURL = {}; | 625 this._cssURLsForSASSURL = {}; |
627 /** @type {!Object.<string, !Array.<function(?WebInspector.SourceMap)>>}
*/ | 626 /** @type {!Object.<string, !Array.<function(?WebInspector.SourceMap)>>}
*/ |
628 this._pendingSourceMapLoadingCallbacks = {}; | 627 this._pendingSourceMapLoadingCallbacks = {}; |
629 /** @type {!Object.<string, !{deadlineMs: number, dataByURL: !Object.<st
ring, !{timer: number, previousPoll: number}>}>} */ | 628 /** @type {!Object.<string, !{deadlineMs: number, dataByURL: !Object.<st
ring, !{timer: number, previousPoll: number}>}>} */ |
630 this._pollDataForSASSURL = {}; | 629 this._pollDataForSASSURL = {}; |
631 /** @type {!Object.<string, !WebInspector.SourceMap>} */ | 630 /** @type {!Object.<string, !WebInspector.SourceMap>} */ |
632 this._sourceMapByURL = {}; | 631 this._sourceMapByURL = {}; |
633 this._sourceMapByStyleSheetURL = {}; | 632 this._sourceMapByStyleSheetURL = {}; |
634 } | 633 } |
635 } | 634 } |
OLD | NEW |