Changeset 109545 in webkit
- Timestamp:
- Mar 2, 2012 3:16:55 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r109543 r109545 1 2012-03-01 Alexander Pavlov <apavlov@chromium.org> 2 3 Web Inspector: Implement suggestions in Watch Expressions 4 https://bugs.webkit.org/show_bug.cgi?id=79912 5 6 Reviewed by Pavel Feldman. 7 8 * http/tests/inspector/console-cd-completions.html: 9 * inspector/debugger/debugger-completions-on-call-frame.html: 10 1 11 2012-03-02 Antti Koivisto <antti@apple.com> 2 12 -
trunk/LayoutTests/http/tests/inspector/console-cd-completions.html
r93769 r109545 23 23 24 24 25 WebInspector.consoleView. _completions("", "myGlob", false, checkCompletions.bind(this));25 WebInspector.consoleView.completionsForExpression("", "myGlob", false, checkCompletions.bind(this)); 26 26 function checkCompletions(completions) 27 27 { -
trunk/LayoutTests/inspector/debugger/debugger-completions-on-call-frame.html
r93769 r109545 24 24 function step2() 25 25 { 26 WebInspector.consoleView. _completions("", "var", false, checkAgainstGolden.bind(this, [ "var1", "var2" ], [], step3));26 WebInspector.consoleView.completionsForExpression("", "var", false, checkAgainstGolden.bind(this, [ "var1", "var2" ], [], step3)); 27 27 } 28 28 29 29 function step3() 30 30 { 31 WebInspector.consoleView. _completions("", "di", false, checkAgainstGolden.bind(this, [ "dir", "dirxml" ], [], step4));31 WebInspector.consoleView.completionsForExpression("", "di", false, checkAgainstGolden.bind(this, [ "dir", "dirxml" ], [], step4)); 32 32 } 33 33 34 34 function step4() 35 35 { 36 WebInspector.consoleView. _completions("", "win", false, checkAgainstGolden.bind(this, [ "window" ], [], step5));36 WebInspector.consoleView.completionsForExpression("", "win", false, checkAgainstGolden.bind(this, [ "window" ], [], step5)); 37 37 } 38 38 39 39 function step5() 40 40 { 41 WebInspector.consoleView. _completions("", "t", false, checkAgainstGolden.bind(this, [ "this" ], [], step6));41 WebInspector.consoleView.completionsForExpression("", "t", false, checkAgainstGolden.bind(this, [ "this" ], [], step6)); 42 42 } 43 43 44 44 function step6() 45 45 { 46 WebInspector.consoleView. _completions("var1", "toExp", false, checkAgainstGolden.bind(this, [ "toExponential" ], [], step7));46 WebInspector.consoleView.completionsForExpression("var1", "toExp", false, checkAgainstGolden.bind(this, [ "toExponential" ], [], step7)); 47 47 } 48 48 49 49 function step7() 50 50 { 51 WebInspector.consoleView. _completions("123", "toExp", false, checkAgainstGolden.bind(this, [], [ "toExponential" ], step8));51 WebInspector.consoleView.completionsForExpression("123", "toExp", false, checkAgainstGolden.bind(this, [], [ "toExponential" ], step8)); 52 52 } 53 53 -
trunk/Source/WebCore/ChangeLog
r109543 r109545 1 2012-03-01 Alexander Pavlov <apavlov@chromium.org> 2 3 Web Inspector: Implement suggestions in Watch Expressions 4 https://bugs.webkit.org/show_bug.cgi?id=79912 5 6 Drive-by: make subproperties in ObjectPropertySections editable 7 8 Reviewed by Pavel Feldman. 9 10 * inspector/front-end/ConsoleView.js: 11 (WebInspector.ConsoleView): 12 (WebInspector.ConsoleView.prototype.completionsForTextPrompt): 13 * inspector/front-end/DatabaseQueryView.js: 14 * inspector/front-end/ObjectPropertiesSection.js: 15 (WebInspector.ObjectPropertyTreeElement.prototype.onpopulate.callback): 16 (WebInspector.ObjectPropertyTreeElement.prototype.onpopulate): 17 (WebInspector.ObjectPropertyTreeElement.prototype.ondblclick): 18 (WebInspector.ObjectPropertyTreeElement.prototype.renderPromptAsBlock): 19 (WebInspector.ObjectPropertyTreeElement.prototype.elementAndValueToEdit): 20 (WebInspector.ObjectPropertyTreeElement.prototype.startEditing.blurListener): 21 (WebInspector.ObjectPropertyTreeElement.prototype.startEditing): 22 (WebInspector.ObjectPropertyTreeElement.prototype.editingEnded): 23 (WebInspector.ObjectPropertyTreeElement.prototype.editingCancelled): 24 (WebInspector.ObjectPropertyTreeElement.prototype.editingCommitted): 25 (WebInspector.ObjectPropertyTreeElement.prototype._promptKeyDown): 26 (WebInspector.ObjectPropertyPrompt): 27 * inspector/front-end/StylesSidebarPane.js: 28 * inspector/front-end/TextPrompt.js: 29 (WebInspector.TextPrompt.prototype.complete): 30 * inspector/front-end/WatchExpressionsSidebarPane.js: 31 (WebInspector.WatchExpressionTreeElement.prototype.renderPromptAsBlock): 32 (WebInspector.WatchExpressionTreeElement.prototype.elementAndValueToEdit): 33 (WebInspector.WatchExpressionTreeElement.prototype.editingCancelled): 34 * inspector/front-end/inspector.css: 35 (.watch-expressions > li.editing-sub-part .text-prompt): 36 1 37 2012-03-02 Antti Koivisto <antti@apple.com> 2 38 -
trunk/Source/WebCore/inspector/front-end/ConsoleView.js
r104822 r109545 112 112 this._linkifier = WebInspector.debuggerPresentationModel.createLinkifier(); 113 113 114 this.prompt = new WebInspector.TextPromptWithHistory(this.completions .bind(this), ExpressionStopCharacters + ".");114 this.prompt = new WebInspector.TextPromptWithHistory(this.completionsForTextPrompt.bind(this), ExpressionStopCharacters + "."); 115 115 this.prompt.setSuggestBoxEnabled("generic-suggest"); 116 116 this.prompt.renderAsBlock(); … … 343 343 }, 344 344 345 completions : function(wordRange, force, completionsReadyCallback)345 completionsForTextPrompt: function(textPrompt, wordRange, force, completionsReadyCallback) 346 346 { 347 347 // Pass less stop characters to rangeOfWord so the range will be a more complete expression. 348 var expressionRange = wordRange.startContainer.rangeOfWord(wordRange.startOffset, ExpressionStopCharacters, t his.promptElement, "backward");348 var expressionRange = wordRange.startContainer.rangeOfWord(wordRange.startOffset, ExpressionStopCharacters, textPrompt.proxyElement, "backward"); 349 349 var expressionString = expressionRange.toString(); 350 350 var prefix = wordRange.toString(); 351 this. _completions(expressionString, prefix, force, completionsReadyCallback);352 }, 353 354 _completions: function(expressionString, prefix, force, completionsReadyCallback)351 this.completionsForExpression(expressionString, prefix, force, completionsReadyCallback); 352 }, 353 354 completionsForExpression: function(expressionString, prefix, force, completionsReadyCallback) 355 355 { 356 356 var lastIndex = expressionString.length - 1; -
trunk/Source/WebCore/inspector/front-end/DatabaseQueryView.js
r102977 r109545 62 62 }, 63 63 64 completions: function( wordRange, force, completionsReadyCallback)64 completions: function(textPrompt, wordRange, force, completionsReadyCallback) 65 65 { 66 66 var prefix = wordRange.toString().toLowerCase(); -
trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js
r109536 r109545 193 193 if (this.treeOutline.section.skipProto && properties[i].name === "__proto__") 194 194 continue; 195 properties[i].parentObject = this.property.value; 195 196 this.appendChild(new this.treeOutline.section.treeElementConstructor(properties[i])); 196 197 } … … 202 203 { 203 204 if (this.property.writable) 204 this.startEditing( );205 this.startEditing(event); 205 206 }, 206 207 … … 305 306 }, 306 307 307 startEditing: function() 308 { 309 if (WebInspector.isBeingEdited(this.valueElement) || !this.treeOutline.section.editable || this._readOnly) 308 renderPromptAsBlock: function() 309 { 310 return false; 311 }, 312 313 /** 314 * @param {Event=} event 315 */ 316 elementAndValueToEdit: function(event) 317 { 318 return [this.valueElement, (typeof this.valueElement._originalTextContent === "string") ? this.valueElement._originalTextContent : undefined]; 319 }, 320 321 startEditing: function(event) 322 { 323 var elementAndValueToEdit = this.elementAndValueToEdit(event); 324 var elementToEdit = elementAndValueToEdit[0]; 325 var valueToEdit = elementAndValueToEdit[1]; 326 327 if (WebInspector.isBeingEdited(elementToEdit) || !this.treeOutline.section.editable || this._readOnly) 310 328 return; 311 329 312 var context = { expanded: this.expanded }; 330 // Edit original source. 331 if (typeof valueToEdit !== "undefined") 332 elementToEdit.textContent = valueToEdit; 333 334 var context = { expanded: this.expanded, elementToEdit: elementToEdit, previousContent: elementToEdit.textContent }; 313 335 314 336 // Lie about our children to prevent expanding on double click and to collapse subproperties. … … 317 339 this.listItemElement.addStyleClass("editing-sub-part"); 318 340 319 // Edit original source. 320 if (typeof this.valueElement._originalTextContent === "string") 321 this.valueElement.textContent = this.valueElement._originalTextContent; 322 323 var config = new WebInspector.EditingConfig(this.editingCommitted.bind(this), this.editingCancelled.bind(this), context); 324 WebInspector.startEditing(this.valueElement, config); 341 this._prompt = new WebInspector.ObjectPropertyPrompt(this.editingCommitted.bind(this, null, elementToEdit.textContent, context.previousContent, context), this.editingCancelled.bind(this, null, context), this.renderPromptAsBlock()); 342 343 function blurListener() 344 { 345 this.editingCommitted(null, elementToEdit.textContent, context.previousContent, context); 346 } 347 348 var proxyElement = this._prompt.attachAndStartEditing(elementToEdit, blurListener.bind(this)); 349 window.getSelection().setBaseAndExtent(elementToEdit, 0, elementToEdit, 1); 350 proxyElement.addEventListener("keydown", this._promptKeyDown.bind(this, context), false); 325 351 }, 326 352 327 353 editingEnded: function(context) 328 354 { 355 this._prompt.detach(); 356 delete this._prompt; 357 329 358 this.listItemElement.scrollLeft = 0; 330 359 this.listItemElement.removeStyleClass("editing-sub-part"); … … 335 364 editingCancelled: function(element, context) 336 365 { 366 this.editingEnded(context); 337 367 this.update(); 338 this.editingEnded(context);339 368 }, 340 369 … … 344 373 return this.editingCancelled(element, context); // nothing changed, so cancel 345 374 375 this.editingEnded(context); 346 376 this.applyExpression(userInput, true); 347 348 this.editingEnded(context); 377 }, 378 379 _promptKeyDown: function(context, event) 380 { 381 if (isEnterKey(event)) { 382 event.stopPropagation(); 383 event.preventDefault(); 384 return this.editingCommitted(null, context.elementToEdit.textContent, context.previousContent, context); 385 } 386 if (event.keyIdentifier === "U+001B") { // Esc 387 event.stopPropagation(); 388 return this.editingCancelled(null, context); 389 } 349 390 }, 350 391 … … 375 416 WebInspector.ObjectPropertyTreeElement.prototype.__proto__ = TreeElement.prototype; 376 417 418 /** 419 * @constructor 420 * @extends {TreeElement} 421 */ 377 422 WebInspector.ArrayGroupingTreeElement = function(treeElementConstructor, properties, fromIndex, toIndex) 378 423 { … … 452 497 453 498 WebInspector.ArrayGroupingTreeElement.prototype.__proto__ = TreeElement.prototype; 499 500 /** 501 * @constructor 502 * @extends {WebInspector.TextPrompt} 503 * @param {boolean=} renderAsBlock 504 */ 505 WebInspector.ObjectPropertyPrompt = function(commitHandler, cancelHandler, renderAsBlock) 506 { 507 const ExpressionStopCharacters = " =:[({;,!+-*/&|^<>."; // Same as in ConsoleView.js + "." 508 WebInspector.TextPrompt.call(this, WebInspector.consoleView.completionsForTextPrompt.bind(WebInspector.consoleView), ExpressionStopCharacters); 509 this.setSuggestBoxEnabled("generic-suggest"); 510 if (renderAsBlock) 511 this.renderAsBlock(); 512 } 513 514 WebInspector.ObjectPropertyPrompt.prototype.__proto__ = WebInspector.TextPrompt.prototype; -
trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js
r109372 r109545 2584 2584 }, 2585 2585 2586 _buildPropertyCompletions: function( wordRange, force, completionsReadyCallback)2586 _buildPropertyCompletions: function(textPrompt, wordRange, force, completionsReadyCallback) 2587 2587 { 2588 2588 var prefix = wordRange.toString().toLowerCase(); -
trunk/Source/WebCore/inspector/front-end/TextPrompt.js
r108356 r109545 31 31 * @constructor 32 32 * @extends WebInspector.Object 33 * @param {function( Range, boolean, function(Array.<string>=))} completions33 * @param {function(WebInspector.TextPrompt, Range, boolean, function(Array.<string>=))} completions 34 34 * @param {string} stopCharacters 35 35 */ … … 384 384 385 385 var wordPrefixRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, this._completionStopCharacters, this._element, "backward"); 386 this._loadCompletions( wordPrefixRange, force, this._completionsReady.bind(this, selection, auto, wordPrefixRange, !!reverse));386 this._loadCompletions(this, wordPrefixRange, force, this._completionsReady.bind(this, selection, auto, wordPrefixRange, !!reverse)); 387 387 }, 388 388 … … 749 749 * @constructor 750 750 * @extends {WebInspector.TextPrompt} 751 * @param {function( Range, boolean, function(Array.<string>=))} completions751 * @param {function(WebInspector.TextPrompt, Range, boolean, function(Array.<string>=))} completions 752 752 * @param {string} stopCharacters 753 753 */ -
trunk/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js
r107821 r109545 345 345 }, 346 346 347 startEditing: function() 348 { 349 if (WebInspector.isBeingEdited(this.nameElement) || !this.treeOutline.section.editable) 350 return; 351 352 this.nameElement.textContent = this.property.name.trim(); 353 354 var context = { expanded: this.expanded }; 355 356 // collapse temporarily, if required 357 this.hasChildren = false; 358 359 this.listItemElement.addStyleClass("editing-sub-part"); 360 361 WebInspector.startEditing(this.nameElement, new WebInspector.EditingConfig(this.editingCommitted.bind(this), this.editingCancelled.bind(this), context)); 347 renderPromptAsBlock: function() 348 { 349 return true; 350 }, 351 352 /** 353 * @param {Event=} event 354 */ 355 elementAndValueToEdit: function(event) 356 { 357 return [this.nameElement, this.property.name.trim()]; 362 358 }, 363 359 364 360 editingCancelled: function(element, context) 365 361 { 366 if (! this.nameElement.textContent)362 if (!context.elementToEdit.textContent) 367 363 this.treeOutline.section.updateExpression(this, null); 368 364 369 this.update(); 370 this.editingEnded(context); 365 WebInspector.ObjectPropertyTreeElement.prototype.editingCancelled.call(this, element, context); 371 366 }, 372 367 -
trunk/Source/WebCore/inspector/front-end/inspector.css
r109372 r109545 1380 1380 } 1381 1381 1382 .watch-expressions > li.editing-sub-part . name{1382 .watch-expressions > li.editing-sub-part .text-prompt { 1383 1383 display: block; 1384 1384 width: 100%;
Note: See TracChangeset
for help on using the changeset viewer.