Changeset 86855 in webkit


Ignore:
Timestamp:
May 19, 2011 11:14:58 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-05-19 Tonis Tiigi <tonistiigi@gmail.com>

Reviewed by Pavel Feldman.

Web Inspector: Resizing columns in the network panel is weird
https://bugs.webkit.org/show_bug.cgi?id=55238

Makes network panel column resizing more usable by adding "first only" and "last only"
resizing methods to WebInspector.DataGrid. Current behavior is named "nearest" and
remains default. Network panels datagrid is set to use method "last".

  • inspector/front-end/DataGrid.js: (WebInspector.DataGrid.prototype.get resizeMethod): (WebInspector.DataGrid.prototype.set resizeMethod): (WebInspector.DataGrid.prototype._resizerDragging):
  • inspector/front-end/NetworkPanel.js: (WebInspector.NetworkPanel.prototype._createTable):
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86854 r86855  
     12011-05-19  Tonis Tiigi  <tonistiigi@gmail.com>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: Resizing columns in the network panel is weird
     6        https://bugs.webkit.org/show_bug.cgi?id=55238
     7
     8        Makes network panel column resizing more usable by adding "first only" and "last only"
     9        resizing methods to WebInspector.DataGrid. Current behavior is named "nearest" and
     10        remains default. Network panels datagrid is set to use method "last".
     11
     12        * inspector/front-end/DataGrid.js:
     13        (WebInspector.DataGrid.prototype.get resizeMethod):
     14        (WebInspector.DataGrid.prototype.set resizeMethod):
     15        (WebInspector.DataGrid.prototype._resizerDragging):
     16        * inspector/front-end/NetworkPanel.js:
     17        (WebInspector.NetworkPanel.prototype._createTable):
     18
    1192011-05-19  Ryosuke Niwa  <rniwa@webkit.org>
    220
  • trunk/Source/WebCore/inspector/front-end/DataGrid.js

    r83031 r86855  
    923923    },
    924924   
     925    get resizeMethod()
     926    {
     927        if (typeof this._resizeMethod === "undefined")
     928            return WebInspector.DataGrid.ResizeMethod.Nearest;
     929        return this._resizeMethod;
     930    },
     931
     932    set resizeMethod(method)
     933    {
     934        this._resizeMethod = method;
     935    },
     936   
    925937    _startResizerDragging: function(event)
    926938    {
     
    943955        // Constrain the dragpoint to be within the space made up by the
    944956        // column directly to the left and the column directly to the right.
     957        var leftCellIndex = resizer.leftNeighboringColumnID;
     958        var rightCellIndex = resizer.rightNeighboringColumnID;
     959        var firstRowCells = this.headerTableBody.rows[0].cells;
    945960        var leftEdgeOfPreviousColumn = 0;
    946         var firstRowCells = this.headerTableBody.rows[0].cells;
    947         for (var i = 0; i < resizer.leftNeighboringColumnID; i++)
     961        for (var i = 0; i < leftCellIndex; i++)
    948962            leftEdgeOfPreviousColumn += firstRowCells[i].offsetWidth;
    949            
    950         var rightEdgeOfNextColumn = leftEdgeOfPreviousColumn + firstRowCells[resizer.leftNeighboringColumnID].offsetWidth + firstRowCells[resizer.rightNeighboringColumnID].offsetWidth;
    951 
     963       
     964        // Differences for other resize methods
     965        if (this.resizeMethod == WebInspector.DataGrid.ResizeMethod.Last) {
     966            rightCellIndex = this.resizers.length;
     967        } else if (this.resizeMethod == WebInspector.DataGrid.ResizeMethod.First) {
     968            leftEdgeOfPreviousColumn += firstRowCells[leftCellIndex].offsetWidth - firstRowCells[0].offsetWidth;
     969            leftCellIndex = 0;
     970        }
     971       
     972        var rightEdgeOfNextColumn = leftEdgeOfPreviousColumn + firstRowCells[leftCellIndex].offsetWidth + firstRowCells[rightCellIndex].offsetWidth;
     973       
    952974        // Give each column some padding so that they don't disappear.
    953975        var leftMinimum = leftEdgeOfPreviousColumn + this.ColumnResizePadding;
     
    959981
    960982        var percentLeftColumn = (((dragPoint - leftEdgeOfPreviousColumn) / this._dataTable.offsetWidth) * 100) + "%";
    961         this._headerTableColumnGroup.children[resizer.leftNeighboringColumnID].style.width = percentLeftColumn;
    962         this._dataTableColumnGroup.children[resizer.leftNeighboringColumnID].style.width = percentLeftColumn;
     983        this._headerTableColumnGroup.children[leftCellIndex].style.width = percentLeftColumn;
     984        this._dataTableColumnGroup.children[leftCellIndex].style.width = percentLeftColumn;
    963985
    964986        var percentRightColumn = (((rightEdgeOfNextColumn - dragPoint) / this._dataTable.offsetWidth) * 100) + "%";
    965         this._headerTableColumnGroup.children[resizer.rightNeighboringColumnID].style.width =  percentRightColumn;
    966         this._dataTableColumnGroup.children[resizer.rightNeighboringColumnID].style.width = percentRightColumn;
     987        this._headerTableColumnGroup.children[rightCellIndex].style.width =  percentRightColumn;
     988        this._dataTableColumnGroup.children[rightCellIndex].style.width = percentRightColumn;
    967989
    968990        this._positionResizers();
     
    9811003   
    9821004    CenterResizerOverBorderAdjustment: 3,
     1005}
     1006
     1007WebInspector.DataGrid.ResizeMethod = {
     1008    Nearest: "nearest",
     1009    First: "first",
     1010    Last: "last"
    9831011}
    9841012
  • trunk/Source/WebCore/inspector/front-end/NetworkPanel.js

    r85316 r86855  
    186186
    187187        this._dataGrid = new WebInspector.DataGrid(columns);
     188        this._dataGrid.resizeMethod = WebInspector.DataGrid.ResizeMethod.Last;
    188189        this._dataGrid.element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
    189190        this.containerElement.appendChild(this._dataGrid.element);
Note: See TracChangeset for help on using the changeset viewer.