Changeset 117462 in webkit
- Timestamp:
- May 17, 2012 10:52:33 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r117460 r117462 1 2012-05-17 Pavel Feldman <pfeldman@chromium.org> 2 3 Web Inspector: implement Go To selector for stylesheet files. 4 https://bugs.webkit.org/show_bug.cgi?id=86751 5 6 Reviewed by Yury Semikhatsky. 7 8 StyleSheetOutlineDialog is introduced. 9 10 * English.lproj/localizedStrings.js: 11 * inspector/front-end/FilteredItemSelectionDialog.js: 12 * inspector/front-end/ScriptsPanel.js: 13 (WebInspector.ScriptsPanel.prototype._createDebugToolbar): 14 (WebInspector.ScriptsPanel.prototype._createButtonAndRegisterShortcuts): 15 (WebInspector.ScriptsPanel.prototype._showOutlineDialog): 16 * inspector/front-end/StylesPanel.js: 17 (WebInspector.StyleSheetOutlineDialog): 18 (WebInspector.StyleSheetOutlineDialog.show): 19 (WebInspector.StyleSheetOutlineDialog.prototype.itemTitleAt): 20 (WebInspector.StyleSheetOutlineDialog.prototype.itemKeyAt): 21 (WebInspector.StyleSheetOutlineDialog.prototype.itemsCount): 22 (WebInspector.StyleSheetOutlineDialog.prototype.requestItems): 23 (WebInspector.StyleSheetOutlineDialog.prototype.requestItems.didGetStyleSheet): 24 (WebInspector.StyleSheetOutlineDialog.prototype.selectItem): 25 * inspector/front-end/TabbedEditorContainer.js: 26 (WebInspector.TabbedEditorContainer.prototype._generateTabId): 27 (WebInspector.TabbedEditorContainer.prototype.currentFile): 28 1 29 2012-05-17 Dan Bernstein <mitz@apple.com> 2 30 -
trunk/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js
r117277 r117462 490 490 } 491 491 492 WebInspector.JavaScriptOutlineDialog.createShortcut = function()493 {494 return WebInspector.KeyboardShortcut.makeDescriptor("o", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta | WebInspector.KeyboardShortcut.Modifiers.Shift);495 }496 497 492 WebInspector.JavaScriptOutlineDialog.prototype = { 498 493 /** -
trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js
r117455 r117462 55 55 WebInspector.GoToLineDialog.install(this, viewGetter.bind(this)); 56 56 57 this.debugToolbar = this._createDebugToolbar(); 57 var helpSection = WebInspector.shortcutsScreen.section(WebInspector.UIString(WebInspector.experimentsSettings.sourceCodePanel.isEnabled() ? "Source Code Panel" : "Scripts Panel")); 58 this.debugToolbar = this._createDebugToolbar(helpSection); 58 59 59 60 const initialDebugSidebarWidth = 225; … … 127 128 this.sidebarPanes.jsBreakpoints.expanded = true; 128 129 129 var helpSection = WebInspector.shortcutsScreen.section(WebInspector.UIString("Scripts Panel"));130 130 this.sidebarPanes.callstack.registerShortcuts(helpSection, this.registerShortcut.bind(this)); 131 131 var evaluateInConsoleShortcut = WebInspector.KeyboardShortcut.makeDescriptor("e", WebInspector.KeyboardShortcut.Modifiers.Shift | WebInspector.KeyboardShortcut.Modifiers.Ctrl); … … 134 134 135 135 var openResourceShortcut = WebInspector.OpenResourceDialog.createShortcut(); 136 helpSection.addKey(openResourceShortcut.name, WebInspector.UIString("Open script"));137 138 var scriptOutlineShortcut = WebInspector.JavaScriptOutlineDialog.createShortcut();139 helpSection.addKey( scriptOutlineShortcut.name, WebInspector.UIString("Go to function"));140 this.registerShortcut( scriptOutlineShortcut.key, this._showJavaScriptOutlineDialog.bind(this));136 helpSection.addKey(openResourceShortcut.name, WebInspector.UIString("Open file")); 137 138 var outlineShortcut = WebInspector.KeyboardShortcut.makeDescriptor("o", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta | WebInspector.KeyboardShortcut.Modifiers.Shift); 139 helpSection.addKey(outlineShortcut.name, WebInspector.UIString("Go to member")); 140 this.registerShortcut(outlineShortcut.key, this._showOutlineDialog.bind(this)); 141 141 142 142 var panelEnablerHeading = WebInspector.UIString("You need to enable debugging before you can use the Scripts panel."); … … 785 785 }, 786 786 787 _createDebugToolbar: function( )787 _createDebugToolbar: function(section) 788 788 { 789 789 var debugToolbar = document.createElement("div"); … … 800 800 shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F8)); 801 801 shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Slash, platformSpecificModifier)); 802 this.pauseButton = this._createButtonAndRegisterShortcuts( "scripts-pause", title, handler, shortcuts, WebInspector.UIString("Pause/Continue"));802 this.pauseButton = this._createButtonAndRegisterShortcuts(section, "scripts-pause", title, handler, shortcuts, WebInspector.UIString("Pause/Continue")); 803 803 debugToolbar.appendChild(this.pauseButton); 804 804 … … 809 809 shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F10)); 810 810 shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.SingleQuote, platformSpecificModifier)); 811 this.stepOverButton = this._createButtonAndRegisterShortcuts( "scripts-step-over", title, handler, shortcuts, WebInspector.UIString("Step over"));811 this.stepOverButton = this._createButtonAndRegisterShortcuts(section, "scripts-step-over", title, handler, shortcuts, WebInspector.UIString("Step over")); 812 812 debugToolbar.appendChild(this.stepOverButton); 813 813 … … 818 818 shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11)); 819 819 shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, platformSpecificModifier)); 820 this.stepIntoButton = this._createButtonAndRegisterShortcuts( "scripts-step-into", title, handler, shortcuts, WebInspector.UIString("Step into"));820 this.stepIntoButton = this._createButtonAndRegisterShortcuts(section, "scripts-step-into", title, handler, shortcuts, WebInspector.UIString("Step into")); 821 821 debugToolbar.appendChild(this.stepIntoButton); 822 822 … … 827 827 shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11, WebInspector.KeyboardShortcut.Modifiers.Shift)); 828 828 shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, WebInspector.KeyboardShortcut.Modifiers.Shift | platformSpecificModifier)); 829 this.stepOutButton = this._createButtonAndRegisterShortcuts( "scripts-step-out", title, handler, shortcuts, WebInspector.UIString("Step out"));829 this.stepOutButton = this._createButtonAndRegisterShortcuts(section, "scripts-step-out", title, handler, shortcuts, WebInspector.UIString("Step out")); 830 830 debugToolbar.appendChild(this.stepOutButton); 831 831 … … 842 842 }, 843 843 844 _createButtonAndRegisterShortcuts: function( buttonId, buttonTitle, handler, shortcuts, shortcutDescription)844 _createButtonAndRegisterShortcuts: function(section, buttonId, buttonTitle, handler, shortcuts, shortcutDescription) 845 845 { 846 846 var button = document.createElement("button"); … … 857 857 shortcutNames.push(shortcuts[i].name); 858 858 } 859 var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Scripts Panel"));860 859 section.addAlternateKeys(shortcutNames, shortcutDescription); 861 860 … … 947 946 }, 948 947 949 _showJavaScriptOutlineDialog: function() 950 { 951 WebInspector.JavaScriptOutlineDialog.show(this.visibleView, this.visibleView); 948 _showOutlineDialog: function() 949 { 950 var uiSourceCode = this._editorContainer.currentFile(); 951 if (!uiSourceCode) 952 return; 953 954 if (uiSourceCode instanceof WebInspector.JavaScriptSource) 955 WebInspector.JavaScriptOutlineDialog.show(this.visibleView, uiSourceCode); 956 else if (uiSourceCode instanceof WebInspector.StyleSource) 957 WebInspector.StyleSheetOutlineDialog.show(this.visibleView, /** @type {WebInspector.StyleSource} */ uiSourceCode); 952 958 }, 953 959 -
trunk/Source/WebCore/inspector/front-end/StylesPanel.js
r117455 r117462 162 162 163 163 WebInspector.StyleSourceFrame.prototype.__proto__ = WebInspector.SourceFrame.prototype; 164 165 /** 166 * @constructor 167 * @implements {WebInspector.SelectionDialogContentProvider} 168 * @param {WebInspector.View} view 169 * @param {WebInspector.StyleSource} styleSource 170 */ 171 WebInspector.StyleSheetOutlineDialog = function(view, styleSource) 172 { 173 WebInspector.SelectionDialogContentProvider.call(this); 174 175 this._rules = []; 176 this._view = view; 177 this._styleSource = styleSource; 178 } 179 180 /** 181 * @param {WebInspector.View} view 182 * @param {WebInspector.StyleSource} styleSource 183 */ 184 WebInspector.StyleSheetOutlineDialog.show = function(view, styleSource) 185 { 186 if (WebInspector.Dialog.currentInstance()) 187 return null; 188 var delegate = new WebInspector.StyleSheetOutlineDialog(view, styleSource); 189 var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDialog(delegate); 190 WebInspector.Dialog.show(view.element, filteredItemSelectionDialog); 191 } 192 193 WebInspector.StyleSheetOutlineDialog.prototype = { 194 /** 195 * @param {number} itemIndex 196 * @return {string} 197 */ 198 itemTitleAt: function(itemIndex) 199 { 200 return this._rules[itemIndex].selectorText; 201 }, 202 203 /** 204 * @param {number} itemIndex 205 * @return {string} 206 */ 207 itemKeyAt: function(itemIndex) 208 { 209 return this._rules[itemIndex].selectorText; 210 }, 211 212 /** 213 * @return {number} 214 */ 215 itemsCount: function() 216 { 217 return this._rules.length; 218 }, 219 220 /** 221 * @param {function(number, number, number, number)} callback 222 */ 223 requestItems: function(callback) 224 { 225 function didGetAllStyleSheets(error, infos) 226 { 227 if (error) { 228 callback(0, 0, 0, 0); 229 return; 230 } 231 232 for (var i = 0; i < infos.length; ++i) { 233 var info = infos[i]; 234 if (info.sourceURL === this._styleSource.contentURL()) { 235 WebInspector.CSSStyleSheet.createForId(info.styleSheetId, didGetStyleSheet.bind(this)); 236 return; 237 } 238 } 239 callback(0, 0, 0, 0); 240 } 241 242 CSSAgent.getAllStyleSheets(didGetAllStyleSheets.bind(this)); 243 244 /** 245 * @param {?WebInspector.CSSStyleSheet} styleSheet 246 */ 247 function didGetStyleSheet(styleSheet) 248 { 249 if (!styleSheet) { 250 callback(0, 0, 0, 0); 251 return; 252 } 253 254 this._rules = styleSheet.rules; 255 callback(0, this._rules.length, 0, 1); 256 } 257 }, 258 259 /** 260 * @param {number} itemIndex 261 */ 262 selectItem: function(itemIndex) 263 { 264 var lineNumber = this._rules[itemIndex].sourceLine; 265 if (!isNaN(lineNumber) && lineNumber >= 0) 266 this._view.highlightLine(lineNumber); 267 this._view.focus(); 268 } 269 } 270 271 WebInspector.StyleSheetOutlineDialog.prototype.__proto__ = WebInspector.SelectionDialogContentProvider.prototype; -
trunk/Source/WebCore/inspector/front-end/TabbedEditorContainer.js
r117274 r117462 347 347 { 348 348 return "tab_" + (WebInspector.TabbedEditorContainer._tabId++); 349 }, 350 351 /** 352 * @return {WebInspector.UISourceCode} uiSourceCode 353 */ 354 currentFile: function() 355 { 356 return this._currentFile; 349 357 } 350 358 }
Note: See TracChangeset
for help on using the changeset viewer.