Changeset 46520 in webkit


Ignore:
Timestamp:
Jul 28, 2009 9:54:07 PM (15 years ago)
Author:
timothy@apple.com
Message:

Allow tabbing through the Web Inspector DOM Storage grid cells when editing.

2009-07-28 Joseph Pecoraro <joepeck02@gmail.com>

Inspector: Tab Through the DOM Storage DataGrid when Editing

https://bugs.webkit.org/show_bug.cgi?id=27746

Reviewed by Timothy Hatcher.

  • inspector/front-end/DOMStorageDataGrid.js: (WebInspector.DOMStorageDataGrid.prototype._startEditingColumnOfDataGridNode): refactored to directly edit and select a column (WebInspector.DOMStorageDataGrid.prototype._startEditing): (WebInspector.DOMStorageDataGrid.prototype._editingCommitted.moveToNextIfNeeded): handles moveDirection on a commit (WebInspector.DOMStorageDataGrid.prototype._editingCommitted): uses moveToNext to traverse appropriately
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r46519 r46520  
     12009-07-28  Joseph Pecoraro  <joepeck02@gmail.com>
     2
     3        Inspector: Tab Through the DOM Storage DataGrid when Editing
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=27746
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * inspector/front-end/DOMStorageDataGrid.js:
     10        (WebInspector.DOMStorageDataGrid.prototype._startEditingColumnOfDataGridNode): refactored to directly edit and select a column
     11        (WebInspector.DOMStorageDataGrid.prototype._startEditing):
     12        (WebInspector.DOMStorageDataGrid.prototype._editingCommitted.moveToNextIfNeeded): handles moveDirection on a commit
     13        (WebInspector.DOMStorageDataGrid.prototype._editingCommitted): uses moveToNext to traverse appropriately
     14
    1152009-07-28  Joseph Pecoraro  <joepeck02@gmail.com>
    216
  • trunk/WebCore/inspector/front-end/DOMStorageDataGrid.js

    r46519 r46520  
    4040    },
    4141
     42    _startEditingColumnOfDataGridNode: function(node, column)
     43    {
     44        this._editing = true;
     45        this._editingNode = node;
     46        this._editingNode.select();
     47
     48        var element = this._editingNode._element.children[column];
     49        WebInspector.startEditing(element, this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent);
     50        window.getSelection().setBaseAndExtent(element, 0, element, 1);
     51    },
     52
    4253    _startEditing: function(event)
    4354    {
     
    5263            this._editingNode = this.creationNode;
    5364        }
     65
     66        // Force editing the "Key" column when editing the creation node
     67        if (this._editingNode.isCreationNode)
     68            return this._startEditingColumnOfDataGridNode(this._editingNode, 0);
     69
    5470        this._editing = true;
    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 
    6171        WebInspector.startEditing(element, this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent);
    6272        window.getSelection().setBaseAndExtent(element, 0, element, 1);
    6373    },
    6474
    65     _editingCommitted: function(element, newText)
     75    _editingCommitted: function(element, newText, oldText, context, moveDirection)
    6676    {
    6777        var columnIdentifier = (element.hasStyleClass("0-column") ? 0 : 1);
    6878        var textBeforeEditing = this._editingNode.data[columnIdentifier];
     79        var currentEditingNode = this._editingNode;
     80
     81        function moveToNextIfNeeded(wasChange) {
     82            if (!moveDirection)
     83                return;
     84
     85            if (moveDirection === "forward") {
     86                if (currentEditingNode.isCreationNode && columnIdentifier === 0 && !wasChange)
     87                    return;
     88
     89                if (columnIdentifier === 0)
     90                    return this._startEditingColumnOfDataGridNode(currentEditingNode, 1);
     91
     92                var nextDataGridNode = currentEditingNode.traverseNextNode(true, null, true);
     93                if (nextDataGridNode)
     94                    return this._startEditingColumnOfDataGridNode(nextDataGridNode, 0);
     95                if (currentEditingNode.isCreationNode && wasChange) {
     96                    addCreationNode(false);
     97                    return this._startEditingColumnOfDataGridNode(this.creationNode, 0);
     98                }
     99                return;
     100            }
     101
     102            if (moveDirection === "backward") {
     103                if (columnIdentifier === 1)
     104                    return this._startEditingColumnOfDataGridNode(currentEditingNode, 0);
     105                    var nextDataGridNode = currentEditingNode.traversePreviousNode(true, null, true);
     106
     107                if (nextDataGridNode)
     108                    return this._startEditingColumnOfDataGridNode(nextDataGridNode, 1);
     109                return;
     110            }
     111        }
     112
    69113        if (textBeforeEditing == newText) {
    70114            this._editingCancelled(element);
     115            moveToNextIfNeeded.call(this, false);
    71116            return;
    72117        }
     
    78123                    element.textContent = this._editingNode.data[0];
    79124                    this._editingCancelled(element);
     125                    moveToNextIfNeeded.call(this, false);
    80126                    return;
    81127                }
     
    93139
    94140        this._editingCancelled(element);
     141        moveToNextIfNeeded.call(this, true);
    95142    },
    96143
Note: See TracChangeset for help on using the changeset viewer.