Title: [162931] trunk/Source/WebInspectorUI
Revision
162931
Author
commit-qu...@webkit.org
Date
2014-01-28 07:40:29 -0800 (Tue, 28 Jan 2014)

Log Message

Web Inspector: In a DataGrid, store value of columnIdentifier to DOM node representing a cell
https://bugs.webkit.org/show_bug.cgi?id=127613

Patch by Diego Pino Garcia <dp...@igalia.com> on 2014-01-28
Reviewed by Timothy Hatcher.

* UserInterface/DOMStorageContentView.js:
(WebInspector.DOMStorageContentView.prototype._editingCallback):
* UserInterface/DataGrid.js:
(WebInspector.DataGrid):
(WebInspector.DataGrid.prototype._keyDown):
(WebInspector.DataGrid.prototype._contextMenuInDataTable):
(WebInspector.DataGridNode.prototype.createCell):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (162930 => 162931)


--- trunk/Source/WebInspectorUI/ChangeLog	2014-01-28 15:08:31 UTC (rev 162930)
+++ trunk/Source/WebInspectorUI/ChangeLog	2014-01-28 15:40:29 UTC (rev 162931)
@@ -1,3 +1,18 @@
+2014-01-28  Diego Pino Garcia  <dp...@igalia.com>
+
+        Web Inspector: In a DataGrid, store value of columnIdentifier to DOM node representing a cell
+        https://bugs.webkit.org/show_bug.cgi?id=127613
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/DOMStorageContentView.js:
+        (WebInspector.DOMStorageContentView.prototype._editingCallback):
+        * UserInterface/DataGrid.js:
+        (WebInspector.DataGrid):
+        (WebInspector.DataGrid.prototype._keyDown):
+        (WebInspector.DataGrid.prototype._contextMenuInDataTable):
+        (WebInspector.DataGridNode.prototype.createCell):
+
 2014-01-27  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: Feature Check all Protocol Generated Interfaces to get JSContext Inspection working

Modified: trunk/Source/WebInspectorUI/UserInterface/DOMStorageContentView.js (162930 => 162931)


--- trunk/Source/WebInspectorUI/UserInterface/DOMStorageContentView.js	2014-01-28 15:08:31 UTC (rev 162930)
+++ trunk/Source/WebInspectorUI/UserInterface/DOMStorageContentView.js	2014-01-28 15:40:29 UTC (rev 162931)
@@ -215,7 +215,7 @@
     _editingCallback: function(editingNode, columnIdentifier, oldText, newText)
     {
         var domStorage = this.representedObject;
-        if (columnIdentifier === 0) {
+        if (columnIdentifier === "0") {
             if (oldText)
                 domStorage.removeItem(oldText);
 

Modified: trunk/Source/WebInspectorUI/UserInterface/DataGrid.js (162930 => 162931)


--- trunk/Source/WebInspectorUI/UserInterface/DataGrid.js	2014-01-28 15:08:31 UTC (rev 162930)
+++ trunk/Source/WebInspectorUI/UserInterface/DataGrid.js	2014-01-28 15:40:29 UTC (rev 162931)
@@ -153,6 +153,7 @@
         var column = columns[columnIdentifier];
         var td = document.createElement("td");
         td.className = columnIdentifier + "-column";
+        td.__columnIdentifier = columnIdentifier;
         var group = this.groups[columnIdentifier];
         if (group)
             td.classList.add("column-group-" + group);
@@ -343,8 +344,7 @@
         // FIXME: We need more column identifiers here throughout this function.
         // Not needed yet since only editable DataGrid is DOM Storage, which is Key - Value.
 
-        // FIXME: Better way to do this than regular expressions?
-        var columnIdentifier = parseInt(element.className.match(/\b(\d+)-column\b/)[1], 10);
+        var columnIdentifier = element.__columnIdentifier;
 
         var textBeforeEditing = this._editingNode.data[columnIdentifier] || "";
         var currentEditingNode = this._editingNode;
@@ -901,8 +901,6 @@
         } else if (isEnterKey(event)) {
             if (this._editCallback) {
                 handled = true;
-                // The first child of the selected element is the <td class="0-column">,
-                // and that's what we want to edit.
                 this._startEditing(this.selectedNode._element.children[0]);
             }
         }
@@ -1137,7 +1135,7 @@
                     contextMenu.appendItem(WebInspector.UIString("Add New"), this._startEditing.bind(this, event.target));
                 else {
                     var element = event.target.enclosingNodeOrSelfWithNodeName("td");
-                    var columnIdentifier = parseInt(element.className.match(/\b(\d+)-column\b/)[1], 10);
+                    var columnIdentifier = element.__columnIdentifier;
                     var columnTitle = this.dataGrid.columns[columnIdentifier].title;
                     contextMenu.appendItem(WebInspector.UIString("Edit ā€œ%sā€").format(columnTitle), this._startEditing.bind(this, event.target));
                 }
@@ -1518,6 +1516,7 @@
     {
         var cell = document.createElement("td");
         cell.className = columnIdentifier + "-column";
+        cell.__columnIdentifier = columnIdentifier;
 
         var alignment = this.dataGrid.aligned[columnIdentifier];
         if (alignment)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to