| 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.CSSSourceMapping} | |
| 34 * @param {!WebInspector.CSSModel} cssModel | 33 * @param {!WebInspector.CSSModel} cssModel |
| 35 * @param {!WebInspector.NetworkMapping} networkMapping | 34 * @param {!WebInspector.NetworkMapping} networkMapping |
| 36 * @param {!WebInspector.NetworkProject} networkProject | 35 * @param {!WebInspector.NetworkProject} networkProject |
| 37 */ | 36 */ |
| 38 WebInspector.SASSSourceMapping = function(cssModel, networkMapping, networkProje
ct) | 37 WebInspector.SASSSourceMapping = function(cssModel, networkMapping, networkProje
ct) |
| 39 { | 38 { |
| 40 this._cssModel = cssModel; | 39 this._cssModel = cssModel; |
| 41 this._networkProject = networkProject; | 40 this._networkProject = networkProject; |
| 42 this._networkMapping = networkMapping; | 41 this._networkMapping = networkMapping; |
| 43 this._cssModel.addEventListener(WebInspector.CSSModel.Events.SourceMapAttach
ed, this._sourceMapAttached, this); | 42 this._cssModel.addEventListener(WebInspector.CSSModel.Events.SourceMapAttach
ed, this._sourceMapAttached, this); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 96 } |
| 98 }, | 97 }, |
| 99 | 98 |
| 100 /** | 99 /** |
| 101 * @param {!WebInspector.CSSStyleSheetHeader} header | 100 * @param {!WebInspector.CSSStyleSheetHeader} header |
| 102 */ | 101 */ |
| 103 addHeader: function(header) | 102 addHeader: function(header) |
| 104 { | 103 { |
| 105 if (!header.sourceMapURL) | 104 if (!header.sourceMapURL) |
| 106 return; | 105 return; |
| 107 WebInspector.cssWorkspaceBinding.pushSourceMapping(header, this); | 106 WebInspector.cssWorkspaceBinding.updateLocations(header); |
| 108 }, | 107 }, |
| 109 | 108 |
| 110 /** | 109 /** |
| 111 * @param {!WebInspector.CSSStyleSheetHeader} header | 110 * @param {!WebInspector.CSSStyleSheetHeader} header |
| 112 */ | 111 */ |
| 113 removeHeader: function(header) | 112 removeHeader: function(header) |
| 114 { | 113 { |
| 115 if (!header.sourceMapURL) | 114 if (!header.sourceMapURL) |
| 116 return; | 115 return; |
| 117 WebInspector.cssWorkspaceBinding.updateLocations(header); | 116 WebInspector.cssWorkspaceBinding.updateLocations(header); |
| 118 }, | 117 }, |
| 119 | 118 |
| 120 /** | 119 /** |
| 121 * @override | |
| 122 * @param {!WebInspector.CSSLocation} rawLocation | 120 * @param {!WebInspector.CSSLocation} rawLocation |
| 123 * @return {?WebInspector.UILocation} | 121 * @return {?WebInspector.UILocation} |
| 124 */ | 122 */ |
| 125 rawLocationToUILocation: function(rawLocation) | 123 rawLocationToUILocation: function(rawLocation) |
| 126 { | 124 { |
| 127 var sourceMap = this._cssModel.sourceMapForHeader(rawLocation.header()); | 125 var sourceMap = this._cssModel.sourceMapForHeader(rawLocation.header()); |
| 128 if (!sourceMap) | 126 if (!sourceMap) |
| 129 return null; | 127 return null; |
| 130 var entry = sourceMap.findEntry(rawLocation.lineNumber, rawLocation.colu
mnNumber); | 128 var entry = sourceMap.findEntry(rawLocation.lineNumber, rawLocation.colu
mnNumber); |
| 131 if (!entry || !entry.sourceURL) | 129 if (!entry || !entry.sourceURL) |
| 132 return null; | 130 return null; |
| 133 var uiSourceCode = this._networkMapping.uiSourceCodeForStyleURL(entry.so
urceURL, rawLocation.header()); | 131 var uiSourceCode = this._networkMapping.uiSourceCodeForStyleURL(entry.so
urceURL, rawLocation.header()); |
| 134 if (!uiSourceCode) | 132 if (!uiSourceCode) |
| 135 return null; | 133 return null; |
| 136 return uiSourceCode.uiLocation(entry.sourceLineNumber || 0, entry.source
ColumnNumber); | 134 return uiSourceCode.uiLocation(entry.sourceLineNumber || 0, entry.source
ColumnNumber); |
| 137 }, | 135 }, |
| 138 | |
| 139 /** | |
| 140 * @override | |
| 141 * @param {!WebInspector.UISourceCode} uiSourceCode | |
| 142 * @param {number} lineNumber | |
| 143 * @param {number} columnNumber | |
| 144 * @return {?WebInspector.CSSLocation} | |
| 145 */ | |
| 146 uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) | |
| 147 { | |
| 148 return null; | |
| 149 }, | |
| 150 | |
| 151 /** | |
| 152 * @override | |
| 153 * @return {boolean} | |
| 154 */ | |
| 155 isIdentity: function() | |
| 156 { | |
| 157 return false; | |
| 158 }, | |
| 159 | |
| 160 /** | |
| 161 * @override | |
| 162 * @param {!WebInspector.UISourceCode} uiSourceCode | |
| 163 * @param {number} lineNumber | |
| 164 * @return {boolean} | |
| 165 */ | |
| 166 uiLineHasMapping: function(uiSourceCode, lineNumber) | |
| 167 { | |
| 168 return true; | |
| 169 }, | |
| 170 | |
| 171 /** | |
| 172 * @return {!WebInspector.Target} | |
| 173 */ | |
| 174 target: function() | |
| 175 { | |
| 176 return this._cssModel.target(); | |
| 177 } | |
| 178 } | 136 } |
| OLD | NEW |