Title: [274465] trunk/Source/WebInspectorUI
- Revision
- 274465
- Author
- pan...@apple.com
- Date
- 2021-03-15 22:08:03 -0700 (Mon, 15 Mar 2021)
Log Message
Web Inspector: `Styles` sidebar pseudo-class checkboxes appear cramped after resizing window at narrow widths
https://bugs.webkit.org/show_bug.cgi?id=222990
Reviewed by Devin Rousso.
Fixed two compounding bugs that meant that a sidebar could end up using the base minimum width of 250px
instead of the actual minimum width as reported by the selected panel.
* UserInterface/Views/MultiSidebar.js:
(WI.MultiSidebar.prototype.didInsertSidebarPanel):
(WI.MultiSidebar.prototype.didRemoveSidebarPanel):
(WI.MultiSidebar.prototype.didSetCollapsed):
- Drive-by: Remove unused (and always undefined) `flag` argument.
(WI.MultiSidebar.prototype._updateMinimumWidthForMultipleSidebars):
- Add logic to make sure we can calculate a valid `_minimumWidthForMultipleSidebars`, and add a mechanism to
allow ignoring the presence of a cached value to force a recalculation.
(WI.MultiSidebar.prototype.get _hasWidthForMultipleSidebars):
- Ensure if possible that there is a valid `_minimumWidthForMultipleSidebars`.
(WI.MultiSidebar.prototype._makeSidebarPanelExclusive):
- Sets the sidebar as non-collapsible (which sets `collapsed` to `false`) before adding the panel and setting it
as the selected panel so that we don't set the selected panel on a collapsed sidebar.
* UserInterface/Views/SingleSidebar.js:
(WI.SingleSidebar.prototype.didSetCollapsed):
- Drive-by: Remove always undefined `flag` argument, use `this.collapsed` instead.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (274464 => 274465)
--- trunk/Source/WebInspectorUI/ChangeLog 2021-03-16 04:33:30 UTC (rev 274464)
+++ trunk/Source/WebInspectorUI/ChangeLog 2021-03-16 05:08:03 UTC (rev 274465)
@@ -1,3 +1,30 @@
+2021-03-15 Patrick Angle <pan...@apple.com>
+
+ Web Inspector: `Styles` sidebar pseudo-class checkboxes appear cramped after resizing window at narrow widths
+ https://bugs.webkit.org/show_bug.cgi?id=222990
+
+ Reviewed by Devin Rousso.
+
+ Fixed two compounding bugs that meant that a sidebar could end up using the base minimum width of 250px
+ instead of the actual minimum width as reported by the selected panel.
+
+ * UserInterface/Views/MultiSidebar.js:
+ (WI.MultiSidebar.prototype.didInsertSidebarPanel):
+ (WI.MultiSidebar.prototype.didRemoveSidebarPanel):
+ (WI.MultiSidebar.prototype.didSetCollapsed):
+ - Drive-by: Remove unused (and always undefined) `flag` argument.
+ (WI.MultiSidebar.prototype._updateMinimumWidthForMultipleSidebars):
+ - Add logic to make sure we can calculate a valid `_minimumWidthForMultipleSidebars`, and add a mechanism to
+ allow ignoring the presence of a cached value to force a recalculation.
+ (WI.MultiSidebar.prototype.get _hasWidthForMultipleSidebars):
+ - Ensure if possible that there is a valid `_minimumWidthForMultipleSidebars`.
+ (WI.MultiSidebar.prototype._makeSidebarPanelExclusive):
+ - Sets the sidebar as non-collapsible (which sets `collapsed` to `false`) before adding the panel and setting it
+ as the selected panel so that we don't set the selected panel on a collapsed sidebar.
+ * UserInterface/Views/SingleSidebar.js:
+ (WI.SingleSidebar.prototype.didSetCollapsed):
+ - Drive-by: Remove always undefined `flag` argument, use `this.collapsed` instead.
+
2021-03-11 Devin Rousso <drou...@apple.com>
Web Inspector: `WI.Object.singleFireEventListener` should not keep a strong reference to `thisObject`
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/MultiSidebar.js (274464 => 274465)
--- trunk/Source/WebInspectorUI/UserInterface/Views/MultiSidebar.js 2021-03-16 04:33:30 UTC (rev 274464)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/MultiSidebar.js 2021-03-16 05:08:03 UTC (rev 274465)
@@ -154,7 +154,7 @@
didInsertSidebarPanel(sidebarPanel, index)
{
- this._updateMinimumWidthForMultipleSidebars();
+ this._updateMinimumWidthForMultipleSidebars({ignoreExistingComputedValue: true});
this._updateMultipleSidebarLayout();
}
@@ -167,13 +167,15 @@
this.removeSidebar(sidebar);
}
- this._updateMinimumWidthForMultipleSidebars();
+ this._updateMinimumWidthForMultipleSidebars({ignoreExistingComputedValue: true});
this._updateMultipleSidebarLayout();
}
- didSetCollapsed(flag)
+ didSetCollapsed()
{
this.primarySidebar.collapsed = this.collapsed;
+
+ this._updateMinimumWidthForMultipleSidebars({ignoreExistingComputedValue: true});
this._updateMultipleSidebarLayout();
}
@@ -184,8 +186,14 @@
return this._allowMultipleSidebars && this._multipleSidebarsVisible && this._hasSidebarPanelSupportingExclusive && this.sidebarPanels.length >= 2;
}
- _updateMinimumWidthForMultipleSidebars()
+ _updateMinimumWidthForMultipleSidebars({ignoreExistingComputedValue} = {})
{
+ if (!ignoreExistingComputedValue && this._requiredMinimumWidthForMultipleSidebars)
+ return;
+
+ if (this.collapsed || !this.isAttached)
+ return;
+
// A 50px of additional required space helps make sure we collapse the multiple sidebars at an appropriate width
// without preventing the user from sizing the single sidebar to fill up to the minimum width of the
// #tab-browser once the sidebars are collapsed.
@@ -203,6 +211,7 @@
get _hasWidthForMultipleSidebars()
{
+ this._updateMinimumWidthForMultipleSidebars();
return this._requiredMinimumWidthForMultipleSidebars < this.maximumWidth;
}
@@ -239,11 +248,10 @@
sidebarPanel.exclusive = true;
let sidebar = new WI.SingleSidebar(null, this.side, sidebarPanel.navigationItem.label);
+ sidebar.collapsable = false;
sidebar.addSidebarPanel(sidebarPanel);
- sidebar.collapsable = false;
+ sidebar.selectedSidebarPanel = sidebarPanel;
this.addSidebar(sidebar);
-
- sidebar.selectedSidebarPanel = sidebarPanel;
}
_makeSidebarPanelNotExclusive(sidebarPanel)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SingleSidebar.js (274464 => 274465)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SingleSidebar.js 2021-03-16 04:33:30 UTC (rev 274464)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SingleSidebar.js 2021-03-16 05:08:03 UTC (rev 274465)
@@ -116,7 +116,7 @@
this._navigationBar.selectedNavigationItem = this.selectedSidebarPanel?.navigationItem ?? null;
}
- didSetCollapsed(flag)
+ didSetCollapsed()
{
if (this.selectedSidebarPanel) {
if (this.collapsed) {
@@ -128,7 +128,7 @@
}
}
- if (!flag && this._navigationBar)
+ if (!this.collapsed && this._navigationBar)
this._navigationBar.needsLayout();
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes