Title: [221713] trunk/Source/WebInspectorUI
Revision
221713
Author
mattba...@apple.com
Date
2017-09-06 20:29:21 -0700 (Wed, 06 Sep 2017)

Log Message

Web Inspector: Relax the maximum sidebar width
https://bugs.webkit.org/show_bug.cgi?id=175808
<rdar://problem/34005339>

Reviewed by Devin Rousso.

This patch introduces a constant, `minimumContentBrowserWidth`, which
constrains the maximum width of either sidebar:

maxSidebarWidth = window.innerWidth - minimumContentBrowserWidth - otherSidebarWidth

A value of 100px for `minimumContentBrowserWidth` leaves enough space for
three NavigationItems at their minimum width (32px), with a few pixels
left over for good measure. For most tabs this will ensure that the buttons
for showing the sidebars will be visible, along with an addition button.

* UserInterface/Base/Main.js:
* UserInterface/Views/Sidebar.js:
(WI.Sidebar.prototype.get maximumWidth):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (221712 => 221713)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-09-07 02:32:57 UTC (rev 221712)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-09-07 03:29:21 UTC (rev 221713)
@@ -1,3 +1,25 @@
+2017-09-06  Matt Baker  <mattba...@apple.com>
+
+        Web Inspector: Relax the maximum sidebar width
+        https://bugs.webkit.org/show_bug.cgi?id=175808
+        <rdar://problem/34005339>
+
+        Reviewed by Devin Rousso.
+
+        This patch introduces a constant, `minimumContentBrowserWidth`, which
+        constrains the maximum width of either sidebar:
+
+        maxSidebarWidth = window.innerWidth - minimumContentBrowserWidth - otherSidebarWidth
+
+        A value of 100px for `minimumContentBrowserWidth` leaves enough space for
+        three NavigationItems at their minimum width (32px), with a few pixels
+        left over for good measure. For most tabs this will ensure that the buttons
+        for showing the sidebars will be visible, along with an addition button.
+
+        * UserInterface/Base/Main.js:
+        * UserInterface/Views/Sidebar.js:
+        (WI.Sidebar.prototype.get maximumWidth):
+
 2017-09-06  Devin Rousso  <web...@devinrousso.com>
 
         Web Inspector: Support overloaded CanvasRenderingContext2D actions with identical parameter counts

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (221712 => 221713)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2017-09-07 02:32:57 UTC (rev 221712)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2017-09-07 03:29:21 UTC (rev 221713)
@@ -1054,6 +1054,30 @@
     this.detailsSidebar.collapsed = false;
 };
 
+WI.getMaximumSidebarWidth = function(sidebar)
+{
+    console.assert(sidebar instanceof WI.Sidebar);
+
+    const minimumContentBrowserWidth = 100;
+
+    let minimumWidth = window.innerWidth - minimumContentBrowserWidth;
+    let tabContentView = this.tabBrowser.selectedTabContentView;
+    console.assert(tabContentView);
+    if (!tabContentView)
+        return minimumWidth;
+
+    let otherSidebar = null;
+    if (sidebar === this.navigationSidebar)
+        otherSidebar = tabContentView.detailsSidebarPanels.length ? this.detailsSidebar : null;
+    else
+        otherSidebar = tabContentView.navigationSidebarPanel ? this.navigationSidebar : null;
+
+    if (otherSidebar)
+        minimumWidth -= otherSidebar.width;
+
+    return minimumWidth;
+};
+
 WI.tabContentViewClassForRepresentedObject = function(representedObject)
 {
     if (representedObject instanceof WI.DOMTree)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js (221712 => 221713)


--- trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js	2017-09-07 02:32:57 UTC (rev 221712)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js	2017-09-07 03:29:21 UTC (rev 221713)
@@ -168,9 +168,7 @@
 
     get maximumWidth()
     {
-        // FIXME: This is kind of arbitrary and ideally would be a more complex calculation based on the
-        // available space for the sibling elements.
-        return Math.round(window.innerWidth / 3);
+        return WI.getMaximumSidebarWidth(this);
     }
 
     get width()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to