Changeset 112416 in webkit
- Timestamp:
- Mar 28, 2012 11:23:00 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r112414 r112416 1 2012-03-28 Vsevolod Vlasov <vsevik@chromium.org> 2 3 Web Inspector: Implement snippets renaming in scripts navigator. 4 https://bugs.webkit.org/show_bug.cgi?id=82477 5 6 Reviewed by Pavel Feldman. 7 8 Snippets renaming is implemented as editing of snippet name in scripts navigator. 9 10 * inspector/front-end/ScriptsNavigator.js: 11 (WebInspector.ScriptsNavigator.prototype._handleRenameSnippet): 12 (WebInspector.ScriptsNavigator.prototype._fileRenamed): 13 (WebInspector.ScriptsNavigator.prototype.rename.commitHandler): 14 (WebInspector.ScriptsNavigator.prototype.rename.cancelHandler): 15 (WebInspector.ScriptsNavigator.prototype.rename.afterEditing): 16 (WebInspector.BaseNavigatorTreeElement.prototype.set titleText): 17 * inspector/front-end/scriptsPanel.css: 18 (#scripts-navigator-tabbed-pane .navigator .base-navigator-tree-element-title.editing): 19 1 20 2012-03-28 Vsevolod Vlasov <vsevik@chromium.org> 2 21 -
trunk/Source/WebCore/inspector/front-end/ScriptsNavigator.js
r112414 r112416 136 136 return; 137 137 138 var scriptTitle = uiSourceCode.fileName || WebInspector.UIString("(program)"); 139 var scriptTreeElement = new WebInspector.NavigatorScriptTreeElement(this, uiSourceCode, scriptTitle); 138 var scriptTreeElement = new WebInspector.NavigatorScriptTreeElement(this, uiSourceCode, ""); 140 139 this._scriptTreeElementsByUISourceCode.put(uiSourceCode, scriptTreeElement); 140 this._updateScriptTitle(uiSourceCode); 141 141 142 142 var folderTreeElement = this._getOrCreateFolderTreeElement(uiSourceCode); 143 143 folderTreeElement.appendChild(scriptTreeElement); 144 }, 145 146 /** 147 * @param {WebInspector.UISourceCode} uiSourceCode 148 */ 149 _updateScriptTitle: function(uiSourceCode) 150 { 151 var scriptTreeElement = this._scriptTreeElementsByUISourceCode.get(uiSourceCode); 152 if (!scriptTreeElement) 153 return; 154 var scriptTitle = uiSourceCode.fileName || WebInspector.UIString("(program)"); 155 scriptTreeElement.titleText = scriptTitle; 144 156 }, 145 157 … … 318 330 _handleRenameSnippet: function(uiSourceCode, event) 319 331 { 332 this.rename(uiSourceCode); 333 }, 334 335 /** 336 * @param {WebInspector.UISourceCode} uiSourceCode 337 * @param {Event} event 338 */ 339 _handleRemoveSnippet: function(uiSourceCode, event) 340 { 320 341 // FIXME: To be implemented. 321 342 }, 322 343 323 344 /** 324 * @param {WebInspector.UISourceCode} uiSourceCode325 345 * @param {Event} event 326 346 */ 327 _handle RemoveSnippet: function(uiSourceCode,event)347 _handleCreateSnippet: function(event) 328 348 { 329 349 // FIXME: To be implemented. 330 350 }, 331 351 332 /** 333 * @param {Event} event 334 */ 335 _handleCreateSnippet: function(event) 352 _fileRenamed: function(uiSourceCode, newTitle) 336 353 { 337 354 // FIXME: To be implemented. 355 }, 356 357 /** 358 * @param {WebInspector.UISourceCode} uiSourceCode 359 */ 360 rename: function(uiSourceCode, callback) 361 { 362 var scriptTreeElement = this._scriptTreeElementsByUISourceCode.get(uiSourceCode); 363 if (!scriptTreeElement) 364 return; 365 366 // Tree outline should be marked as edited as well as the tree element to prevent search from starting. 367 WebInspector.markBeingEdited(scriptTreeElement.treeOutline.element, true); 368 369 function commitHandler(element, newTitle, oldTitle) 370 { 371 if (newTitle && newTitle !== oldTitle) 372 this._fileRenamed(uiSourceCode, newTitle); 373 else 374 this._updateScriptTitle(uiSourceCode); 375 afterEditing(); 376 } 377 378 function cancelHandler() 379 { 380 afterEditing(); 381 } 382 383 function afterEditing() 384 { 385 WebInspector.markBeingEdited(scriptTreeElement.treeOutline.element, false); 386 callback(); 387 } 388 389 var editingConfig = new WebInspector.EditingConfig(commitHandler.bind(this), cancelHandler.bind(this)); 390 WebInspector.startEditing(scriptTreeElement.titleElement, editingConfig); 391 window.getSelection().setBaseAndExtent(scriptTreeElement.titleElement, 0, scriptTreeElement.titleElement, 1); 338 392 }, 339 393 … … 565 619 { 566 620 this._titleText = titleText || ""; 567 this._titleTextNode.textContent = this._titleText; 621 if (this.titleElement) 622 this.titleElement.textContent = this._titleText; 568 623 }, 569 624 -
trunk/Source/WebCore/inspector/front-end/scriptsPanel.css
r112413 r112416 363 363 } 364 364 365 #scripts-navigator-tabbed-pane .navigator .base-navigator-tree-element-title.editing { 366 margin: auto; 367 } 368 365 369 .function-location-link { 366 370 float: right;
Note: See TracChangeset
for help on using the changeset viewer.