Changeset 244350 in webkit


Ignore:
Timestamp:
Apr 16, 2019 12:02:23 PM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: Storage: values truncated in Local/Session table
https://bugs.webkit.org/show_bug.cgi?id=178318
<rdar://problem/34998581>

Reviewed by Joseph Pecoraro.

  • UserInterface/Views/DataGrid.js:

(WI.DataGrid):
(WI.DataGrid.prototype._copyTextForDataGridNode):

  • UserInterface/Views/TimelineDataGrid.js:

(WI.TimelineDataGrid):
Refactor WI.DataGrid constructor to allow for more optional arguments.
Introduce a new optional argument copyCallback that can be used to override the text that
would be copied for any WI.DataGridNode in any column.

  • UserInterface/Views/DOMStorageContentView.js:

(WI.DOMStorageContentView):
(WI.DOMStorageContentView.prototype.itemAdded):
(WI.DOMStorageContentView.prototype.itemUpdated):
(WI.DOMStorageContentView.prototype._populate):
(WI.DOMStorageContentView.prototype._dataGridCopy): Added.
Save the full non-truncated value as part of the WI.DataGridNode's data. When copying,
use the full non-truncated value instead of what was shown in the DOM.

Location:
trunk/Source/WebInspectorUI
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r244327 r244350  
     12019-04-16  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Storage: values truncated in Local/Session table
     4        https://bugs.webkit.org/show_bug.cgi?id=178318
     5        <rdar://problem/34998581>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * UserInterface/Views/DataGrid.js:
     10        (WI.DataGrid):
     11        (WI.DataGrid.prototype._copyTextForDataGridNode):
     12        * UserInterface/Views/TimelineDataGrid.js:
     13        (WI.TimelineDataGrid):
     14        Refactor `WI.DataGrid` constructor to allow for more optional arguments.
     15        Introduce a new optional argument `copyCallback` that can be used to override the text that
     16        would be copied for any `WI.DataGridNode` in any column.
     17
     18        * UserInterface/Views/DOMStorageContentView.js:
     19        (WI.DOMStorageContentView):
     20        (WI.DOMStorageContentView.prototype.itemAdded):
     21        (WI.DOMStorageContentView.prototype.itemUpdated):
     22        (WI.DOMStorageContentView.prototype._populate):
     23        (WI.DOMStorageContentView.prototype._dataGridCopy): Added.
     24        Save the full non-truncated value as part of the `WI.DataGridNode`'s `data`. When copying,
     25        use the full non-truncated value instead of what was shown in the DOM.
     26
    1272019-04-15  Joseph Pecoraro  <pecoraro@apple.com>
    228
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js

    r220119 r244350  
    4242        columns.value = {title: WI.UIString("Value"), sortable: true};
    4343
    44         this._dataGrid = new WI.DataGrid(columns, this._editingCallback.bind(this), this._deleteCallback.bind(this));
     44        this._dataGrid = new WI.DataGrid(columns, {
     45            editingCallback: this._editingCallback.bind(this),
     46            copyCallback: this._dataGridCopy.bind(this),
     47            deleteCallback: this._deleteCallback.bind(this),
     48        });
    4549        this._dataGrid.sortOrder = WI.DataGrid.SortOrder.Ascending;
    4650        this._dataGrid.sortColumnIdentifier = "key";
     
    8690    {
    8791        let {key, value} = event.data;
     92        let originalValue = value;
    8893        value = this._truncateValue(value);
    8994
     
    9499        }
    95100
    96         this._dataGrid.appendChild(new WI.DataGridNode({key, value}, false));
     101        this._dataGrid.appendChild(new WI.DataGridNode({key, value, originalValue}, false));
    97102        this._sortDataGrid();
    98103    }
     
    101106    {
    102107        let {key, value} = event.data;
     108        let originalValue = value;
    103109        value = this._truncateValue(value);
    104110
     
    114120                keyFound = true;
    115121                childNode.data.value = value;
     122                childNode.data.originalValue = originalValue;
    116123                childNode.refresh();
    117124            }
     
    137144                    continue;
    138145
     146                let originalValue = value;
    139147                value = this._truncateValue(value);
    140                 let node = new WI.DataGridNode({key, value}, false);
     148                let node = new WI.DataGridNode({key, value, originalValue}, false);
    141149                this._dataGrid.appendChild(node);
    142150            }
     
    254262        domStorage.setItem(key, value);
    255263    }
     264
     265    _dataGridCopy(node, columnIdentifier, text)
     266    {
     267        if (columnIdentifier === "value" && node.data.originalValue)
     268            return node.data.originalValue;
     269        return text;
     270    }
    256271};
    257272
  • trunk/Source/WebInspectorUI/UserInterface/Views/DataGrid.js

    r242174 r244350  
    2626WI.DataGrid = class DataGrid extends WI.View
    2727{
    28     constructor(columnsData, editCallback, deleteCallback, preferredColumnOrder)
     28    constructor(columnsData, {editCallback, copyCallback, deleteCallback, preferredColumnOrder} = {})
    2929    {
    3030        super();
     
    110110        }
    111111
     112        if (copyCallback)
     113            this._copyCallback = copyCallback;
     114
    112115        if (deleteCallback)
    113116            this._deleteCallback = deleteCallback;
     
    169172        }
    170173
    171         var dataGrid = new WI.DataGrid(columnsData, undefined, undefined, columnNames);
     174        let dataGrid = new WI.DataGrid(columnsData, {preferredColumnOrder: columnNames});
    172175        for (var i = 0; i < values.length / numColumns; ++i) {
    173176            var data = {};
     
    16981701    _copyTextForDataGridNode(node)
    16991702    {
    1700         let fields = node.dataGrid.orderedColumns.map((identifier) => this.textForDataGridNodeColumn(node, identifier));
     1703        let fields = node.dataGrid.orderedColumns.map((identifier) => {
     1704            let text = this.textForDataGridNodeColumn(node, identifier);
     1705            if (this._copyCallback)
     1706                text = this._copyCallback(node, identifier, text);
     1707            return text;
     1708        });
    17011709        return fields.join(this._copyTextDelimiter);
    17021710    }
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js

    r238483 r244350  
    2626WI.TimelineDataGrid = class TimelineDataGrid extends WI.DataGrid
    2727{
    28     constructor(columns, editCallback, deleteCallback)
    29     {
    30         super(columns, editCallback, deleteCallback);
     28    constructor(columns)
     29    {
     30        super(columns);
    3131
    3232        this.element.classList.add("timeline");
Note: See TracChangeset for help on using the changeset viewer.