Changeset 39537 in webkit
- Timestamp:
- Jan 1, 2009 5:08:20 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r39536 r39537 1 2008-12-29 Konstantin Käfer <kkaefer@gmail.com> 2 3 Reviewed by Tim Hatcher. 4 5 Fix for https://bugs.webkit.org/show_bug.cgi?id=17229 6 <rdar://problem/5732829> Inspector should show properties of all JS objects in Console 7 8 Prints objects not as plain text but makes them expandable so that 9 they can be inspected. 10 11 * inspector/front-end/Console.js: 12 (): added a parameter "inline" to the WebInspector.Console._format function which indicates 13 whether the object is printed in the context of another string (with console.log()) or 14 as sole element. 15 (.): objects and DOM nodes are now printed in an expandable form when they are printed alone 16 (i.e. not in the context of a console.log() string) so that they can be inspected. 17 * inspector/front-end/PropertiesSection.js: 18 (WebInspector.PropertiesSection.prototype.set title): Allow DOM Nodes as title instead of strings 19 in that case, the Node is inserted into the title instead of the string value of the passed 20 object. This is used for displaying linkified titles, for example when inspecting DOM nodes, 21 the syntax highlighted HTML representation is shown instead of the plain source code. 22 * inspector/front-end/inspector.css: correct the offsetParent for the expandable object inspector. 23 1 24 2009-01-01 Darin Adler <darin@apple.com> 2 25 -
trunk/WebCore/inspector/front-end/Console.js
r39367 r39537 478 478 }, 479 479 480 _format: function(output )480 _format: function(output, inline) 481 481 { 482 482 var type = Object.type(output, InspectorController.inspectedWindow()); … … 510 510 var span = document.createElement("span"); 511 511 span.addStyleClass("console-formatted-" + type); 512 this[formatter](output, span );512 this[formatter](output, span, inline); 513 513 return span; 514 514 }, 515 515 516 _formatvalue: function(val, elem )516 _formatvalue: function(val, elem, inline) 517 517 { 518 518 elem.appendChild(document.createTextNode(val)); 519 519 }, 520 520 521 _formatstring: function(str, elem )521 _formatstring: function(str, elem, inline) 522 522 { 523 523 elem.appendChild(document.createTextNode("\"" + str + "\"")); 524 524 }, 525 525 526 _formatregexp: function(re, elem )526 _formatregexp: function(re, elem, inline) 527 527 { 528 528 var formatted = String(re).replace(/([\\\/])/g, "\\$1").replace(/\\(\/[gim]*)$/, "$1").substring(1); … … 530 530 }, 531 531 532 _formatarray: function(arr, elem )532 _formatarray: function(arr, elem, inline) 533 533 { 534 534 elem.appendChild(document.createTextNode("[")); 535 535 for (var i = 0; i < arr.length; ++i) { 536 elem.appendChild(this._format(arr[i] ));536 elem.appendChild(this._format(arr[i], true)); 537 537 if (i < arr.length - 1) 538 538 elem.appendChild(document.createTextNode(", ")); … … 541 541 }, 542 542 543 _formatnode: function(node, elem )543 _formatnode: function(node, elem, inline) 544 544 { 545 545 var anchor = document.createElement("a"); … … 549 549 anchor.addEventListener("mouseover", this._mouseOverNode.bind(this), false); 550 550 anchor.addEventListener("mouseout", this._mouseOutOfNode.bind(this), false); 551 elem.appendChild(anchor); 552 }, 553 554 _formatobject: function(obj, elem) 555 { 556 elem.appendChild(document.createTextNode(Object.describe(obj))); 557 }, 558 559 _formaterror: function(obj, elem) 551 552 if (inline) 553 elem.appendChild(anchor); 554 else 555 elem.appendChild(new WebInspector.ObjectPropertiesSection(node, anchor, null, null, true).element); 556 }, 557 558 _formatobject: function(obj, elem, inline) 559 { 560 if (inline) 561 elem.appendChild(document.createTextNode(Object.describe(obj))); 562 else 563 elem.appendChild(new WebInspector.ObjectPropertiesSection(obj, null, null, null, true).element); 564 }, 565 566 _formaterror: function(obj, elem, inline) 560 567 { 561 568 elem.appendChild(document.createTextNode(obj.name + ": " + obj.message + " ")); … … 637 644 function formatForConsole(obj) 638 645 { 639 return WebInspector.console._format(obj );646 return WebInspector.console._format(obj, true); 640 647 } 641 648 … … 669 676 if (typeof parameters[i] === "string") 670 677 formattedResult.appendChild(WebInspector.linkifyStringAsFragment(parameters[i])); 678 else if (parameters.length === 1) 679 formattedResult.appendChild(WebInspector.console._format(parameters[0])); 671 680 else 672 681 formattedResult.appendChild(formatForConsole(parameters[i])); -
trunk/WebCore/inspector/front-end/PropertiesSection.js
r37523 r39537 70 70 return; 71 71 this._title = x; 72 this.titleElement.textContent = x; 72 73 if (x instanceof Node) { 74 this.titleElement.removeChildren(); 75 this.titleElement.appendChild(x); 76 } else 77 this.titleElement.textContent = x; 73 78 }, 74 79 -
trunk/WebCore/inspector/front-end/inspector.css
r38236 r39537 619 619 } 620 620 621 .console-formatted-object .section, .console-formatted-node .section { 622 position: static; 623 } 624 621 625 .auto-complete-text { 622 626 color: rgb(128, 128, 128);
Note: See TracChangeset
for help on using the changeset viewer.