Changeset 279613 in webkit
- Timestamp:
- Jul 6, 2021 1:25:48 PM (13 months ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
UserInterface/Views/NavigationBar.js (modified) (3 diffs)
-
UserInterface/Views/SingleSidebar.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r279510 r279613 1 2021-07-06 Patrick Angle <pangle@apple.com> 2 3 Web Inspector: Elements Tab Details Sidebar navigation items sometime wrap to a second line 4 https://bugs.webkit.org/show_bug.cgi?id=227707 5 6 Reviewed by Devin Rousso. 7 8 When resizing a sidebar, it was possible that the cumulative widths of each navigation item could add up to just 9 less than the actual amount of space necessary to lay out each item in a single row, leading to wrapping items 10 to the next line. This resolves that issue by taking the ceiling of each item's width when calculating the 11 total amount of space needed to display all the items. Additionally, every time a panel is added or removed from 12 the sidebar, we need to recalculate the width of the sidebar to make sure the new navigation item, or the 13 removal thereof, is accommodated. 14 15 * UserInterface/Views/NavigationBar.js: 16 (WI.NavigationBar.prototype.layout.calculateVisibleItemWidth): 17 (WI.NavigationBar.prototype._calculateMinimumWidth): 18 * UserInterface/Views/SingleSidebar.js: 19 (WI.SingleSidebar.prototype.didInsertSidebarPanel): 20 (WI.SingleSidebar.prototype.didRemoveSidebarPanel): 21 1 22 2021-07-02 Harshil Ratnu <hratnu@apple.com> 2 23 -
trunk/Source/WebInspectorUI/UserInterface/Views/NavigationBar.js
r259168 r279613 224 224 225 225 function calculateVisibleItemWidth() { 226 return visibleNavigationItems.reduce((total, item) => total + item.width, 0);226 return visibleNavigationItems.reduce((total, item) => total + Math.ceil(item.width), 0); 227 227 } 228 228 … … 253 253 while (totalItemWidth > barWidth && visibleNavigationItems.length) { 254 254 let navigationItem = visibleNavigationItems.shift(); 255 totalItemWidth -= navigationItem.width;255 totalItemWidth -= Math.ceil(navigationItem.width); 256 256 forceItemHidden(navigationItem, true); 257 257 } … … 415 415 this.element.classList.add(WI.NavigationBar.CollapsedStyleClassName); 416 416 417 let totalItemWidth = visibleNavigationItems.reduce((total, item) => total + item.minimumWidth, 0);417 let totalItemWidth = visibleNavigationItems.reduce((total, item) => total + Math.ceil(item.minimumWidth), 0); 418 418 419 419 // Remove the collapsed style class if we were not collapsed before. -
trunk/Source/WebInspectorUI/UserInterface/Views/SingleSidebar.js
r274465 r279613 84 84 didInsertSidebarPanel(sidebarPanel, index) 85 85 { 86 if (this._navigationBar) { 87 console.assert(sidebarPanel.navigationItem); 88 this._navigationBar.insertNavigationItem(sidebarPanel.navigationItem, index); 89 } 86 if (!this._navigationBar) 87 return; 88 89 console.assert(sidebarPanel.navigationItem); 90 this._navigationBar.insertNavigationItem(sidebarPanel.navigationItem, index); 91 92 this._recalculateWidth(); 90 93 } 91 94 92 95 didRemoveSidebarPanel(sidebarPanel) 93 96 { 94 if (this._navigationBar) { 95 console.assert(sidebarPanel.navigationItem); 96 this._navigationBar.removeNavigationItem(sidebarPanel.navigationItem); 97 } 97 if (!this._navigationBar) 98 return; 99 100 console.assert(sidebarPanel.navigationItem); 101 this._navigationBar.removeNavigationItem(sidebarPanel.navigationItem); 102 103 this._recalculateWidth(); 98 104 } 99 105
Note: See TracChangeset
for help on using the changeset viewer.