| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 | 588 |
| 589 _resetStyleSheets: function() | 589 _resetStyleSheets: function() |
| 590 { | 590 { |
| 591 var headers = this._styleSheetIdToHeader.values(); | 591 var headers = this._styleSheetIdToHeader.values(); |
| 592 this._styleSheetIdsForURL.clear(); | 592 this._styleSheetIdsForURL.clear(); |
| 593 this._styleSheetIdToHeader.clear(); | 593 this._styleSheetIdToHeader.clear(); |
| 594 for (var i = 0; i < headers.length; ++i) | 594 for (var i = 0; i < headers.length; ++i) |
| 595 this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.Styl
eSheetRemoved, headers[i]); | 595 this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.Styl
eSheetRemoved, headers[i]); |
| 596 }, | 596 }, |
| 597 | 597 |
| 598 updateLocations: function() | |
| 599 { | |
| 600 var headers = this._styleSheetIdToHeader.values(); | |
| 601 for (var i = 0; i < headers.length; ++i) | |
| 602 headers[i].updateLocations(); | |
| 603 }, | |
| 604 | |
| 605 /** | |
| 606 * @param {?CSSAgent.StyleSheetId} styleSheetId | |
| 607 * @param {!WebInspector.CSSLocation} rawLocation | |
| 608 * @param {function(!WebInspector.UILocation):(boolean|undefined)} updateDel
egate | |
| 609 * @return {?WebInspector.LiveLocation} | |
| 610 */ | |
| 611 createLiveLocation: function(styleSheetId, rawLocation, updateDelegate) | |
| 612 { | |
| 613 if (!rawLocation) | |
| 614 return null; | |
| 615 var header = styleSheetId ? this.styleSheetHeaderForId(styleSheetId) : n
ull; | |
| 616 return new WebInspector.CSSStyleModel.LiveLocation(this, header, rawLoca
tion, updateDelegate); | |
| 617 }, | |
| 618 | |
| 619 /** | |
| 620 * @param {!WebInspector.CSSLocation} rawLocation | |
| 621 * @return {?WebInspector.UILocation} | |
| 622 */ | |
| 623 rawLocationToUILocation: function(rawLocation) | |
| 624 { | |
| 625 var frameIdToSheetIds = this._styleSheetIdsForURL.get(rawLocation.url); | |
| 626 if (!frameIdToSheetIds) | |
| 627 return null; | |
| 628 var styleSheetIds = []; | |
| 629 for (var frameId in frameIdToSheetIds) | |
| 630 styleSheetIds = styleSheetIds.concat(frameIdToSheetIds[frameId]); | |
| 631 var uiLocation; | |
| 632 for (var i = 0; !uiLocation && i < styleSheetIds.length; ++i) { | |
| 633 var header = this.styleSheetHeaderForId(styleSheetIds[i]); | |
| 634 console.assert(header); | |
| 635 uiLocation = header.rawLocationToUILocation(rawLocation.lineNumber,
rawLocation.columnNumber); | |
| 636 } | |
| 637 return uiLocation || null; | |
| 638 }, | |
| 639 | |
| 640 __proto__: WebInspector.SDKModel.prototype | 598 __proto__: WebInspector.SDKModel.prototype |
| 641 } | 599 } |
| 642 | 600 |
| 643 /** | 601 /** |
| 644 * @constructor | 602 * @constructor |
| 645 * @extends {WebInspector.LiveLocation} | |
| 646 * @param {!WebInspector.CSSStyleModel} model | |
| 647 * @param {?WebInspector.CSSStyleSheetHeader} header | |
| 648 * @param {!WebInspector.CSSLocation} rawLocation | |
| 649 * @param {function(!WebInspector.UILocation):(boolean|undefined)} updateDelegat
e | |
| 650 */ | |
| 651 WebInspector.CSSStyleModel.LiveLocation = function(model, header, rawLocation, u
pdateDelegate) | |
| 652 { | |
| 653 WebInspector.LiveLocation.call(this, rawLocation, updateDelegate); | |
| 654 this._model = model; | |
| 655 if (!header) | |
| 656 this._clearStyleSheet(); | |
| 657 else | |
| 658 this._setStyleSheet(header); | |
| 659 } | |
| 660 | |
| 661 WebInspector.CSSStyleModel.LiveLocation.prototype = { | |
| 662 /** | |
| 663 * @param {!WebInspector.Event} event | |
| 664 */ | |
| 665 _styleSheetAdded: function(event) | |
| 666 { | |
| 667 console.assert(!this._header); | |
| 668 var header = /** @type {!WebInspector.CSSStyleSheetHeader} */ (event.dat
a); | |
| 669 if (header.sourceURL && header.sourceURL === this.rawLocation().url) | |
| 670 this._setStyleSheet(header); | |
| 671 }, | |
| 672 | |
| 673 /** | |
| 674 * @param {!WebInspector.Event} event | |
| 675 */ | |
| 676 _styleSheetRemoved: function(event) | |
| 677 { | |
| 678 console.assert(this._header); | |
| 679 var header = /** @type {!WebInspector.CSSStyleSheetHeader} */ (event.dat
a); | |
| 680 if (this._header !== header) | |
| 681 return; | |
| 682 this._header._removeLocation(this); | |
| 683 this._clearStyleSheet(); | |
| 684 }, | |
| 685 | |
| 686 /** | |
| 687 * @param {!WebInspector.CSSStyleSheetHeader} header | |
| 688 */ | |
| 689 _setStyleSheet: function(header) | |
| 690 { | |
| 691 this._header = header; | |
| 692 this._header.addLiveLocation(this); | |
| 693 this._model.removeEventListener(WebInspector.CSSStyleModel.Events.StyleS
heetAdded, this._styleSheetAdded, this); | |
| 694 this._model.addEventListener(WebInspector.CSSStyleModel.Events.StyleShee
tRemoved, this._styleSheetRemoved, this); | |
| 695 }, | |
| 696 | |
| 697 _clearStyleSheet: function() | |
| 698 { | |
| 699 delete this._header; | |
| 700 this._model.removeEventListener(WebInspector.CSSStyleModel.Events.StyleS
heetRemoved, this._styleSheetRemoved, this); | |
| 701 this._model.addEventListener(WebInspector.CSSStyleModel.Events.StyleShee
tAdded, this._styleSheetAdded, this); | |
| 702 }, | |
| 703 | |
| 704 /** | |
| 705 * @return {?WebInspector.UILocation} | |
| 706 */ | |
| 707 uiLocation: function() | |
| 708 { | |
| 709 var cssLocation = /** @type WebInspector.CSSLocation */ (this.rawLocatio
n()); | |
| 710 if (this._header) | |
| 711 return this._header.rawLocationToUILocation(cssLocation.lineNumber,
cssLocation.columnNumber); | |
| 712 var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(cssLocation
.url); | |
| 713 if (!uiSourceCode) | |
| 714 return null; | |
| 715 return uiSourceCode.uiLocation(cssLocation.lineNumber, cssLocation.colum
nNumber); | |
| 716 }, | |
| 717 | |
| 718 dispose: function() | |
| 719 { | |
| 720 WebInspector.LiveLocation.prototype.dispose.call(this); | |
| 721 if (this._header) | |
| 722 this._header._removeLocation(this); | |
| 723 this._model.removeEventListener(WebInspector.CSSStyleModel.Events.StyleS
heetAdded, this._styleSheetAdded, this); | |
| 724 this._model.removeEventListener(WebInspector.CSSStyleModel.Events.StyleS
heetRemoved, this._styleSheetRemoved, this); | |
| 725 }, | |
| 726 | |
| 727 __proto__: WebInspector.LiveLocation.prototype | |
| 728 } | |
| 729 | |
| 730 /** | |
| 731 * @constructor | |
| 732 * @implements {WebInspector.RawLocation} | 603 * @implements {WebInspector.RawLocation} |
| 733 * @extends {WebInspector.SDKObject} | 604 * @extends {WebInspector.SDKObject} |
| 734 * @param {!WebInspector.Target} target | 605 * @param {!WebInspector.Target} target |
| 735 * @param {?CSSAgent.StyleSheetId} styleSheetId | 606 * @param {?CSSAgent.StyleSheetId} styleSheetId |
| 736 * @param {string} url | 607 * @param {string} url |
| 737 * @param {number} lineNumber | 608 * @param {number} lineNumber |
| 738 * @param {number=} columnNumber | 609 * @param {number=} columnNumber |
| 739 */ | 610 */ |
| 740 WebInspector.CSSLocation = function(target, styleSheetId, url, lineNumber, colum
nNumber) | 611 WebInspector.CSSLocation = function(target, styleSheetId, url, lineNumber, colum
nNumber) |
| 741 { | 612 { |
| 742 WebInspector.SDKObject.call(this, target); | 613 WebInspector.SDKObject.call(this, target); |
| 743 this._cssModel = target.cssModel; | 614 this.styleSheetId = styleSheetId; |
| 744 this._styleSheetId = styleSheetId; | |
| 745 this.url = url; | 615 this.url = url; |
| 746 this.lineNumber = lineNumber; | 616 this.lineNumber = lineNumber; |
| 747 this.columnNumber = columnNumber || 0; | 617 this.columnNumber = columnNumber || 0; |
| 748 } | 618 } |
| 749 | 619 |
| 750 WebInspector.CSSLocation.prototype = { | 620 WebInspector.CSSLocation.prototype = { |
| 751 /** | |
| 752 * @param {function(!WebInspector.UILocation):(boolean|undefined)} updateDel
egate | |
| 753 * @return {!WebInspector.LiveLocation} | |
| 754 */ | |
| 755 createLiveLocation: function(updateDelegate) | |
| 756 { | |
| 757 var header = this._styleSheetId ? this._cssModel.styleSheetHeaderForId(t
his._styleSheetId) : null; | |
| 758 return new WebInspector.CSSStyleModel.LiveLocation(this._cssModel, heade
r, this, updateDelegate); | |
| 759 }, | |
| 760 | |
| 761 __proto__: WebInspector.SDKObject.prototype | 621 __proto__: WebInspector.SDKObject.prototype |
| 762 } | 622 } |
| 763 | 623 |
| 764 /** | 624 /** |
| 765 * @constructor | 625 * @constructor |
| 766 * @param {!WebInspector.CSSStyleModel} cssModel | 626 * @param {!WebInspector.CSSStyleModel} cssModel |
| 767 * @param {!CSSAgent.CSSStyle} payload | 627 * @param {!CSSAgent.CSSStyle} payload |
| 768 */ | 628 */ |
| 769 WebInspector.CSSStyleDeclaration = function(cssModel, payload) | 629 WebInspector.CSSStyleDeclaration = function(cssModel, payload) |
| 770 { | 630 { |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 } | 916 } |
| 1057 if (this.styleSheetId) { | 917 if (this.styleSheetId) { |
| 1058 var styleSheetHeader = cssModel.styleSheetHeaderForId(this.styleSheetId)
; | 918 var styleSheetHeader = cssModel.styleSheetHeaderForId(this.styleSheetId)
; |
| 1059 this.sourceURL = styleSheetHeader.sourceURL; | 919 this.sourceURL = styleSheetHeader.sourceURL; |
| 1060 } | 920 } |
| 1061 this.origin = payload.origin; | 921 this.origin = payload.origin; |
| 1062 this.style = WebInspector.CSSStyleDeclaration.parsePayload(this._cssModel, p
ayload.style); | 922 this.style = WebInspector.CSSStyleDeclaration.parsePayload(this._cssModel, p
ayload.style); |
| 1063 this.style.parentRule = this; | 923 this.style.parentRule = this; |
| 1064 if (payload.media) | 924 if (payload.media) |
| 1065 this.media = WebInspector.CSSMedia.parseMediaArrayPayload(cssModel, payl
oad.media); | 925 this.media = WebInspector.CSSMedia.parseMediaArrayPayload(cssModel, payl
oad.media); |
| 1066 this._setRawLocationAndFrameId(); | 926 this._setFrameId(); |
| 1067 } | 927 } |
| 1068 | 928 |
| 1069 /** | 929 /** |
| 1070 * @param {!WebInspector.CSSStyleModel} cssModel | 930 * @param {!WebInspector.CSSStyleModel} cssModel |
| 1071 * @param {!CSSAgent.CSSRule} payload | 931 * @param {!CSSAgent.CSSRule} payload |
| 1072 * @param {!Array.<number>=} matchingIndices | 932 * @param {!Array.<number>=} matchingIndices |
| 1073 * @return {!WebInspector.CSSRule} | 933 * @return {!WebInspector.CSSRule} |
| 1074 */ | 934 */ |
| 1075 WebInspector.CSSRule.parsePayload = function(cssModel, payload, matchingIndices) | 935 WebInspector.CSSRule.parsePayload = function(cssModel, payload, matchingIndices) |
| 1076 { | 936 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1094 selector.range = selector.range.rebaseAfterTextEdit(oldRange
, newRange); | 954 selector.range = selector.range.rebaseAfterTextEdit(oldRange
, newRange); |
| 1095 } | 955 } |
| 1096 } | 956 } |
| 1097 if (this.media) { | 957 if (this.media) { |
| 1098 for (var i = 0; i < this.media.length; ++i) | 958 for (var i = 0; i < this.media.length; ++i) |
| 1099 this.media[i].sourceStyleSheetEdited(styleSheetId, oldRange, new
Range); | 959 this.media[i].sourceStyleSheetEdited(styleSheetId, oldRange, new
Range); |
| 1100 } | 960 } |
| 1101 this.style.sourceStyleSheetEdited(styleSheetId, oldRange, newRange); | 961 this.style.sourceStyleSheetEdited(styleSheetId, oldRange, newRange); |
| 1102 }, | 962 }, |
| 1103 | 963 |
| 1104 _setRawLocationAndFrameId: function() | 964 _setFrameId: function() |
| 1105 { | 965 { |
| 1106 if (!this.styleSheetId) | 966 if (!this.styleSheetId) |
| 1107 return; | 967 return; |
| 1108 var styleSheetHeader = this._cssModel.styleSheetHeaderForId(this.styleSh
eetId); | 968 var styleSheetHeader = this._cssModel.styleSheetHeaderForId(this.styleSh
eetId); |
| 1109 this.frameId = styleSheetHeader.frameId; | 969 this.frameId = styleSheetHeader.frameId; |
| 1110 var url = styleSheetHeader.resourceURL(); | |
| 1111 if (!url) | |
| 1112 return; | |
| 1113 this.rawLocation = new WebInspector.CSSLocation(this._cssModel.target(),
this.styleSheetId, url, this.lineNumberInSource(0), this.columnNumberInSource(0
)); | |
| 1114 }, | 970 }, |
| 1115 | 971 |
| 1116 /** | 972 /** |
| 1117 * @return {string} | 973 * @return {string} |
| 1118 */ | 974 */ |
| 1119 resourceURL: function() | 975 resourceURL: function() |
| 1120 { | 976 { |
| 1121 if (!this.styleSheetId) | 977 if (!this.styleSheetId) |
| 1122 return ""; | 978 return ""; |
| 1123 var styleSheetHeader = this._cssModel.styleSheetHeaderForId(this.styleSh
eetId); | 979 var styleSheetHeader = this._cssModel.styleSheetHeaderForId(this.styleSh
eetId); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1144 columnNumberInSource: function(selectorIndex) | 1000 columnNumberInSource: function(selectorIndex) |
| 1145 { | 1001 { |
| 1146 var selector = this.selectors[selectorIndex]; | 1002 var selector = this.selectors[selectorIndex]; |
| 1147 if (!selector || !selector.range || !this.styleSheetId) | 1003 if (!selector || !selector.range || !this.styleSheetId) |
| 1148 return undefined; | 1004 return undefined; |
| 1149 var styleSheetHeader = this._cssModel.styleSheetHeaderForId(this.styleSh
eetId); | 1005 var styleSheetHeader = this._cssModel.styleSheetHeaderForId(this.styleSh
eetId); |
| 1150 console.assert(styleSheetHeader); | 1006 console.assert(styleSheetHeader); |
| 1151 return styleSheetHeader.columnNumberInSource(selector.range.startLine, s
elector.range.startColumn); | 1007 return styleSheetHeader.columnNumberInSource(selector.range.startLine, s
elector.range.startColumn); |
| 1152 }, | 1008 }, |
| 1153 | 1009 |
| 1010 /** |
| 1011 * @param {number} index |
| 1012 * @return {?WebInspector.CSSLocation} |
| 1013 */ |
| 1014 rawSelectorLocation: function(index) |
| 1015 { |
| 1016 var lineNumber = this.lineNumberInSource(index); |
| 1017 var columnNumber = this.columnNumberInSource(index); |
| 1018 return new WebInspector.CSSLocation(this._cssModel.target(), this.styleS
heetId || null, this.resourceURL(), lineNumber, columnNumber); |
| 1019 }, |
| 1020 |
| 1154 get isUserAgent() | 1021 get isUserAgent() |
| 1155 { | 1022 { |
| 1156 return this.origin === "user-agent"; | 1023 return this.origin === "user-agent"; |
| 1157 }, | 1024 }, |
| 1158 | 1025 |
| 1159 get isUser() | 1026 get isUser() |
| 1160 { | 1027 { |
| 1161 return this.origin === "user"; | 1028 return this.origin === "user"; |
| 1162 }, | 1029 }, |
| 1163 | 1030 |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1515 header: function() | 1382 header: function() |
| 1516 { | 1383 { |
| 1517 return this.parentStyleSheetId ? this._cssModel.styleSheetHeaderForId(th
is.parentStyleSheetId) : null; | 1384 return this.parentStyleSheetId ? this._cssModel.styleSheetHeaderForId(th
is.parentStyleSheetId) : null; |
| 1518 }, | 1385 }, |
| 1519 | 1386 |
| 1520 /** | 1387 /** |
| 1521 * @return {?WebInspector.CSSLocation} | 1388 * @return {?WebInspector.CSSLocation} |
| 1522 */ | 1389 */ |
| 1523 rawLocation: function() | 1390 rawLocation: function() |
| 1524 { | 1391 { |
| 1525 if (!this.header() || typeof this.lineNumberInSource() === "undefined") | 1392 if (!this.header() || this.lineNumberInSource() === undefined) |
| 1526 return null; | 1393 return null; |
| 1527 var lineNumber = Number(this.lineNumberInSource()); | 1394 var lineNumber = Number(this.lineNumberInSource()); |
| 1528 return new WebInspector.CSSLocation(this._cssModel.target(), this.header
().id, this.sourceURL, lineNumber, this.columnNumberInSource()); | 1395 return new WebInspector.CSSLocation(this._cssModel.target(), this.header
().id, this.sourceURL, lineNumber, this.columnNumberInSource()); |
| 1529 }, | |
| 1530 | |
| 1531 /** | |
| 1532 * @return {?WebInspector.UILocation} | |
| 1533 */ | |
| 1534 uiLocation: function() | |
| 1535 { | |
| 1536 var styleSheetHeader = this.header(); | |
| 1537 var lineNumber = this.lineNumberInSource(); | |
| 1538 var columnNumber = this.columnNumberInSource(); | |
| 1539 if (typeof lineNumber !== "number") | |
| 1540 return null; | |
| 1541 if (styleSheetHeader) | |
| 1542 return styleSheetHeader.rawLocationToUILocation(lineNumber, columnNu
mber); | |
| 1543 var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(this.source
URL); | |
| 1544 if (!uiSourceCode) | |
| 1545 return null; | |
| 1546 return uiSourceCode.uiLocation(lineNumber, columnNumber); | |
| 1547 } | 1396 } |
| 1548 } | 1397 } |
| 1549 | 1398 |
| 1550 /** | 1399 /** |
| 1551 * @constructor | 1400 * @constructor |
| 1552 * @implements {WebInspector.ContentProvider} | 1401 * @implements {WebInspector.ContentProvider} |
| 1553 * @param {!WebInspector.CSSStyleModel} cssModel | 1402 * @param {!WebInspector.CSSStyleModel} cssModel |
| 1554 * @param {!CSSAgent.CSSStyleSheetHeader} payload | 1403 * @param {!CSSAgent.CSSStyleSheetHeader} payload |
| 1555 */ | 1404 */ |
| 1556 WebInspector.CSSStyleSheetHeader = function(cssModel, payload) | 1405 WebInspector.CSSStyleSheetHeader = function(cssModel, payload) |
| 1557 { | 1406 { |
| 1558 this._cssModel = cssModel; | 1407 this._cssModel = cssModel; |
| 1559 this.id = payload.styleSheetId; | 1408 this.id = payload.styleSheetId; |
| 1560 this.frameId = payload.frameId; | 1409 this.frameId = payload.frameId; |
| 1561 this.sourceURL = payload.sourceURL; | 1410 this.sourceURL = payload.sourceURL; |
| 1562 this.hasSourceURL = !!payload.hasSourceURL; | 1411 this.hasSourceURL = !!payload.hasSourceURL; |
| 1563 this.sourceMapURL = payload.sourceMapURL; | 1412 this.sourceMapURL = payload.sourceMapURL; |
| 1564 this.origin = payload.origin; | 1413 this.origin = payload.origin; |
| 1565 this.title = payload.title; | 1414 this.title = payload.title; |
| 1566 this.disabled = payload.disabled; | 1415 this.disabled = payload.disabled; |
| 1567 this.isInline = payload.isInline; | 1416 this.isInline = payload.isInline; |
| 1568 this.startLine = payload.startLine; | 1417 this.startLine = payload.startLine; |
| 1569 this.startColumn = payload.startColumn; | 1418 this.startColumn = payload.startColumn; |
| 1570 /** @type {!Set.<!WebInspector.CSSStyleModel.LiveLocation>} */ | |
| 1571 this._locations = new Set(); | |
| 1572 /** @type {!Array.<!WebInspector.SourceMapping>} */ | |
| 1573 this._sourceMappings = []; | |
| 1574 } | 1419 } |
| 1575 | 1420 |
| 1576 WebInspector.CSSStyleSheetHeader.prototype = { | 1421 WebInspector.CSSStyleSheetHeader.prototype = { |
| 1577 /** | 1422 /** |
| 1423 * @return {!WebInspector.Target} |
| 1424 */ |
| 1425 target: function() |
| 1426 { |
| 1427 return this._cssModel.target(); |
| 1428 }, |
| 1429 |
| 1430 /** |
| 1578 * @return {string} | 1431 * @return {string} |
| 1579 */ | 1432 */ |
| 1580 resourceURL: function() | 1433 resourceURL: function() |
| 1581 { | 1434 { |
| 1582 return this.isViaInspector() ? this._viaInspectorResourceURL() : this.so
urceURL; | 1435 return this.isViaInspector() ? this._viaInspectorResourceURL() : this.so
urceURL; |
| 1583 }, | 1436 }, |
| 1584 | 1437 |
| 1585 /** | 1438 /** |
| 1586 * @param {!WebInspector.CSSStyleModel.LiveLocation} location | |
| 1587 */ | |
| 1588 addLiveLocation: function(location) | |
| 1589 { | |
| 1590 this._locations.add(location); | |
| 1591 location.update(); | |
| 1592 }, | |
| 1593 | |
| 1594 updateLocations: function() | |
| 1595 { | |
| 1596 var items = this._locations.values(); | |
| 1597 for (var i = 0; i < items.length; ++i) | |
| 1598 items[i].update(); | |
| 1599 }, | |
| 1600 | |
| 1601 /** | |
| 1602 * @param {!WebInspector.CSSStyleModel.LiveLocation} location | |
| 1603 */ | |
| 1604 _removeLocation: function(location) | |
| 1605 { | |
| 1606 this._locations.remove(location); | |
| 1607 }, | |
| 1608 | |
| 1609 /** | |
| 1610 * @param {number} lineNumber | |
| 1611 * @param {number=} columnNumber | |
| 1612 * @return {?WebInspector.UILocation} | |
| 1613 */ | |
| 1614 rawLocationToUILocation: function(lineNumber, columnNumber) | |
| 1615 { | |
| 1616 var uiLocation = null; | |
| 1617 var rawLocation = new WebInspector.CSSLocation(this._cssModel.target(),
this.id, this.resourceURL(), lineNumber, columnNumber); | |
| 1618 for (var i = this._sourceMappings.length - 1; !uiLocation && i >= 0; --i
) | |
| 1619 uiLocation = this._sourceMappings[i].rawLocationToUILocation(rawLoca
tion); | |
| 1620 return uiLocation; | |
| 1621 }, | |
| 1622 | |
| 1623 /** | |
| 1624 * @param {!WebInspector.SourceMapping} sourceMapping | |
| 1625 */ | |
| 1626 pushSourceMapping: function(sourceMapping) | |
| 1627 { | |
| 1628 this._sourceMappings.push(sourceMapping); | |
| 1629 this.updateLocations(); | |
| 1630 }, | |
| 1631 | |
| 1632 /** | |
| 1633 * @return {string} | 1439 * @return {string} |
| 1634 */ | 1440 */ |
| 1635 _viaInspectorResourceURL: function() | 1441 _viaInspectorResourceURL: function() |
| 1636 { | 1442 { |
| 1637 var frame = this._cssModel.target().resourceTreeModel.frameForId(this.fr
ameId); | 1443 var frame = this._cssModel.target().resourceTreeModel.frameForId(this.fr
ameId); |
| 1638 console.assert(frame); | 1444 console.assert(frame); |
| 1639 var parsedURL = new WebInspector.ParsedURL(frame.url); | 1445 var parsedURL = new WebInspector.ParsedURL(frame.url); |
| 1640 var fakeURL = "inspector://" + parsedURL.host + parsedURL.folderPathComp
onents; | 1446 var fakeURL = "inspector://" + parsedURL.host + parsedURL.folderPathComp
onents; |
| 1641 if (!fakeURL.endsWith("/")) | 1447 if (!fakeURL.endsWith("/")) |
| 1642 fakeURL += "/"; | 1448 fakeURL += "/"; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1739 newText += "\n/*# sourceURL=" + this.sourceURL + " */"; | 1545 newText += "\n/*# sourceURL=" + this.sourceURL + " */"; |
| 1740 this._cssModel._agent.setStyleSheetText(this.id, newText, callback); | 1546 this._cssModel._agent.setStyleSheetText(this.id, newText, callback); |
| 1741 }, | 1547 }, |
| 1742 | 1548 |
| 1743 /** | 1549 /** |
| 1744 * @return {boolean} | 1550 * @return {boolean} |
| 1745 */ | 1551 */ |
| 1746 isViaInspector: function() | 1552 isViaInspector: function() |
| 1747 { | 1553 { |
| 1748 return this.origin === "inspector"; | 1554 return this.origin === "inspector"; |
| 1749 }, | 1555 } |
| 1750 | |
| 1751 } | 1556 } |
| 1752 | 1557 |
| 1753 /** | 1558 /** |
| 1754 * @constructor | 1559 * @constructor |
| 1755 * @implements {CSSAgent.Dispatcher} | 1560 * @implements {CSSAgent.Dispatcher} |
| 1756 * @param {!WebInspector.CSSStyleModel} cssModel | 1561 * @param {!WebInspector.CSSStyleModel} cssModel |
| 1757 */ | 1562 */ |
| 1758 WebInspector.CSSDispatcher = function(cssModel) | 1563 WebInspector.CSSDispatcher = function(cssModel) |
| 1759 { | 1564 { |
| 1760 this._cssModel = cssModel; | 1565 this._cssModel = cssModel; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1837 for (var i = 0; i < callbacks.length; ++i) | 1642 for (var i = 0; i < callbacks.length; ++i) |
| 1838 callbacks[i](computedStyle); | 1643 callbacks[i](computedStyle); |
| 1839 } | 1644 } |
| 1840 } | 1645 } |
| 1841 } | 1646 } |
| 1842 | 1647 |
| 1843 /** | 1648 /** |
| 1844 * @type {!WebInspector.CSSStyleModel} | 1649 * @type {!WebInspector.CSSStyleModel} |
| 1845 */ | 1650 */ |
| 1846 WebInspector.cssModel; | 1651 WebInspector.cssModel; |
| OLD | NEW |