Changeset 46519 in webkit
- Timestamp:
- Jul 28, 2009, 9:54:00 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r46518 r46519 1 2009-07-28 Joseph Pecoraro <joepeck02@gmail.com> 2 3 Inspector: Create New DOM Storage Items via DataGrid 4 5 https://bugs.webkit.org/show_bug.cgi?id=27322 6 7 Reviewed by Timothy Hatcher. 8 9 * inspector/front-end/DOMStorageDataGrid.js: 10 (WebInspector.DOMStorageDataGrid.prototype._startEditing): click anyway means creationNode 11 (WebInspector.DOMStorageDataGrid.prototype._editingCommitted): fix unintended globals 12 (WebInspector.DOMStorageDataGrid.prototype.deleteSelectedRow): creationNode is special case 13 * inspector/front-end/DataGrid.js: 14 (WebInspector.DataGrid.prototype.addCreationNode): maintain a quick ref to the single creationNode 15 (WebInspector.CreationDataGridNode): new type of node 16 (WebInspector.CreationDataGridNode.prototype.makeNormal): convert to a normal node 17 * inspector/front-end/DatabasesPanel.js: 18 (WebInspector.DatabasesPanel.prototype.dataGridForDOMStorage): add a creationNode to the GridData 19 1 20 2009-07-28 Joseph Pecoraro <joepeck02@gmail.com> 2 21 -
trunk/WebCore/inspector/front-end/DOMStorageDataGrid.js
r41290 r46519 39 39 this._startEditing(event); 40 40 }, 41 41 42 42 _startEditing: function(event) 43 43 { … … 45 45 if (!element) 46 46 return; 47 47 48 this._editingNode = this.dataGridNodeFromEvent(event); 48 if (!this._editingNode) 49 return; 49 if (!this._editingNode) { 50 if (!this.creationNode) 51 return; 52 this._editingNode = this.creationNode; 53 } 50 54 this._editing = true; 51 55 56 if (this._editingNode.isCreationNode) { 57 this._editingNode.select(); 58 element = this._editingNode._element.children[0]; // Create a new node by providing a Key First 59 } 60 52 61 WebInspector.startEditing(element, this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent); 53 62 window.getSelection().setBaseAndExtent(element, 0, element, 1); 54 63 }, 55 64 56 65 _editingCommitted: function(element, newText) 57 66 { 58 if (element.hasStyleClass("0-column")) 59 columnIdentifier = 0; 60 else 61 columnIdentifier = 1; 62 textBeforeEditing = this._editingNode.data[columnIdentifier]; 67 var columnIdentifier = (element.hasStyleClass("0-column") ? 0 : 1); 68 var textBeforeEditing = this._editingNode.data[columnIdentifier]; 63 69 if (textBeforeEditing == newText) { 64 70 this._editingCancelled(element); 65 71 return; 66 72 } 67 73 68 74 var domStorage = WebInspector.panels.databases.visibleView.domStorage.domStorage; 69 75 if (domStorage) { … … 82 88 } 83 89 } 84 90 91 if (this._editingNode.isCreationNode) 92 this.addCreationNode(false); 93 85 94 this._editingCancelled(element); 86 95 }, 87 96 88 97 _editingCancelled: function(element, context) 89 98 { … … 91 100 this._editingNode = null; 92 101 }, 93 102 94 103 deleteSelectedRow: function() 95 104 { 96 105 var node = this.selectedNode; 106 if (this.selectedNode.isCreationNode) 107 return; 108 97 109 var domStorage = WebInspector.panels.databases.visibleView.domStorage.domStorage; 98 110 if (node && domStorage) -
trunk/WebCore/inspector/front-end/DataGrid.js
r42808 r46519 160 160 161 161 return this._dataTableBody; 162 }, 163 164 addCreationNode: function(hasChildren) 165 { 166 if (this.creationNode) 167 this.creationNode.makeNormal(); 168 169 var emptyData = {}; 170 for (var column in this.columns) 171 emptyData[column] = ''; 172 this.creationNode = new WebInspector.CreationDataGridNode(emptyData, hasChildren); 173 this.appendChild(this.creationNode); 162 174 }, 163 175 … … 884 896 885 897 WebInspector.DataGridNode.prototype.__proto__ = WebInspector.Object.prototype; 898 899 WebInspector.CreationDataGridNode = function(data, hasChildren) 900 { 901 WebInspector.DataGridNode.call(this, data, hasChildren); 902 this.isCreationNode = true; 903 } 904 905 WebInspector.CreationDataGridNode.prototype = { 906 makeNormal: function() 907 { 908 delete this.isCreationNode; 909 delete this.makeNormal; 910 } 911 } 912 913 WebInspector.CreationDataGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype; -
trunk/WebCore/inspector/front-end/DatabasesPanel.js
r46518 r46519 396 396 for (var i = 0; i < length; ++i) 397 397 dataGrid.appendChild(nodes[i]); 398 dataGrid.addCreationNode(false); 398 399 if (length > 0) 399 400 nodes[0].selected = true;
Note:
See TracChangeset
for help on using the changeset viewer.