Changeset 248818 in webkit
- Timestamp:
- Aug 17, 2019 1:11:30 AM (5 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 1 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r248810 r248818 1 2019-08-17 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Sources: gear icons moves to 2nd line when sidebar is narrow 4 https://bugs.webkit.org/show_bug.cgi?id=198017 5 6 Reviewed by Joseph Pecoraro. 7 8 * UserInterface/Views/NavigationBar.js: 9 (WI.NavigationBar): 10 (WI.NavigationBar.prototype.layout): 11 (WI.NavigationBar.prototype.layout.forceItemHidden): Added. 12 (WI.NavigationBar.prototype.layout.isDivider): Added. 13 (WI.NavigationBar.prototype.layout.calculateVisibleItemWidth): Added. 14 (WI.NavigationBar.prototype.needsLayout): Deleted. 15 (WI.NavigationBar.prototype.sizeDidChange): Deleted. 16 (WI.NavigationBar.prototype._updateContent): Deleted. 17 (WI.NavigationBar.prototype._updateContent.forceItemHidden): Deleted. 18 (WI.NavigationBar.prototype._updateContent.isDivider): Deleted. 19 (WI.NavigationBar.prototype._updateContent.calculateVisibleItemWidth): Deleted. 20 Reset the cached `_minimumWidth` whenever updating in `layout()`. 21 22 * UserInterface/Views/NavigationItem.js: 23 (WI.NavigationItem.prototype.get width): 24 (WI.NavigationItem.prototype.update): Added. 25 (WI.NavigationItem.prototype.updateLayout): Deleted. 26 (WI.NavigationItem.prototype.get totalMargin): Added. 27 * UserInterface/Views/ButtonNavigationItem.js: 28 (WI.ButtonNavigationItem.prototype.get totalMargin): Added. 29 * UserInterface/Views/ButtonNavigationItem.css: 30 * UserInterface/Views/TextNavigationItem.js: 31 (WI.TextNavigationItem.prototype.get totalMargin): Added. 32 * UserInterface/Views/TextNavigationItem.css: 33 `Element.prototype.getBoundingClientRect` doesn't include the `margin` box of an element. 34 Rather than create a CSS variable and parse a computed style, save the total `margin` amount 35 to a getter that can then be added when computing the minimum width. 36 37 * UserInterface/Views/Sidebar.js: 38 (WI.Sidebar): 39 (WI.Sidebar.prototype._recalculateWidth): 40 * UserInterface/Views/FlexibleSpaceNavigationItem.js: 41 (WI.FlexibleSpaceNavigationItem.prototype.update): Added. 42 (WI.FlexibleSpaceNavigationItem.prototype.updateLayout): Deleted. 43 * UserInterface/Views/GroupNavigationItem.js: 44 (WI.GroupNavigationItem.prototype.update): Added. 45 (WI.GroupNavigationItem.prototype.updateLayout): Deleted. 46 * UserInterface/Views/HierarchicalPathNavigationItem.js: 47 (WI.HierarchicalPathNavigationItem.prototype.update): Added. 48 (WI.HierarchicalPathNavigationItem.prototype.updateLayout): Deleted. 49 * UserInterface/Views/RadioButtonNavigationItem.js: 50 (WI.RadioButtonNavigationItem.prototype.update): Added. 51 (WI.RadioButtonNavigationItem.prototype.updateLayout): Deleted. 52 Rename `updateLayout` to `update` so it doesn't clash with `WI.View` naming. 53 54 * UserInterface/Views/SidebarNavigationBar.js: Removed. 55 * UserInterface/Main.html: 56 * UserInterface/Views/NavigationBar.css: 57 (.navigation-bar .item): Added. 58 (.navigation-bar .item, .sidebar-navigation-bar > .holder .item): Deleted. 59 (.sidebar-navigation-bar): Deleted. 60 (.sidebar-navigation-bar .holder): Deleted. 61 Remove unnecessary class. 62 1 63 2019-08-16 Joseph Pecoraro <pecoraro@apple.com> 2 64 -
trunk/Source/WebInspectorUI/UserInterface/Main.html
r248602 r248818 793 793 <script src="Views/ShaderProgramTreeElement.js"></script> 794 794 <script src="Views/Sidebar.js"></script> 795 <script src="Views/SidebarNavigationBar.js"></script>796 795 <script src="Views/Slider.js"></script> 797 796 <script src="Views/SoftContextMenu.js"></script> -
trunk/Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.css
r242118 r248818 44 44 .navigation-bar .item.button.text-only { 45 45 padding: 1px 8px 3px; 46 margin: 0 2px; 46 margin: 0 2px; /* WI.ButtonNavigationItem.prototype.get totalMargin */ 47 47 48 48 height: initial; -
trunk/Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.js
r229543 r248818 126 126 // Protected 127 127 128 get totalMargin() 129 { 130 let totalMargin = super.totalMargin; 131 if (this._buttonStyle === ButtonNavigationItem.Style.Text) 132 return totalMargin + 4; /* .navigation-bar .item.button.text-only */ 133 return totalMargin; 134 } 135 128 136 get additionalClassNames() 129 137 { -
trunk/Source/WebInspectorUI/UserInterface/Views/FlexibleSpaceNavigationItem.js
r222868 r248818 47 47 } 48 48 49 update Layout(expandOnly)49 update(options = {}) 50 50 { 51 super.update Layout(expandOnly);51 super.update(options); 52 52 53 53 if (!this._navigationItem) 54 54 return; 55 55 56 if (expandOnly) { 57 let flexibleWidth = this.width; 58 if (!flexibleWidth) 59 return; 56 if (!options.expandOnly) 57 return; 60 58 61 this.element.appendChild(this._navigationItem.element); 59 let flexibleWidth = this.width; 60 if (!flexibleWidth) 61 return; 62 62 63 this._navigationItem.updateLayout(true); 64 let itemWidth = this._navigationItem.width; 63 this.element.appendChild(this._navigationItem.element); 65 64 66 let remainingWidth = flexibleWidth - itemWidth; 67 if (remainingWidth <= 0) 68 this.element.removeChild(this._navigationItem.element); 69 } 65 this._navigationItem.update(options); 66 let itemWidth = this._navigationItem.width; 67 68 let remainingWidth = flexibleWidth - itemWidth; 69 if (remainingWidth <= 0) 70 this.element.removeChild(this._navigationItem.element); 70 71 } 71 72 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/GroupNavigationItem.js
r223308 r248818 68 68 // Protected 69 69 70 update Layout(expandOnly)70 update(options = {}) 71 71 { 72 super.update Layout(expandOnly);72 super.update(options); 73 73 74 74 for (let item of this._navigationItems) 75 item.update Layout(expandOnly);75 item.update(options); 76 76 } 77 77 -
trunk/Source/WebInspectorUI/UserInterface/Views/HierarchicalPathNavigationItem.js
r229543 r248818 100 100 } 101 101 102 update Layout(expandOnly)102 update(options = {}) 103 103 { 104 104 this._updateComponentsIfNeeded(); 105 105 106 super.update Layout(expandOnly);106 super.update(options); 107 107 108 108 var navigationBar = this.parentNavigationBar; … … 122 122 } 123 123 124 if ( expandOnly)124 if (options.expandOnly) 125 125 return; 126 126 -
trunk/Source/WebInspectorUI/UserInterface/Views/NavigationBar.css
r227707 r248818 41 41 } 42 42 43 .navigation-bar .item, 44 .sidebar-navigation-bar > .holder .item { 43 .navigation-bar .item { 45 44 display: flex; 46 45 align-items: center; … … 54 53 display: none; 55 54 } 56 57 .sidebar-navigation-bar {58 display: block;59 text-align: center;60 height: var(--navigation-bar-height);61 border-bottom: 1px solid var(--border-color);62 }63 64 .sidebar-navigation-bar .holder {65 display: inline-flex;66 align-items: center;67 height: var(--navigation-bar-height);68 padding: 0 2px;69 border-bottom: none;70 } -
trunk/Source/WebInspectorUI/UserInterface/Views/NavigationBar.js
r244264 r248818 46 46 this._mouseUpEventListener = this._mouseUp.bind(this); 47 47 48 this._forceLayout = false;49 48 this._minimumWidth = NaN; 50 49 this._navigationItems = []; … … 202 201 } 203 202 204 needsLayout()205 {206 this._forceLayout = true;207 208 super.needsLayout();209 }210 211 sizeDidChange()212 {213 super.sizeDidChange();214 215 this._updateContent();216 }217 218 203 layout() 219 204 { 220 205 super.layout(); 221 206 222 if (!this._forceLayout) 223 return; 224 225 this._updateContent(); 226 } 227 228 // Private 229 230 _updateContent() 231 { 232 this._forceLayout = false; 207 this._minimumWidth = NaN; 233 208 234 209 // Remove the collapsed style class to test if the items can fit at full width. … … 247 222 for (let item of this._navigationItems) { 248 223 forceItemHidden(item, false); 249 item.update Layout(true);224 item.update({expandOnly: true}); 250 225 } 251 226 … … 269 244 // Give each navigation item the opportunity to collapse further. 270 245 for (let item of visibleNavigationItems) 271 item.update Layout(false);246 item.update(); 272 247 273 248 totalItemWidth = calculateVisibleItemWidth(); 274 249 275 250 if (totalItemWidth > barWidth) { 251 if (this.parentView instanceof WI.Sidebar) { 252 this.parentView.width = this.minimumWidth; 253 return; 254 } 255 276 256 // Hide visible items, starting with the lowest priority item, until 277 257 // the bar fits the available width. … … 302 282 } 303 283 284 // Private 285 304 286 _mouseDown(event) 305 287 { -
trunk/Source/WebInspectorUI/UserInterface/Views/NavigationItem.js
r225250 r248818 57 57 { 58 58 if (isNaN(this._cachedWidth)) 59 this._cachedWidth = this._element.realOffsetWidth ;59 this._cachedWidth = this._element.realOffsetWidth + this.totalMargin; 60 60 return this._cachedWidth; 61 61 } … … 64 64 set visibilityPriority(priority) { this._visibilityPriority = priority; } 65 65 66 update Layout(expandOnly)66 update(options = {}) 67 67 { 68 68 // Implemented by subclasses. … … 101 101 // Protected 102 102 103 get totalMargin() 104 { 105 // Implemented by subclasses if needed. 106 return 0; 107 } 108 103 109 didAttach(navigationBar) 104 110 { -
trunk/Source/WebInspectorUI/UserInterface/Views/RadioButtonNavigationItem.js
r221338 r248818 61 61 } 62 62 63 update Layout(expandOnly)63 update(options = {}) 64 64 { 65 super.update Layout(expandOnly);65 super.update(options); 66 66 67 if ( expandOnly)67 if (options.expandOnly) 68 68 return; 69 69 -
trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js
r244268 r248818 43 43 this.element.classList.add("has-navigation-bar"); 44 44 45 this._navigationBar = new WI. SidebarNavigationBar(null, null, "tablist");45 this._navigationBar = new WI.NavigationBar(null, null, "tablist"); 46 46 this._navigationBar.addEventListener(WI.NavigationBar.Event.NavigationItemSelected, this._navigationItemSelected, this); 47 47 this.addSubview(this._navigationBar); … … 275 275 276 276 if (this._navigationBar) 277 this._navigationBar.updateLayout IfNeeded(WI.View.LayoutReason.Resize);277 this._navigationBar.updateLayout(WI.View.LayoutReason.Resize); 278 278 279 279 if (this._selectedSidebarPanel) 280 this._selectedSidebarPanel.updateLayout IfNeeded(WI.View.LayoutReason.Resize);280 this._selectedSidebarPanel.updateLayout(WI.View.LayoutReason.Resize); 281 281 282 282 this.dispatchEventToListeners(WI.Sidebar.Event.WidthDidChange, {newWidth}); -
trunk/Source/WebInspectorUI/UserInterface/Views/TextNavigationItem.css
r201177 r248818 27 27 width: auto; 28 28 padding: 1px 8px 3px; 29 margin: 0 2px; 29 margin: 0 2px; /* WI.TextNavigationItem.prototype.get totalMargin */ 30 30 31 31 line-height: 11px; -
trunk/Source/WebInspectorUI/UserInterface/Views/TextNavigationItem.js
r220119 r248818 47 47 this._element.textContent = x || ""; 48 48 } 49 50 // Protected 51 52 get totalMargin() 53 { 54 return super.totalMargin + 4; /* .navigation-bar .item.text */ 55 } 49 56 };
Note: See TracChangeset
for help on using the changeset viewer.