Changeset 195522 in webkit
- Timestamp:
- Jan 24, 2016, 8:00:36 PM (10 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r195519 r195522 1 2016-01-24 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: add support for placing Views in DataGrid column headers 4 https://bugs.webkit.org/show_bug.cgi?id=153387 5 <rdar://problem/24310797> 6 7 Reviewed by Timothy Hatcher. 8 9 This patch adds a new DataGrid column property, `headerView`, allowing a 10 custom View object to be placed in a column's header cell. The grid ensures 11 that the left and right edges of the view are kept in sync as columns are 12 resized. As most views use absolute positioning and are styled in CSS, the 13 vertical position and height of the view isn't set by the grid. 14 15 * UserInterface/Views/DataGrid.js: 16 (WebInspector.DataGrid.prototype.insertColumn): 17 If the new column includes the `headerView` column data property, 18 it should take priority over `titleDOMFragment` and title text. 19 The specified View object is inserted into the DOM under the 20 column's <th> element, and added as a subview of the data grid. 21 (WebInspector.DataGrid.prototype.layout): 22 Update header views after performing default layout. 23 (WebInspector.DataGrid.prototype._showColumn): 24 Set `hidden` column property false instead of deleting it. 25 (WebInspector.DataGrid.prototype._positionHeaderViews): 26 Update the left and right style positions for all Views embedded in 27 column header cells, then update their layouts. 28 (WebInspector.DataGrid.prototype.resizerDragging): 29 Update header views after column resizers are repositioned. 30 1 31 2016-01-24 Nikita Vasilyev <nvasilyev@apple.com> 2 32 -
trunk/Source/WebInspectorUI/UserInterface/Views/DataGrid.js
r194906 r195522 475 475 this._headerTableRowElement.insertBefore(headerCellElement, referenceElement); 476 476 477 var div = headerCellElement.createChild("div"); 478 if (column["titleDOMFragment"]) 479 div.appendChild(column["titleDOMFragment"]); 480 else 481 div.textContent = column["title"] || ""; 477 if (column["headerView"]) { 478 let headerView = column["headerView"]; 479 console.assert(headerView instanceof WebInspector.View); 480 481 headerCellElement.appendChild(headerView.element); 482 this.addSubview(headerView); 483 } else { 484 let titleElement = headerCellElement.createChild("div"); 485 if (column["titleDOMFragment"]) 486 titleElement.appendChild(column["titleDOMFragment"]); 487 else 488 titleElement.textContent = column["title"] || ""; 489 } 482 490 483 491 if (column["sortable"]) { … … 610 618 611 619 this._positionResizerElements(); 620 this._positionHeaderViews(); 612 621 } 613 622 … … 641 650 _showColumn(columnIdentifier) 642 651 { 643 delete this.columns.get(columnIdentifier)["hidden"];652 this.columns.get(columnIdentifier)["hidden"] = false; 644 653 } 645 654 … … 707 716 if (previousResizer) 708 717 previousResizer[WebInspector.DataGrid.NextColumnOrdinalSymbol] = this.orderedColumns.length - 1; 718 } 719 720 _positionHeaderViews() 721 { 722 let visibleHeaderViews = false; 723 for (let column of this.columns.values()) { 724 if (column["headerView"] && !column["hidden"]) { 725 visibleHeaderViews = true; 726 break; 727 } 728 } 729 730 if (!visibleHeaderViews) 731 return; 732 733 let left = 0; 734 for (let columnIdentifier of this.orderedColumns) { 735 let column = this.columns.get(columnIdentifier); 736 console.assert(column, "Missing column data for header cell with columnIdentifier " + columnIdentifier); 737 if (!column) 738 continue; 739 740 let columnWidth = this._headerTableCellElements.get(columnIdentifier).offsetWidth; 741 let headerView = column["headerView"]; 742 if (headerView) { 743 headerView.element.style.left = left + "px"; 744 headerView.element.style.width = columnWidth + "px"; 745 headerView.updateLayout(); 746 } 747 748 left += columnWidth; 749 } 709 750 } 710 751 … … 1286 1327 1287 1328 this._positionResizerElements(); 1329 this._positionHeaderViews(); 1288 1330 event.preventDefault(); 1289 1331 }
Note:
See TracChangeset
for help on using the changeset viewer.