Changeset 258898 in webkit


Ignore:
Timestamp:
Mar 23, 2020 7:22:49 PM (4 years ago)
Author:
Devin Rousso
Message:

REGRESSION(r257759, r258623): Web Inspector: Settings icon sometimes placed below the tab bar
https://bugs.webkit.org/show_bug.cgi?id=208603
<rdar://problem/60108967>

Reviewed by Timothy Hatcher.

  • UserInterface/Views/TabBar.js:

(WI.TabBar.prototype.layout):
If the total width of all WI.GeneralTabBarItem is not an integer, it needs to be rounded
when compared to the width of the container WI.TabBar. This is be necessary because CSS
often rounds to the nearest pixel, meaning that 99.5px would actually render as 100px,
whereas 99.4px would render as 99px.

  • UserInterface/Views/TabBar.css:

(body:not(.docked) .tab-bar > .tabs:not(.calculate-width) > .item:not(.pinned)): Added.
(.tab-bar > .tabs.calculate-width > .item:not(.pinned)): Added.
(body:not(.docked) .tab-bar > .tabs > .item:not(.pinned)): Deleted.
(.tab-bar > .tabs.calculate-width > .item): Deleted.
When undocked, force all WI.GeneralTabBarItem to take up as little width as possible when
resizing so that if there isn't enough room for all of them, any that flex-wrap won't be
incorrectly perceived as needing a much larger width.

  • UserInterface/Debug/Bootstrap.css:

(.tab-bar > .navigation-bar .inspect-inspector):
Ensure that the "inspect inspector" navigation item has an integer pixel width.

Location:
trunk/Source/WebInspectorUI
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r258848 r258898  
     12020-03-23  Devin Rousso  <drousso@apple.com>
     2
     3        REGRESSION(r257759, r258623): Web Inspector: Settings icon sometimes placed below the tab bar
     4        https://bugs.webkit.org/show_bug.cgi?id=208603
     5        <rdar://problem/60108967>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * UserInterface/Views/TabBar.js:
     10        (WI.TabBar.prototype.layout):
     11        If the total width of all `WI.GeneralTabBarItem` is not an integer, it needs to be rounded
     12        when compared to the width of the container `WI.TabBar`. This is be necessary because CSS
     13        often rounds to the nearest pixel, meaning that `99.5px` would actually render as `100px`,
     14        whereas `99.4px` would render as `99px`.
     15
     16        * UserInterface/Views/TabBar.css:
     17        (body:not(.docked) .tab-bar > .tabs:not(.calculate-width) > .item:not(.pinned)): Added.
     18        (.tab-bar > .tabs.calculate-width > .item:not(.pinned)): Added.
     19        (body:not(.docked) .tab-bar > .tabs > .item:not(.pinned)): Deleted.
     20        (.tab-bar > .tabs.calculate-width > .item): Deleted.
     21        When undocked, force all `WI.GeneralTabBarItem` to take up as little width as possible when
     22        resizing so that if there isn't enough room for all of them, any that `flex-wrap` won't be
     23        incorrectly perceived as needing a much larger width.
     24
     25        * UserInterface/Debug/Bootstrap.css:
     26        (.tab-bar > .navigation-bar .inspect-inspector):
     27        Ensure that the "inspect inspector" navigation item has an integer pixel width.
     28
    1292020-03-23  Devin Rousso  <drousso@apple.com>
    230
  • trunk/Source/WebInspectorUI/UserInterface/Debug/Bootstrap.css

    r257401 r258898  
    2828    outline-offset: -1px !important;
    2929}
     30
     31.tab-bar > .navigation-bar .inspect-inspector {
     32    width: 1em !important;
     33}
  • trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.css

    r258809 r258898  
    160160}
    161161
    162 body:not(.docked) .tab-bar > .tabs > .item:not(.pinned) {
     162body:not(.docked) .tab-bar > .tabs:not(.calculate-width) > .item:not(.pinned) {
    163163    flex-grow: 1;
    164164}
     
    171171}
    172172
    173 .tab-bar > .tabs.calculate-width > .item {
     173.tab-bar > .tabs.calculate-width > .item:not(.pinned) {
    174174    flex: initial;
    175175}
  • trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js

    r258778 r258898  
    450450        }
    451451
    452         // Add one to allow for possible sub-px widths.
    453         let availableSpace = this._tabContainer.realOffsetWidth - tabBarHorizontalPadding + 1;
     452        let availableSpace = this._tabContainer.realOffsetWidth - tabBarHorizontalPadding;
    454453
    455454        this._tabContainer.classList.add("calculate-width");
     
    481480        // Wait to measure widths until all `WI.TabBarItem` are un-hidden for the reason above.
    482481        let normalTabBarItemsWidth = normalTabBarItems.reduce((accumulator, tabBarItem) => accumulator + measureWidth(tabBarItem), 0);
    483         if (normalTabBarItemsWidth > availableSpace) {
     482        if (Math.round(normalTabBarItemsWidth) >= Math.floor(availableSpace)) {
    484483            this._tabPickerTabBarItem.hidden = false;
    485484            availableSpace -= measureWidth(this._tabPickerTabBarItem);
     
    495494                tabBarItem.hidden = true;
    496495                this._hiddenTabBarItems.push(tabBarItem);
    497             } while (normalTabBarItemsWidth > availableSpace && --index >= 0);
    498         }
     496            } while (normalTabBarItemsWidth >= availableSpace && --index >= 0);
     497        }
     498
     499        // Tabs are marked as hidden from right to left, meaning that the right-most item will be
     500        // first in the list. Reverse the list so that the right-most item is last.
     501        this._hiddenTabBarItems.reverse();
    499502
    500503        this._tabContainer.classList.remove("calculate-width");
Note: See TracChangeset for help on using the changeset viewer.