Changeset 274465 in webkit


Ignore:
Timestamp:
Mar 15, 2021 10:08:03 PM (16 months ago)
Author:
Patrick Angle
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.
Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r274303 r274465  
     12021-03-15  Patrick Angle  <pangle@apple.com>
     2
     3        Web Inspector: `Styles` sidebar pseudo-class checkboxes appear cramped after resizing window at narrow widths
     4        https://bugs.webkit.org/show_bug.cgi?id=222990
     5
     6        Reviewed by Devin Rousso.
     7
     8        Fixed two compounding bugs that meant that a sidebar could end up using the base minimum width of 250px
     9        instead of the actual minimum width as reported by the selected panel.
     10
     11        * UserInterface/Views/MultiSidebar.js:
     12        (WI.MultiSidebar.prototype.didInsertSidebarPanel):
     13        (WI.MultiSidebar.prototype.didRemoveSidebarPanel):
     14        (WI.MultiSidebar.prototype.didSetCollapsed):
     15        - Drive-by: Remove unused (and always undefined) `flag` argument.
     16        (WI.MultiSidebar.prototype._updateMinimumWidthForMultipleSidebars):
     17        - Add logic to make sure we can calculate a valid `_minimumWidthForMultipleSidebars`, and add a mechanism to
     18        allow ignoring the presence of a cached value to force a recalculation.
     19        (WI.MultiSidebar.prototype.get _hasWidthForMultipleSidebars):
     20        - Ensure if possible that there is a valid `_minimumWidthForMultipleSidebars`.
     21        (WI.MultiSidebar.prototype._makeSidebarPanelExclusive):
     22        - Sets the sidebar as non-collapsible (which sets `collapsed` to `false`) before adding the panel and setting it
     23        as the selected panel so that we don't set the selected panel on a collapsed sidebar.
     24        * UserInterface/Views/SingleSidebar.js:
     25        (WI.SingleSidebar.prototype.didSetCollapsed):
     26        - Drive-by: Remove always undefined `flag` argument, use `this.collapsed` instead.
     27
    1282021-03-11  Devin Rousso  <drousso@apple.com>
    229
  • trunk/Source/WebInspectorUI/UserInterface/Views/MultiSidebar.js

    r268981 r274465  
    155155    didInsertSidebarPanel(sidebarPanel, index)
    156156    {
    157         this._updateMinimumWidthForMultipleSidebars();
     157        this._updateMinimumWidthForMultipleSidebars({ignoreExistingComputedValue: true});
    158158        this._updateMultipleSidebarLayout();
    159159    }
     
    168168        }
    169169
    170         this._updateMinimumWidthForMultipleSidebars();
    171         this._updateMultipleSidebarLayout();
    172     }
    173 
    174     didSetCollapsed(flag)
     170        this._updateMinimumWidthForMultipleSidebars({ignoreExistingComputedValue: true});
     171        this._updateMultipleSidebarLayout();
     172    }
     173
     174    didSetCollapsed()
    175175    {
    176176        this.primarySidebar.collapsed = this.collapsed;
     177
     178        this._updateMinimumWidthForMultipleSidebars({ignoreExistingComputedValue: true});
    177179        this._updateMultipleSidebarLayout();
    178180    }
     
    185187    }
    186188
    187     _updateMinimumWidthForMultipleSidebars()
    188     {
     189    _updateMinimumWidthForMultipleSidebars({ignoreExistingComputedValue} = {})
     190    {
     191        if (!ignoreExistingComputedValue && this._requiredMinimumWidthForMultipleSidebars)
     192            return;
     193
     194        if (this.collapsed || !this.isAttached)
     195            return;
     196
    189197        // A 50px of additional required space helps make sure we collapse the multiple sidebars at an appropriate width
    190198        // without preventing the user from sizing the single sidebar to fill up to the minimum width of the
     
    204212    get _hasWidthForMultipleSidebars()
    205213    {
     214        this._updateMinimumWidthForMultipleSidebars();
    206215        return this._requiredMinimumWidthForMultipleSidebars < this.maximumWidth;
    207216    }
     
    240249
    241250        let sidebar = new WI.SingleSidebar(null, this.side, sidebarPanel.navigationItem.label);
     251        sidebar.collapsable = false;
    242252        sidebar.addSidebarPanel(sidebarPanel);
    243         sidebar.collapsable = false;
     253        sidebar.selectedSidebarPanel = sidebarPanel;
    244254        this.addSidebar(sidebar);
    245 
    246         sidebar.selectedSidebarPanel = sidebarPanel;
    247255    }
    248256
  • trunk/Source/WebInspectorUI/UserInterface/Views/SingleSidebar.js

    r270134 r274465  
    117117    }
    118118
    119     didSetCollapsed(flag)
     119    didSetCollapsed()
    120120    {
    121121        if (this.selectedSidebarPanel) {
     
    129129        }
    130130
    131         if (!flag && this._navigationBar)
     131        if (!this.collapsed && this._navigationBar)
    132132            this._navigationBar.needsLayout();
    133133    }
Note: See TracChangeset for help on using the changeset viewer.