| 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * | 10 * |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * @constructor | 30 * @constructor |
| 31 * @extends {WebInspector.SelectionDialogContentProvider} | 31 * @extends {WebInspector.SelectionDialogContentProvider} |
| 32 * @param {WebInspector.View} view | 32 * @param {WebInspector.View} view |
| 33 * @param {WebInspector.UISourceCode} uiSourceCode | 33 * @param {WebInspector.UISourceCode} uiSourceCode |
| 34 * @param {function(number, number)} selectItemCallback |
| 34 */ | 35 */ |
| 35 WebInspector.StyleSheetOutlineDialog = function(view, uiSourceCode) | 36 WebInspector.StyleSheetOutlineDialog = function(view, uiSourceCode, selectItemCa
llback) |
| 36 { | 37 { |
| 37 WebInspector.SelectionDialogContentProvider.call(this); | 38 WebInspector.SelectionDialogContentProvider.call(this); |
| 38 | 39 this._selectItemCallback = selectItemCallback; |
| 39 this._rules = []; | 40 this._rules = []; |
| 40 this._view = view; | 41 this._view = view; |
| 41 this._uiSourceCode = uiSourceCode; | 42 this._uiSourceCode = uiSourceCode; |
| 42 this._requestItems(); | 43 this._requestItems(); |
| 43 } | 44 } |
| 44 | 45 |
| 45 /** | 46 /** |
| 46 * @param {WebInspector.View} view | 47 * @param {WebInspector.View} view |
| 47 * @param {WebInspector.UISourceCode} uiSourceCode | 48 * @param {WebInspector.UISourceCode} uiSourceCode |
| 49 * @param {function(number, number)} selectItemCallback |
| 48 */ | 50 */ |
| 49 WebInspector.StyleSheetOutlineDialog.show = function(view, uiSourceCode) | 51 WebInspector.StyleSheetOutlineDialog.show = function(view, uiSourceCode, selectI
temCallback) |
| 50 { | 52 { |
| 51 if (WebInspector.Dialog.currentInstance()) | 53 if (WebInspector.Dialog.currentInstance()) |
| 52 return null; | 54 return null; |
| 53 var delegate = new WebInspector.StyleSheetOutlineDialog(view, uiSourceCode); | 55 var delegate = new WebInspector.StyleSheetOutlineDialog(view, uiSourceCode,
selectItemCallback); |
| 54 var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDial
og(delegate); | 56 var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDial
og(delegate); |
| 55 WebInspector.Dialog.show(view.element, filteredItemSelectionDialog); | 57 WebInspector.Dialog.show(view.element, filteredItemSelectionDialog); |
| 56 } | 58 } |
| 57 | 59 |
| 58 WebInspector.StyleSheetOutlineDialog.prototype = { | 60 WebInspector.StyleSheetOutlineDialog.prototype = { |
| 59 /** | 61 /** |
| 60 * @return {number} | 62 * @return {number} |
| 61 */ | 63 */ |
| 62 itemCount: function() | 64 itemCount: function() |
| 63 { | 65 { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 133 |
| 132 /** | 134 /** |
| 133 * @param {number} itemIndex | 135 * @param {number} itemIndex |
| 134 * @param {string} promptValue | 136 * @param {string} promptValue |
| 135 */ | 137 */ |
| 136 selectItem: function(itemIndex, promptValue) | 138 selectItem: function(itemIndex, promptValue) |
| 137 { | 139 { |
| 138 var rule = this._rules[itemIndex]; | 140 var rule = this._rules[itemIndex]; |
| 139 var lineNumber = rule.rawLocation.lineNumber; | 141 var lineNumber = rule.rawLocation.lineNumber; |
| 140 if (!isNaN(lineNumber) && lineNumber >= 0) | 142 if (!isNaN(lineNumber) && lineNumber >= 0) |
| 141 this._view.highlightPosition(lineNumber, rule.rawLocation.columnNumb
er); | 143 this._selectItemCallback(lineNumber, rule.rawLocation.columnNumber); |
| 142 this._view.focus(); | |
| 143 }, | 144 }, |
| 144 | 145 |
| 145 __proto__: WebInspector.SelectionDialogContentProvider.prototype | 146 __proto__: WebInspector.SelectionDialogContentProvider.prototype |
| 146 } | 147 } |
| OLD | NEW |