Changeset 182933 in webkit
- Timestamp:
- Apr 16, 2015, 6:00:21 PM (10 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r182909 r182933 1 2015-04-16 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Should include "Log Value" context menu item in Preview and Collapsed ObjectTree 4 https://bugs.webkit.org/show_bug.cgi?id=143845 5 6 Reviewed by Timothy Hatcher. 7 8 Give previews the same "Log Value" context menu so that if you just log 9 a bunch of objects to the console you can quickly turn that entire object 10 into a $n reference in the console to interact with. 11 12 * UserInterface/Views/ObjectPreviewView.js: 13 (WebInspector.ObjectPreviewView.prototype.setOriginatingObjectInfo): 14 (WebInspector.ObjectPreviewView.prototype._contextMenuHandler): 15 Provide API to refer to a RemoteObject and optional PropertyPath 16 that can be used to give the preview a "Log Value" context menu. 17 18 * UserInterface/Views/ConsoleMessageView.js: 19 (WebInspector.ConsoleMessageView.prototype._appendFormattedArguments): 20 Include the RemoteObject without a path for a preview context menu. 21 22 * UserInterface/Views/ObjectTreeView.js: 23 (WebInspector.ObjectTreeView): 24 Include the RemoteObject with a path if we knew it for a preview context menu. 25 26 * UserInterface/Views/ObjectTreeBaseTreeElement.js: 27 (WebInspector.ObjectTreeBaseTreeElement.prototype.createGetterElement): 28 The context menu can never be empty, since we always added at least one item above. 29 30 1 31 2015-04-16 Joseph Pecoraro <pecoraro@apple.com> 2 32 -
trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js
r182646 r182933 391 391 var preview = WebInspector.FormattedValue.createObjectPreviewOrFormattedValueForRemoteObject(parameter, WebInspector.ObjectPreviewView.Mode.Brief); 392 392 var isPreviewView = preview instanceof WebInspector.ObjectPreviewView; 393 394 if (isPreviewView) 395 preview.setOriginatingObjectInfo(parameter, null); 396 393 397 var previewElement = isPreviewView ? preview.element : preview; 394 398 previewContainer.appendChild(previewElement); -
trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js
r182055 r182933 91 91 } 92 92 93 setOriginatingObjectInfo(remoteObject, propertyPath) 94 { 95 console.assert(!this._remoteObject); 96 console.assert(remoteObject instanceof WebInspector.RemoteObject); 97 console.assert(!propertyPath || propertyPath instanceof WebInspector.PropertyPath); 98 99 this._remoteObject = remoteObject; 100 this._propertyPath = propertyPath || null; 101 102 this.element.addEventListener("contextmenu", this._contextMenuHandler.bind(this)); 103 } 104 93 105 // Private 94 106 … … 224 236 return true; 225 237 } 238 239 _contextMenuHandler(event) 240 { 241 var contextMenu = new WebInspector.ContextMenu(event); 242 243 contextMenu.appendItem(WebInspector.UIString("Log Value"), function() { 244 var remoteObject = this._remoteObject; 245 var isImpossible = !this._propertyPath || this._propertyPath.isFullPathImpossible(); 246 var text = isImpossible ? WebInspector.UIString("Selected Value") : this._propertyPath.displayPath(WebInspector.PropertyPath.Type.Value); 247 248 if (!isImpossible) 249 WebInspector.quickConsole.prompt.pushHistoryItem(text); 250 251 WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text, this._remoteObject); 252 }.bind(this)); 253 254 contextMenu.show(); 255 } 226 256 }; 227 257 -
trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js
r182909 r182933 205 205 this._appendMenusItemsForObject(contextMenu, resolvedValue); 206 206 207 if (!contextMenu.isEmpty()) 208 contextMenu.show(); 207 contextMenu.show(); 209 208 } 210 209 -
trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js
r182493 r182933 33 33 console.assert(!propertyPath || propertyPath instanceof WebInspector.PropertyPath); 34 34 35 var providedPropertyPath = propertyPath instanceof WebInspector.PropertyPath; 36 35 37 this._object = object; 36 38 this._mode = mode || WebInspector.ObjectTreeView.defaultModeForObject(object); … … 53 55 if (this._object.preview) { 54 56 this._previewView = new WebInspector.ObjectPreviewView(this._object.preview); 57 this._previewView.setOriginatingObjectInfo(this._object, providedPropertyPath ? propertyPath : null); 55 58 this._previewView.element.addEventListener("click", this._handlePreviewOrTitleElementClick.bind(this)); 56 59 this._element.appendChild(this._previewView.element);
Note:
See TracChangeset
for help on using the changeset viewer.