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 21 matching lines...) Expand all Loading... |
32 * @param {!WebInspector.UISourceCode} uiSourceCode | 32 * @param {!WebInspector.UISourceCode} uiSourceCode |
33 * @param {function(number, number)} selectItemCallback | 33 * @param {function(number, number)} selectItemCallback |
34 */ | 34 */ |
35 WebInspector.StyleSheetOutlineDialog = function(uiSourceCode, selectItemCallback
) | 35 WebInspector.StyleSheetOutlineDialog = function(uiSourceCode, selectItemCallback
) |
36 { | 36 { |
37 WebInspector.FilteredListWidget.Delegate.call(this, []); | 37 WebInspector.FilteredListWidget.Delegate.call(this, []); |
38 this._selectItemCallback = selectItemCallback; | 38 this._selectItemCallback = selectItemCallback; |
39 this._cssParser = new WebInspector.CSSParser(); | 39 this._cssParser = new WebInspector.CSSParser(); |
40 this._cssParser.addEventListener(WebInspector.CSSParser.Events.RulesParsed,
this.refresh.bind(this)); | 40 this._cssParser.addEventListener(WebInspector.CSSParser.Events.RulesParsed,
this.refresh.bind(this)); |
41 this._cssParser.parse(uiSourceCode.workingCopy()); | 41 this._cssParser.parse(uiSourceCode.workingCopy()); |
42 } | 42 }; |
43 | 43 |
44 /** | 44 /** |
45 * @param {!WebInspector.UISourceCode} uiSourceCode | 45 * @param {!WebInspector.UISourceCode} uiSourceCode |
46 * @param {function(number, number)} selectItemCallback | 46 * @param {function(number, number)} selectItemCallback |
47 */ | 47 */ |
48 WebInspector.StyleSheetOutlineDialog.show = function(uiSourceCode, selectItemCal
lback) | 48 WebInspector.StyleSheetOutlineDialog.show = function(uiSourceCode, selectItemCal
lback) |
49 { | 49 { |
50 WebInspector.StyleSheetOutlineDialog._instanceForTests = new WebInspector.St
yleSheetOutlineDialog(uiSourceCode, selectItemCallback); | 50 WebInspector.StyleSheetOutlineDialog._instanceForTests = new WebInspector.St
yleSheetOutlineDialog(uiSourceCode, selectItemCallback); |
51 new WebInspector.FilteredListWidget(WebInspector.StyleSheetOutlineDialog._in
stanceForTests).showAsDialog(); | 51 new WebInspector.FilteredListWidget(WebInspector.StyleSheetOutlineDialog._in
stanceForTests).showAsDialog(); |
52 } | 52 }; |
53 | 53 |
54 WebInspector.StyleSheetOutlineDialog.prototype = { | 54 WebInspector.StyleSheetOutlineDialog.prototype = { |
55 /** | 55 /** |
56 * @override | 56 * @override |
57 * @return {number} | 57 * @return {number} |
58 */ | 58 */ |
59 itemCount: function() | 59 itemCount: function() |
60 { | 60 { |
61 return this._cssParser.rules().length; | 61 return this._cssParser.rules().length; |
62 }, | 62 }, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 if (!isNaN(lineNumber) && lineNumber >= 0) | 111 if (!isNaN(lineNumber) && lineNumber >= 0) |
112 this._selectItemCallback(lineNumber, rule.columnNumber); | 112 this._selectItemCallback(lineNumber, rule.columnNumber); |
113 }, | 113 }, |
114 | 114 |
115 dispose: function() | 115 dispose: function() |
116 { | 116 { |
117 this._cssParser.dispose(); | 117 this._cssParser.dispose(); |
118 }, | 118 }, |
119 | 119 |
120 __proto__: WebInspector.FilteredListWidget.Delegate.prototype | 120 __proto__: WebInspector.FilteredListWidget.Delegate.prototype |
121 } | 121 }; |
OLD | NEW |