| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 */ | 67 */ |
| 68 rawLocationToUILocation(rawLocation) { | 68 rawLocationToUILocation(rawLocation) { |
| 69 var header = rawLocation.header(); | 69 var header = rawLocation.header(); |
| 70 if (!header) | 70 if (!header) |
| 71 return null; | 71 return null; |
| 72 var uiSourceCode = Bindings.NetworkProject.uiSourceCodeForStyleURL(this._wor
kspace, rawLocation.url, header); | 72 var uiSourceCode = Bindings.NetworkProject.uiSourceCodeForStyleURL(this._wor
kspace, rawLocation.url, header); |
| 73 if (!uiSourceCode) | 73 if (!uiSourceCode) |
| 74 return null; | 74 return null; |
| 75 var lineNumber = rawLocation.lineNumber; | 75 var lineNumber = rawLocation.lineNumber; |
| 76 var columnNumber = rawLocation.columnNumber; | 76 var columnNumber = rawLocation.columnNumber; |
| 77 if (header && header.isInline && header.hasSourceURL) { | 77 if (header.isInline && header.hasSourceURL) { |
| 78 lineNumber -= header.lineNumberInSource(0); | 78 lineNumber -= header.lineNumberInSource(0); |
| 79 columnNumber -= header.columnNumberInSource(lineNumber, 0); | 79 columnNumber -= header.columnNumberInSource(lineNumber, 0); |
| 80 } | 80 } |
| 81 return uiSourceCode.uiLocation(lineNumber, columnNumber); | 81 return uiSourceCode.uiLocation(lineNumber, columnNumber); |
| 82 } | 82 } |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * @override |
| 86 * @param {!Workspace.UILocation} uiLocation |
| 87 * @return {!Array<!SDK.CSSLocation>} |
| 88 */ |
| 89 uiLocationToRawLocations(uiLocation) { |
| 90 // TODO(caseq,lushnikov): return multiple raw locations. |
| 91 var header = Bindings.NetworkProject.styleHeaderForUISourceCode(uiLocation.u
iSourceCode); |
| 92 if (!header) |
| 93 return []; |
| 94 var lineNumber = uiLocation.lineNumber; |
| 95 var columnNumber = uiLocation.columnNumber; |
| 96 if (header.isInline && header.hasSourceURL) { |
| 97 columnNumber = header.columnNumberInSource(lineNumber, columnNumber); |
| 98 lineNumber = header.lineNumberInSource(lineNumber); |
| 99 } |
| 100 return [new SDK.CSSLocation(header, lineNumber, columnNumber)]; |
| 101 } |
| 102 |
| 103 /** |
| 85 * @param {!Common.Event} event | 104 * @param {!Common.Event} event |
| 86 */ | 105 */ |
| 87 _styleSheetAdded(event) { | 106 _styleSheetAdded(event) { |
| 88 var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data); | 107 var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data); |
| 89 var url = header.resourceURL(); | 108 var url = header.resourceURL(); |
| 90 if (!url) | 109 if (!url) |
| 91 return; | 110 return; |
| 92 | 111 |
| 93 var map = this._urlToHeadersByFrameId.get(url); | 112 var map = this._urlToHeadersByFrameId.get(url); |
| 94 if (!map) { | 113 if (!map) { |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 377 |
| 359 dispose() { | 378 dispose() { |
| 360 if (this._terminated) | 379 if (this._terminated) |
| 361 return; | 380 return; |
| 362 this._terminated = true; | 381 this._terminated = true; |
| 363 Common.EventTarget.removeEventListeners(this._eventListeners); | 382 Common.EventTarget.removeEventListeners(this._eventListeners); |
| 364 } | 383 } |
| 365 }; | 384 }; |
| 366 | 385 |
| 367 Bindings.StyleFile.updateTimeout = 200; | 386 Bindings.StyleFile.updateTimeout = 200; |
| OLD | NEW |