Changeset 84629 in webkit
- Timestamp:
- Apr 22, 2011 8:34:21 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r84626 r84629 1 2011-04-22 Pavel Feldman <pfeldman@google.com> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: add Save As context menu item to the TextViewer. 6 https://bugs.webkit.org/show_bug.cgi?id=59196 7 8 * inspector/front-end/ResourceView.js: 9 (WebInspector.ResourceSourceFrame.prototype.requestContent): 10 (WebInspector.ResourceSourceFrame.prototype.suggestedFileName): 11 (WebInspector.RevisionSourceFrame.prototype.requestContent): 12 (WebInspector.RevisionSourceFrame.prototype.suggestedFileName): 13 * inspector/front-end/ScriptsPanel.js: 14 (WebInspector.ScriptsPanel.prototype._createSourceFrame): 15 (WebInspector.SourceFrameDelegateForScriptsPanel): 16 (WebInspector.SourceFrameDelegateForScriptsPanel.prototype.formatSourceFilesToggled): 17 (WebInspector.SourceFrameDelegateForScriptsPanel.prototype.suggestedFileName): 18 * inspector/front-end/SourceFrame.js: 19 (WebInspector.SourceFrame.prototype._initializeTextViewer): 20 (WebInspector.SourceFrame.prototype.populateTextAreaContextMenu): 21 (WebInspector.SourceFrame.prototype.suggestedFileName): 22 (WebInspector.SourceFrameDelegate.prototype.formatSourceFilesToggled): 23 (WebInspector.SourceFrameDelegate.prototype.suggestedFileName): 24 * inspector/front-end/TextViewer.js: 25 (WebInspector.TextViewer.prototype._contextMenu): 26 (WebInspector.TextViewerDelegate.prototype.cancelEditing): 27 (WebInspector.TextViewerDelegate.prototype.populateLineGutterContextMenu): 28 (WebInspector.TextViewerDelegate.prototype.populateTextAreaContextMenu): 29 (WebInspector.TextViewerDelegate.prototype.suggestedFileName): 30 1 31 2011-04-22 Mikhail Naganov <mnaganov@chromium.org> 2 32 -
trunk/Source/WebCore/inspector/front-end/ResourceView.js
r83969 r84629 175 175 } 176 176 this._resource.requestContent(contentLoaded.bind(this)); 177 }, 178 179 suggestedFileName: function() 180 { 181 return this._resource.displayName; 177 182 } 178 183 } … … 205 210 } 206 211 this._revision.requestContent(contentLoaded.bind(this)); 212 }, 213 214 suggestedFileName: function() 215 { 216 return this._revision.resource.displayName; 207 217 } 208 218 } -
trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js
r84623 r84629 279 279 var select = this._filesSelectElement; 280 280 var option = document.createElement("option"); 281 option.text = sourceFile. url ? WebInspector.displayNameForURL(sourceFile.url) : WebInspector.UIString("(program)");281 option.text = sourceFile.displayName; 282 282 option.isContentScript = sourceFile.isContentScript; 283 283 if (sourceFile.isContentScript) … … 568 568 { 569 569 var sourceFile = this._presentationModel.sourceFile(sourceFileId); 570 var delegate = new WebInspector.SourceFrameDelegateForScriptsPanel(this._presentationModel, sourceFileId );570 var delegate = new WebInspector.SourceFrameDelegateForScriptsPanel(this._presentationModel, sourceFileId, sourceFile.displayName); 571 571 var sourceFrame = new WebInspector.SourceFrame(delegate, sourceFile.url); 572 572 sourceFrame._sourceFileId = sourceFileId; … … 1005 1005 1006 1006 1007 WebInspector.SourceFrameDelegateForScriptsPanel = function(model, sourceFileId )1007 WebInspector.SourceFrameDelegateForScriptsPanel = function(model, sourceFileId, scriptName) 1008 1008 { 1009 1009 WebInspector.SourceFrameDelegate.call(this); … … 1011 1011 this._sourceFileId = sourceFileId; 1012 1012 this._popoverObjectGroup = "popover"; 1013 this._scriptName = scriptName; 1013 1014 } 1014 1015 … … 1091 1092 { 1092 1093 return this._model.formatSourceFilesToggled(); 1094 }, 1095 1096 suggestedFileName: function() 1097 { 1098 return this._scriptName; 1093 1099 } 1094 1100 } -
trunk/Source/WebCore/inspector/front-end/SourceFile.js
r84625 r84629 64 64 }, 65 65 66 get displayName() 67 { 68 return this.url ? WebInspector.displayNameForURL(this.url) : WebInspector.UIString("(program)"); 69 }, 70 66 71 get content() 67 72 { -
trunk/Source/WebCore/inspector/front-end/SourceFrame.js
r84510 r84629 313 313 var element = this._textViewer.element; 314 314 if (this._delegate.debuggingSupported()) { 315 element.addEventListener("contextmenu", this._contextMenu.bind(this), true);316 315 element.addEventListener("mousedown", this._mouseDown.bind(this), true); 317 316 element.addEventListener("mousemove", this._mouseMove.bind(this), true); … … 606 605 }, 607 606 608 _contextMenu: function(event) 609 { 610 var contextMenu = new WebInspector.ContextMenu(); 611 var target = event.target.enclosingNodeOrSelfWithClass("webkit-line-number"); 612 if (target) 613 this._populateLineGutterContextMenu(target.lineNumber, contextMenu); 614 else 615 this._populateTextAreaContextMenu(contextMenu); 616 contextMenu.show(event); 617 }, 618 619 _populateLineGutterContextMenu: function(lineNumber, contextMenu) 607 populateLineGutterContextMenu: function(lineNumber, contextMenu) 620 608 { 621 609 contextMenu.appendItem(WebInspector.UIString("Continue to Here"), this._delegate.continueToLine.bind(this._delegate, lineNumber)); … … 662 650 }, 663 651 664 _populateTextAreaContextMenu: function(contextMenu) 665 { 666 contextMenu.appendCheckboxItem(WebInspector.UIString("Pretty print"), this._delegate.toggleFormatSourceFiles.bind(this._delegate), this._delegate.formatSourceFilesToggled()); 652 populateTextAreaContextMenu: function(contextMenu) 653 { 654 if (this._delegate.debuggingSupported()) 655 contextMenu.appendCheckboxItem(WebInspector.UIString("Pretty print"), this._delegate.toggleFormatSourceFiles.bind(this._delegate), this._delegate.formatSourceFilesToggled()); 656 }, 657 658 suggestedFileName: function() 659 { 660 return this._delegate.suggestedFileName(); 667 661 }, 668 662 … … 1027 1021 { 1028 1022 // Should be implemented by subclasses. 1023 }, 1024 1025 suggestedFileName: function() 1026 { 1027 // Should be implemented by subclasses. 1029 1028 } 1030 1029 } -
trunk/Source/WebCore/inspector/front-end/TextViewer.js
r84492 r84629 57 57 this.element.addEventListener("dblclick", this._doubleClick.bind(this), true); 58 58 this.element.addEventListener("keydown", this._handleKeyDown.bind(this), false); 59 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), true); 59 60 60 61 this._registerShortcuts(); … … 276 277 }, 277 278 279 _contextMenu: function(event) 280 { 281 var selection = this._mainPanel._getSelection(); 282 if (selection && !selection.isEmpty()) 283 return; // Show default context menu for selection. 284 285 var contextMenu = new WebInspector.ContextMenu(); 286 var target = event.target.enclosingNodeOrSelfWithClass("webkit-line-number"); 287 if (target) 288 this._delegate.populateLineGutterContextMenu(target.lineNumber, contextMenu); 289 else 290 this._delegate.populateTextAreaContextMenu(contextMenu); 291 292 var fileName = this._delegate.suggestedFileName(); 293 if (fileName) 294 contextMenu.appendItem(WebInspector.UIString("Save as..."), InspectorFrontendHost.saveAs.bind(InspectorFrontendHost, fileName, this._textModel.text)); 295 296 contextMenu.show(event); 297 }, 298 278 299 _commitEditing: function() 279 300 { … … 337 358 338 359 cancelEditing: function() 360 { 361 // Should be implemented by subclasses. 362 }, 363 364 populateLineGutterContextMenu: function(contextMenu) 365 { 366 // Should be implemented by subclasses. 367 }, 368 369 populateTextAreaContextMenu: function(contextMenu) 370 { 371 // Should be implemented by subclasses. 372 }, 373 374 suggestedFileName: function() 339 375 { 340 376 // Should be implemented by subclasses.
Note: See TracChangeset
for help on using the changeset viewer.