Title: [86855] trunk/Source/WebCore
- Revision
- 86855
- Author
- [email protected]
- Date
- 2011-05-19 11:14:58 -0700 (Thu, 19 May 2011)
Log Message
2011-05-19 Tonis Tiigi <[email protected]>
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (86854 => 86855)
--- trunk/Source/WebCore/ChangeLog 2011-05-19 17:46:09 UTC (rev 86854)
+++ trunk/Source/WebCore/ChangeLog 2011-05-19 18:14:58 UTC (rev 86855)
@@ -1,3 +1,21 @@
+2011-05-19 Tonis Tiigi <[email protected]>
+
+ 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):
+
2011-05-19 Ryosuke Niwa <[email protected]>
Reviewed by Darin Adler.
Modified: trunk/Source/WebCore/inspector/front-end/DataGrid.js (86854 => 86855)
--- trunk/Source/WebCore/inspector/front-end/DataGrid.js 2011-05-19 17:46:09 UTC (rev 86854)
+++ trunk/Source/WebCore/inspector/front-end/DataGrid.js 2011-05-19 18:14:58 UTC (rev 86855)
@@ -922,6 +922,18 @@
}
},
+ get resizeMethod()
+ {
+ if (typeof this._resizeMethod === "undefined")
+ return WebInspector.DataGrid.ResizeMethod.Nearest;
+ return this._resizeMethod;
+ },
+
+ set resizeMethod(method)
+ {
+ this._resizeMethod = method;
+ },
+
_startResizerDragging: function(event)
{
this.currentResizer = event.target;
@@ -942,13 +954,23 @@
var dragPoint = event.clientX - this.element.totalOffsetLeft;
// Constrain the dragpoint to be within the space made up by the
// column directly to the left and the column directly to the right.
+ var leftCellIndex = resizer.leftNeighboringColumnID;
+ var rightCellIndex = resizer.rightNeighboringColumnID;
+ var firstRowCells = this.headerTableBody.rows[0].cells;
var leftEdgeOfPreviousColumn = 0;
- var firstRowCells = this.headerTableBody.rows[0].cells;
- for (var i = 0; i < resizer.leftNeighboringColumnID; i++)
+ for (var i = 0; i < leftCellIndex; i++)
leftEdgeOfPreviousColumn += firstRowCells[i].offsetWidth;
-
- var rightEdgeOfNextColumn = leftEdgeOfPreviousColumn + firstRowCells[resizer.leftNeighboringColumnID].offsetWidth + firstRowCells[resizer.rightNeighboringColumnID].offsetWidth;
-
+
+ // Differences for other resize methods
+ if (this.resizeMethod == WebInspector.DataGrid.ResizeMethod.Last) {
+ rightCellIndex = this.resizers.length;
+ } else if (this.resizeMethod == WebInspector.DataGrid.ResizeMethod.First) {
+ leftEdgeOfPreviousColumn += firstRowCells[leftCellIndex].offsetWidth - firstRowCells[0].offsetWidth;
+ leftCellIndex = 0;
+ }
+
+ var rightEdgeOfNextColumn = leftEdgeOfPreviousColumn + firstRowCells[leftCellIndex].offsetWidth + firstRowCells[rightCellIndex].offsetWidth;
+
// Give each column some padding so that they don't disappear.
var leftMinimum = leftEdgeOfPreviousColumn + this.ColumnResizePadding;
var rightMaximum = rightEdgeOfNextColumn - this.ColumnResizePadding;
@@ -958,12 +980,12 @@
resizer.style.left = (dragPoint - this.CenterResizerOverBorderAdjustment) + "px";
var percentLeftColumn = (((dragPoint - leftEdgeOfPreviousColumn) / this._dataTable.offsetWidth) * 100) + "%";
- this._headerTableColumnGroup.children[resizer.leftNeighboringColumnID].style.width = percentLeftColumn;
- this._dataTableColumnGroup.children[resizer.leftNeighboringColumnID].style.width = percentLeftColumn;
+ this._headerTableColumnGroup.children[leftCellIndex].style.width = percentLeftColumn;
+ this._dataTableColumnGroup.children[leftCellIndex].style.width = percentLeftColumn;
var percentRightColumn = (((rightEdgeOfNextColumn - dragPoint) / this._dataTable.offsetWidth) * 100) + "%";
- this._headerTableColumnGroup.children[resizer.rightNeighboringColumnID].style.width = percentRightColumn;
- this._dataTableColumnGroup.children[resizer.rightNeighboringColumnID].style.width = percentRightColumn;
+ this._headerTableColumnGroup.children[rightCellIndex].style.width = percentRightColumn;
+ this._dataTableColumnGroup.children[rightCellIndex].style.width = percentRightColumn;
this._positionResizers();
event.preventDefault();
@@ -982,6 +1004,12 @@
CenterResizerOverBorderAdjustment: 3,
}
+WebInspector.DataGrid.ResizeMethod = {
+ Nearest: "nearest",
+ First: "first",
+ Last: "last"
+}
+
WebInspector.DataGrid.prototype.__proto__ = WebInspector.Object.prototype;
WebInspector.DataGridNode = function(data, hasChildren)
Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (86854 => 86855)
--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2011-05-19 17:46:09 UTC (rev 86854)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2011-05-19 18:14:58 UTC (rev 86855)
@@ -185,6 +185,7 @@
columns.timeline.sort = "ascending";
this._dataGrid = new WebInspector.DataGrid(columns);
+ this._dataGrid.resizeMethod = WebInspector.DataGrid.ResizeMethod.Last;
this._dataGrid.element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
this.containerElement.appendChild(this._dataGrid.element);
this._dataGrid.addEventListener("sorting changed", this._sortItems, this);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes