Changeset 48431 in webkit
- Timestamp:
- Sep 16, 2009 1:16:04 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r48430 r48431 1 2009-09-16 Patrick Mueller <Patrick_Mueller@us.ibm.com> 2 3 Reviewed by Timothy Hatcher. 4 5 Add Watch Expression support to inspector 6 https://bugs.webkit.org/show_bug.cgi?id=27514 7 8 Manual test added. 9 10 * English.lproj/localizedStrings.js: 11 * WebCore.gypi: 12 * WebCore.vcproj/WebCore.vcproj: 13 * inspector/front-end/ConsoleView.js: 14 (WebInspector.ConsoleView.prototype.completions): 15 (WebInspector.ConsoleView.prototype.evalInInspectedWindow): 16 (WebInspector.ConsoleView.prototype._enterKeyPressed): 17 * inspector/front-end/ObjectPropertiesSection.js: 18 (WebInspector.ObjectPropertiesSection.prototype.update.callback): 19 (WebInspector.ObjectPropertiesSection.prototype.update): 20 (WebInspector.ObjectPropertiesSection.prototype.updateProperties): 21 (WebInspector.ObjectPropertiesSection.CompareProperties): 22 (WebInspector.ObjectPropertyTreeElement.prototype.onpopulate.callback): 23 (WebInspector.ObjectPropertyTreeElement.prototype.onpopulate): 24 (WebInspector.ObjectPropertyTreeElement.prototype.update): 25 * inspector/front-end/ScriptsPanel.js: 26 (WebInspector.ScriptsPanel): 27 (WebInspector.ScriptsPanel.prototype.reset): 28 (WebInspector.ScriptsPanel.prototype._callFrameSelected): 29 * inspector/front-end/WatchExpressionsSidebarPane.js: Added. 30 (WebInspector.WatchExpressionsSidebarPane): 31 (WebInspector.WatchExpressionsSidebarPane.prototype.refreshExpressions): 32 (WebInspector.WatchExpressionsSection): 33 (WebInspector.WatchExpressionsSection.prototype.update): 34 (WebInspector.WatchExpressionsSection.prototype.addExpression): 35 (WebInspector.WatchExpressionsSection.prototype.updateExpression): 36 (WebInspector.WatchExpressionsSection.prototype.findAddedTreeElement): 37 (WebInspector.WatchExpressionsSection.prototype.loadSavedExpressions): 38 (WebInspector.WatchExpressionsSection.prototype.saveExpressions): 39 (WebInspector.WatchExpressionsSection.CompareProperties): 40 (WebInspector.WatchExpressionTreeElement): 41 (WebInspector.WatchExpressionTreeElement.prototype.update): 42 (WebInspector.WatchExpressionTreeElement.prototype._deleteButtonClicked): 43 (WebInspector.WatchExpressionTreeElement.prototype.startEditing): 44 (WebInspector.WatchExpressionTreeElement.prototype.editingCancelled): 45 (WebInspector.WatchExpressionTreeElement.prototype.applyExpression): 46 * inspector/front-end/WebKit.qrc: 47 * inspector/front-end/inspector.css: 48 * inspector/front-end/inspector.html: 49 * manual-tests/inspector/debugger-watch-expressions.html: Added. 50 1 51 2009-09-16 Greg Bolsinga <bolsinga@apple.com> 2 52 -
trunk/WebCore/WebCore.gypi
r48392 r48431 3519 3519 'inspector/front-end/utilities.js', 3520 3520 'inspector/front-end/View.js', 3521 'inspector/front-end/WatchExpressionsSidebarPane.js', 3521 3522 'inspector/front-end/inspector.css', 3522 3523 ], -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r48392 r48431 31627 31627 > 31628 31628 </File> 31629 <File 31630 RelativePath="..\inspector\front-end\WatchExpressionsSidebarPane.js" 31631 > 31632 </File> 31629 31633 </Filter> 31630 31634 </Filter> -
trunk/WebCore/inspector/front-end/ConsoleView.js
r48314 r48431 299 299 } 300 300 301 this. _evalInInspectedWindow(301 this.evalInInspectedWindow( 302 302 "(function() {" + 303 303 "var props = {};" + … … 395 395 }, 396 396 397 _evalInInspectedWindow: function(expression, callback)397 evalInInspectedWindow: function(expression, callback) 398 398 { 399 399 if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) { … … 443 443 self.addMessage(new WebInspector.ConsoleCommandResult(result, exception, commandMessage)); 444 444 } 445 this. _evalInInspectedWindow(str, printResult);445 this.evalInInspectedWindow(str, printResult); 446 446 }, 447 447 -
trunk/WebCore/inspector/front-end/ObjectPropertiesSection.js
r48046 r48431 49 49 if (!properties) 50 50 return; 51 self. _update(properties);51 self.updateProperties(properties); 52 52 }; 53 53 InjectedScriptAccess.getProperties(this.object, this.ignoreHasOwnProperty, callback); 54 54 }, 55 55 56 _update: function(properties) 57 { 56 updateProperties: function(properties, rootTreeElementConstructor, rootPropertyComparer) 57 { 58 if (!rootTreeElementConstructor) 59 rootTreeElementConstructor = this.treeElementConstructor; 60 61 if (!rootPropertyComparer) 62 rootPropertyComparer = WebInspector.ObjectPropertiesSection.CompareProperties; 63 58 64 if (this.extraProperties) 59 65 for (var i = 0; i < this.extraProperties.length; ++i) 60 66 properties.push(this.extraProperties[i]); 61 properties.sort(this._displaySort); 67 68 properties.sort(rootPropertyComparer); 62 69 63 70 this.propertiesTreeOutline.removeChildren(); 64 71 65 72 for (var i = 0; i < properties.length; ++i) 66 this.propertiesTreeOutline.appendChild(new this.treeElementConstructor(properties[i]));73 this.propertiesTreeOutline.appendChild(new rootTreeElementConstructor(properties[i])); 67 74 68 75 if (!this.propertiesTreeOutline.children.length) { … … 71 78 this.propertiesTreeOutline.appendChild(infoElement); 72 79 } 73 },74 75 _displaySort: function(propertyA, propertyB) {76 var a = propertyA.name;77 var b = propertyB.name;78 79 // if used elsewhere make sure to80 // - convert a and b to strings (not needed here, properties are all strings)81 // - check if a == b (not needed here, no two properties can be the same)82 83 var diff = 0;84 var chunk = /^\d+|^\D+/;85 var chunka, chunkb, anum, bnum;86 while (diff === 0) {87 if (!a && b)88 return -1;89 if (!b && a)90 return 1;91 chunka = a.match(chunk)[0];92 chunkb = b.match(chunk)[0];93 anum = !isNaN(chunka);94 bnum = !isNaN(chunkb);95 if (anum && !bnum)96 return -1;97 if (bnum && !anum)98 return 1;99 if (anum && bnum) {100 diff = chunka - chunkb;101 if (diff === 0 && chunka.length !== chunkb.length) {102 if (!+chunka && !+chunkb) // chunks are strings of all 0s (special case)103 return chunka.length - chunkb.length;104 else105 return chunkb.length - chunka.length;106 }107 } else if (chunka !== chunkb)108 return (chunka < chunkb) ? -1 : 1;109 a = a.substring(chunka.length);110 b = b.substring(chunkb.length);111 }112 return diff;113 80 } 114 81 } 115 82 116 83 WebInspector.ObjectPropertiesSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype; 84 85 WebInspector.ObjectPropertiesSection.CompareProperties = function(propertyA, propertyB) 86 { 87 var a = propertyA.name; 88 var b = propertyB.name; 89 90 // if used elsewhere make sure to 91 // - convert a and b to strings (not needed here, properties are all strings) 92 // - check if a == b (not needed here, no two properties can be the same) 93 94 var diff = 0; 95 var chunk = /^\d+|^\D+/; 96 var chunka, chunkb, anum, bnum; 97 while (diff === 0) { 98 if (!a && b) 99 return -1; 100 if (!b && a) 101 return 1; 102 chunka = a.match(chunk)[0]; 103 chunkb = b.match(chunk)[0]; 104 anum = !isNaN(chunka); 105 bnum = !isNaN(chunkb); 106 if (anum && !bnum) 107 return -1; 108 if (bnum && !anum) 109 return 1; 110 if (anum && bnum) { 111 diff = chunka - chunkb; 112 if (diff === 0 && chunka.length !== chunkb.length) { 113 if (!+chunka && !+chunkb) // chunks are strings of all 0s (special case) 114 return chunka.length - chunkb.length; 115 else 116 return chunkb.length - chunka.length; 117 } 118 } else if (chunka !== chunkb) 119 return (chunka < chunkb) ? -1 : 1; 120 a = a.substring(chunka.length); 121 b = b.substring(chunkb.length); 122 } 123 return diff; 124 } 117 125 118 126 WebInspector.ObjectPropertyTreeElement = function(property) … … 130 138 return; 131 139 132 var self = this;133 140 var callback = function(properties) { 134 self.removeChildren();141 this.removeChildren(); 135 142 if (!properties) 136 143 return; 137 144 138 properties.sort( self._displaySort);145 properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties); 139 146 for (var i = 0; i < properties.length; ++i) { 140 self.appendChild(new self.treeOutline.section.treeElementConstructor(properties[i]));147 this.appendChild(new this.treeOutline.section.treeElementConstructor(properties[i])); 141 148 } 142 149 }; 143 InjectedScriptAccess.getProperties(this.property.value, false, callback );150 InjectedScriptAccess.getProperties(this.property.value, false, callback.bind(this)); 144 151 }, 145 152 … … 156 163 update: function() 157 164 { 158 var nameElement = document.createElement("span"); 159 nameElement.className = "name"; 160 nameElement.textContent = this.property.name; 161 165 this.nameElement = document.createElement("span"); 166 this.nameElement.className = "name"; 167 this.nameElement.textContent = this.property.name; 168 169 var separatorElement = document.createElement("span"); 170 separatorElement.className = "separator"; 171 separatorElement.textContent = ": "; 172 162 173 this.valueElement = document.createElement("span"); 163 174 this.valueElement.className = "value"; … … 168 179 this.listItemElement.removeChildren(); 169 180 170 this.listItemElement.appendChild( nameElement);171 this.listItemElement.appendChild( document.createTextNode(": "));181 this.listItemElement.appendChild(this.nameElement); 182 this.listItemElement.appendChild(separatorElement); 172 183 this.listItemElement.appendChild(this.valueElement); 173 184 this.hasChildren = this.property.value.hasChildren; -
trunk/WebCore/inspector/front-end/ScriptsPanel.js
r48046 r48431 127 127 128 128 this.sidebarPanes = {}; 129 this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSidebarPane(); 129 130 this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane(); 130 131 this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane(); … … 472 473 473 474 this._sourceIDMap = {}; 475 476 this.sidebarPanes.watchExpressions.refreshExpressions(); 474 477 }, 475 478 … … 705 708 706 709 this.sidebarPanes.scopechain.update(currentFrame); 710 this.sidebarPanes.watchExpressions.refreshExpressions(); 707 711 708 712 var scriptOrResource = this._sourceIDMap[currentFrame.sourceID]; -
trunk/WebCore/inspector/front-end/WebKit.qrc
r48392 r48431 63 63 <file>utilities.js</file> 64 64 <file>View.js</file> 65 <file>WatchExpressionsSidebarPane.js</file> 65 66 <file>inspector.css</file> 66 67 <file>Images/back.png</file> -
trunk/WebCore/inspector/front-end/inspector.css
r48314 r48431 1207 1207 } 1208 1208 1209 .watch-expressions-buttons-container { 1210 text-align: center; 1211 } 1212 1209 1213 .section .header { 1210 1214 padding: 2px 8px 4px 18px; … … 1373 1377 } 1374 1378 1375 li.editing .swatch, li.editing .enabled-button {1379 li.editing .swatch, li.editing .enabled-button, li.editing-sub-part .delete-button { 1376 1380 display: none !important; 1381 } 1382 1383 .watch-expressions > li.editing-sub-part .name { 1384 display: block; 1385 width: 100%; 1386 } 1387 1388 .watch-expressions > li.editing-sub-part .value, .watch-expressions > li.editing-sub-part .separator { 1389 display: none; 1377 1390 } 1378 1391 … … 1408 1421 position: relative; 1409 1422 z-index: 1; 1423 } 1424 1425 /* FIXME: need a better icon (comment in bug 27514) */ 1426 .section .properties .delete-button { 1427 width: 10px; 1428 height: 10px; 1429 background-image: url(Images/errorIcon.png); 1430 background-position: 0 0; 1431 background-color: transparent; 1432 background-repeat: no-repeat; 1433 border: 0 none transparent; 1410 1434 } 1411 1435 -
trunk/WebCore/inspector/front-end/inspector.html
r48392 r48431 63 63 <script type="text/javascript" src="CallStackSidebarPane.js"></script> 64 64 <script type="text/javascript" src="ScopeChainSidebarPane.js"></script> 65 <script type="text/javascript" src="WatchExpressionsSidebarPane.js"></script> 65 66 <script type="text/javascript" src="MetricsSidebarPane.js"></script> 66 67 <script type="text/javascript" src="PropertiesSidebarPane.js"></script>
Note: See TracChangeset
for help on using the changeset viewer.