Bug 27322

Summary: Inspector: Create New DOM Storage Items via DataGrid
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web Inspector (Deprecated)Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: timothy
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: OS X 10.5   
Attachments:
Description Flags
Make DOM Storage DataGrid More Interactive
none
Make DOM Storage DataGrid More Interactive
none
Fixed the Loop timothy: review+

Description Joseph Pecoraro 2009-07-15 17:15:42 PDT
The DataGrid for DOM Storage (localStorage and sessionStorage) should be more interactive.  This will allow a lot more interaction, including creating Elements.
Comment 1 Joseph Pecoraro 2009-07-15 17:29:04 PDT
Created attachment 32821 [details]
Make DOM Storage DataGrid More Interactive

- Added a "CreationDataGridNode" type that can delete its special data and transform back into a normal DataGridNode.
- Added a reference in the DataGrid to a CreationDataNode if one exists: @see addCreationNode()
- Clicking anywhere in the excess space will select the bottom row (an existing blank row)
- DOM Storage specific logic forces it to select the leftmost td (to set a Key)

I see a potential problem with sorting the GridData table.  However, sorting wasn't working for me to begin with (was it ever working).  However, the special CreationDataNode, if it exists, has this.isCreationNode and thus can easily be sorted last.
Comment 2 Timothy Hatcher 2009-07-27 15:02:57 PDT
Comment on attachment 32821 [details]
Make DOM Storage DataGrid More Interactive

> +        if (this._editingNode.isCreationNode) {
> +            element = this._editingNode._element.children[0]; // Leftmost Column
> +        }

No need for the braces here.

What does the creation row look like?
Comment 3 Joseph Pecoraro 2009-07-27 15:29:56 PDT
This is what the functionality looks like:
http://screencast.com/t/ngFWrjWN6M

Updating the patch with a few style fixes and that "select()" the creation row so that you don't accidently delete something in the background.  That new patch will be up in a second.
Comment 4 Joseph Pecoraro 2009-07-27 15:40:56 PDT
Created attachment 33577 [details]
Make DOM Storage DataGrid More Interactive

NOTES:

- Style fixes
- Added the select() call to prevent unwanted deletions
Comment 5 Timothy Hatcher 2009-07-28 21:14:21 PDT
Comment on attachment 33577 [details]
Make DOM Storage DataGrid More Interactive

> +        var cnt = 0;
> +        for (var i in this.columns)
> +            emptyData[cnt++] = '';

This looks funny. Shouldn't this just be:

for (var column in this.columns)
    emptyData[column] = '';
Comment 6 David Levin 2009-07-28 21:30:16 PDT
Comment on attachment 32821 [details]
Make DOM Storage DataGrid More Interactive

Clearing r+ on obsolete patch to move out of commit queue.
Comment 7 Joseph Pecoraro 2009-07-28 21:38:46 PDT
Created attachment 33689 [details]
Fixed the Loop
Comment 8 Joseph Pecoraro 2009-07-28 21:42:36 PDT
(In reply to comment #5)
> (From update of attachment 33577 [details])
> > +        var cnt = 0;
> > +        for (var i in this.columns)
> > +            emptyData[cnt++] = '';
> 
> This looks funny. Shouldn't this just be:
> 
> for (var column in this.columns)
>     emptyData[column] = '';

Done.
Comment 9 Timothy Hatcher 2009-07-28 21:55:12 PDT
http://trac.webkit.org/changeset/46519