Title: [285974] trunk/Source/WebInspectorUI
Revision
285974
Author
[email protected]
Date
2021-11-17 19:28:23 -0800 (Wed, 17 Nov 2021)

Log Message

Web Inspector: allow left docking when in LTR and right docking when in RTL
https://bugs.webkit.org/show_bug.cgi?id=233294

Reviewed by Patrick Angle.

Some developers prefer docking to the left even when in LTR and/or docking to the right when
in RTL. There's no technical reason to disallow this, so let's make it possible.

* UserInterface/Base/Main.js:
(WI.contentLoaded):
(WI.contentLoaded.addDockButton): Added.
(WI.contentLoaded.addDockLeftButton): Added.
(WI.contentLoaded.addDockRightButton): Added.
(WI._updateDockNavigationItems):
(WI._updateTabBarDividers):
(WI.setLayoutDirection):
Instead of having a single `_dockToSideTabBarButton` that looks at the layout direction to
decide its image, tooltip, and action, split it into two distinct `_dockLeftTabBarButton`
and `_dockRightTabBarButton` buttons that are both always visible (unless Web Inspector is
already in the corresponding docking state).

* UserInterface/Images/DockBottom.svg:
* UserInterface/Images/DockLeft.svg:
* UserInterface/Images/DockRight.svg:
Fill in the area representing Web Inspector and make it a bit smaller so it's not as heavy.

* Localizations/en.lproj/localizedStrings.js:

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (285973 => 285974)


--- trunk/Source/WebInspectorUI/ChangeLog	2021-11-18 03:13:16 UTC (rev 285973)
+++ trunk/Source/WebInspectorUI/ChangeLog	2021-11-18 03:28:23 UTC (rev 285974)
@@ -1,3 +1,33 @@
+2021-11-17  Devin Rousso  <[email protected]>
+
+        Web Inspector: allow left docking when in LTR and right docking when in RTL
+        https://bugs.webkit.org/show_bug.cgi?id=233294
+
+        Reviewed by Patrick Angle.
+
+        Some developers prefer docking to the left even when in LTR and/or docking to the right when
+        in RTL. There's no technical reason to disallow this, so let's make it possible.
+
+        * UserInterface/Base/Main.js:
+        (WI.contentLoaded):
+        (WI.contentLoaded.addDockButton): Added.
+        (WI.contentLoaded.addDockLeftButton): Added.
+        (WI.contentLoaded.addDockRightButton): Added.
+        (WI._updateDockNavigationItems):
+        (WI._updateTabBarDividers):
+        (WI.setLayoutDirection):
+        Instead of having a single `_dockToSideTabBarButton` that looks at the layout direction to
+        decide its image, tooltip, and action, split it into two distinct `_dockLeftTabBarButton`
+        and `_dockRightTabBarButton` buttons that are both always visible (unless Web Inspector is
+        already in the corresponding docking state).
+
+        * UserInterface/Images/DockBottom.svg:
+        * UserInterface/Images/DockLeft.svg:
+        * UserInterface/Images/DockRight.svg:
+        Fill in the area representing Web Inspector and make it a bit smaller so it's not as heavy.
+
+        * Localizations/en.lproj/localizedStrings.js:
+
 2021-11-16  Nikita Vasilyev  <[email protected]>
 
         Web Inspector: Remove unused `dontCreateIfMissing` argument from CSSStyleDeclaration.prototype.propertyForName

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (285973 => 285974)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2021-11-18 03:13:16 UTC (rev 285973)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2021-11-18 03:28:23 UTC (rev 285974)
@@ -498,7 +498,8 @@
 localizedStrings["Do not clear the console on new page loads"] = "Do not clear the console on new page loads";
 localizedStrings["Do not fade unexecuted code"] = "Do not fade unexecuted code";
 localizedStrings["Dock to bottom of window"] = "Dock to bottom of window";
-localizedStrings["Dock to side of window"] = "Dock to side of window";
+localizedStrings["Dock to left of window"] = "Dock to left of window";
+localizedStrings["Dock to right of window"] = "Dock to right of window";
 localizedStrings["Document"] = "Document";
 localizedStrings["Document Fragment"] = "Document Fragment";
 localizedStrings["Document Type"] = "Document Type";

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (285973 => 285974)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2021-11-18 03:13:16 UTC (rev 285973)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2021-11-18 03:28:23 UTC (rev 285974)
@@ -353,33 +353,47 @@
     let supportsDockBottom = InspectorFrontendHost.supportsDockSide(WI.DockConfiguration.Bottom);
     let supportsUndocked = InspectorFrontendHost.supportsDockSide(WI.DockConfiguration.Undocked);
 
-    if (supportsDockRight || supportsDockLeft || supportsDockBottom) {
-        WI._closeTabBarButton = new WI.ButtonNavigationItem("dock-close", WI.UIString("Close"), "Images/CloseLarge.svg");
-        WI._closeTabBarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI.close, WI);
-        dockingConfigurationNavigationItems.push(WI._closeTabBarButton);
+    function addDockButton(identifier, tooltip, image, handler) {
+        let button = new WI.ButtonNavigationItem(identifier, tooltip, image);
+        button.element.classList.add(WI.Popover.IgnoreAutoDismissClassName);
+        button.addEventListener(WI.ButtonNavigationItem.Event.Clicked, handler, WI);
+        dockingConfigurationNavigationItems.push(button);
+        return button;
     }
 
-    if ((supportsDockRight || supportsDockLeft) && (supportsDockBottom || supportsUndocked)) {
-        WI._dockToSideTabBarButton = new WI.ButtonNavigationItem("dock-right", WI.UIString("Dock to side of window"), WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "Images/DockLeft.svg" : "Images/DockRight.svg", 16, 16);
-        WI._dockToSideTabBarButton.element.classList.add(WI.Popover.IgnoreAutoDismissClassName);
-        WI._dockToSideTabBarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? WI._dockLeft : WI._dockRight, WI);
-        dockingConfigurationNavigationItems.push(WI._dockToSideTabBarButton);
-    }
+    function addDockLeftButton() {
+        if (!supportsDockLeft || (!supportsDockRight && !supportsDockBottom && !supportsUndocked))
+            return;
 
-    if (supportsDockBottom && (supportsDockRight || supportsDockLeft || supportsUndocked)) {
-        WI._dockBottomTabBarButton = new WI.ButtonNavigationItem("dock-bottom", WI.UIString("Dock to bottom of window"), "Images/DockBottom.svg", 16, 16);
-        WI._dockBottomTabBarButton.element.classList.add(WI.Popover.IgnoreAutoDismissClassName);
-        WI._dockBottomTabBarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI._dockBottom, WI);
-        dockingConfigurationNavigationItems.push(WI._dockBottomTabBarButton);
+        WI._dockLeftTabBarButton = addDockButton("dock-left", WI.UIString("Dock to left of window"), "Images/DockLeft.svg", WI._dockLeft);
     }
 
-    if (supportsUndocked && (supportsDockRight || supportsDockLeft || supportsDockBottom)) {
-        WI._undockTabBarButton = new WI.ButtonNavigationItem("undock", WI.UIString("Detach into separate window"), "Images/Undock.svg", 16, 16);
-        WI._undockTabBarButton.element.classList.add(WI.Popover.IgnoreAutoDismissClassName);
-        WI._undockTabBarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI._undock, WI);
-        dockingConfigurationNavigationItems.push(WI._undockTabBarButton);
+    function addDockRightButton() {
+        if (!supportsDockRight || (!supportsDockLeft && !supportsDockBottom && !supportsUndocked))
+            return;
+
+        WI._dockRightTabBarButton = addDockButton("dock-right", WI.UIString("Dock to right of window"), "Images/DockRight.svg", WI._dockRight);
     }
 
+    if (supportsDockRight || supportsDockLeft || supportsDockBottom)
+        WI._closeTabBarButton = addDockButton("dock-close", WI.UIString("Close"), "Images/CloseLarge.svg", WI.close);
+
+    if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL)
+        addDockRightButton();
+    else
+        addDockLeftButton();
+
+    if (supportsDockBottom && (supportsDockRight || supportsDockLeft || supportsUndocked))
+        WI._dockBottomTabBarButton = addDockButton("dock-bottom", WI.UIString("Dock to bottom of window"), "Images/DockBottom.svg", WI._dockBottom);
+
+    if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL)
+        addDockLeftButton();
+    else
+        addDockRightButton();
+
+    if (supportsUndocked && (supportsDockRight || supportsDockLeft || supportsDockBottom))
+        WI._undockTabBarButton = addDockButton("undock", WI.UIString("Detach into separate window"), "Images/Undock.svg", WI._undock);
+
     let inspectedPageControlNavigationItems = [];
 
     let elementSelectionToolTip = WI.UIString("Start element selection (%s)").format(WI._inspectModeKeyboardShortcut.displayName);
@@ -1896,19 +1910,23 @@
     if (WI._dockingAvailable || docked) {
         if (WI._closeTabBarButton)
             WI._closeTabBarButton.hidden = !docked;
-        if (WI._dockToSideTabBarButton)
-            WI._dockToSideTabBarButton.hidden = WI.dockConfiguration === WI.DockConfiguration.Right || WI.dockConfiguration === WI.DockConfiguration.Left;
+        if (WI._dockLeftTabBarButton)
+            WI._dockLeftTabBarButton.hidden = WI.dockConfiguration === WI.DockConfiguration.Left;
         if (WI._dockBottomTabBarButton)
             WI._dockBottomTabBarButton.hidden = WI.dockConfiguration === WI.DockConfiguration.Bottom;
+        if (WI._dockRightTabBarButton)
+            WI._dockRightTabBarButton.hidden = WI.dockConfiguration === WI.DockConfiguration.Right;
         if (WI._undockTabBarButton)
             WI._undockTabBarButton.hidden = WI.dockConfiguration === WI.DockConfiguration.Undocked;
     } else {
         if (WI._closeTabBarButton)
             WI._closeTabBarButton.hidden = true;
-        if (WI._dockToSideTabBarButton)
-            WI._dockToSideTabBarButton.hidden = true;
+        if (WI._dockLeftTabBarButton)
+            WI._dockLeftTabBarButton.hidden = true;
         if (WI._dockBottomTabBarButton)
             WI._dockBottomTabBarButton.hidden = true;
+        if (WI._dockRightTabBarButton)
+            WI._dockRightTabBarButton.hidden = true;
         if (WI._undockTabBarButton)
             WI._undockTabBarButton.hidden = true;
     }
@@ -2502,8 +2520,9 @@
     }
 
     let closeHidden = isHidden(WI._closeTabBarButton);
-    let dockToSideHidden = isHidden(WI._dockToSideTabBarButton);
+    let dockLeftHidden = isHidden(WI._dockLeftTabBarButton);
     let dockBottomHidden = isHidden(WI._dockBottomTabBarButton);
+    let dockRightHidden = isHidden(WI._dockRightTabBarButton);
     let undockHidden = isHidden(WI._undockTabBarButton);
 
     let inspectModeHidden = isHidden(WI._inspectModeTabBarButton);
@@ -2515,7 +2534,7 @@
     let errorsHidden = WI._consoleErrorsTabBarButton.hidden;
 
     // Hide the divider if everything to the left is hidden OR if everything to the right is hidden.
-    WI._consoleDividerNavigationItem.hidden = (closeHidden && dockToSideHidden && dockBottomHidden && undockHidden && inspectModeHidden && deviceSettingsHidden && reloadHidden && downloadHidden) || (warningsHidden && errorsHidden);
+    WI._consoleDividerNavigationItem.hidden = (closeHidden && dockLeftHidden && dockBottomHidden && dockRightHidden && undockHidden && inspectModeHidden && deviceSettingsHidden && reloadHidden && downloadHidden) || (warningsHidden && errorsHidden);
 
     WI.tabBar.needsLayout();
 };
@@ -2900,12 +2919,6 @@
 
     WI.settings.debugLayoutDirection.value = value;
 
-    if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL && WI.dockConfiguration === WI.DockConfiguration.Right)
-        WI._dockLeft();
-
-    if (WI.resolvedLayoutDirection() === WI.LayoutDirection.LTR && WI.dockConfiguration === WI.DockConfiguration.Left)
-        WI._dockRight();
-
     InspectorFrontendHost.reopen();
 };
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Images/DockBottom.svg (285973 => 285974)


--- trunk/Source/WebInspectorUI/UserInterface/Images/DockBottom.svg	2021-11-18 03:13:16 UTC (rev 285973)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/DockBottom.svg	2021-11-18 03:28:23 UTC (rev 285974)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright © 2015 Apple Inc. All rights reserved. -->
+<!-- Copyright © 2021 Apple Inc. All rights reserved. -->
 <svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" viewBox="0 0 16 16">
-    <rect fill="none" stroke="currentColor" x="0.5" y="1.5" width="15" height="13"/>
-    <path fill="none" stroke="currentColor" d="M 1 9.5 L 15 9.5 L 1 9.5 Z"/>
+    <rect fill="none" stroke="currentColor" x="0.5" y="1.5" width="15" height="9"/>
+    <rect fill="currentColor" stroke="currentColor" x="0.5" y="10.5" width="15" height="4"/>
 </svg>

Modified: trunk/Source/WebInspectorUI/UserInterface/Images/DockLeft.svg (285973 => 285974)


--- trunk/Source/WebInspectorUI/UserInterface/Images/DockLeft.svg	2021-11-18 03:13:16 UTC (rev 285973)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/DockLeft.svg	2021-11-18 03:28:23 UTC (rev 285974)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright © 2017 Apple Inc. All rights reserved. -->
+<!-- Copyright © 2021 Apple Inc. All rights reserved. -->
 <svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" viewBox="0 0 16 16">
-    <rect fill="none" stroke="currentColor" x="0.5" y="1.5" width="15" height="13"/>
-    <path fill="none" stroke="currentColor" d="M 6.5 2 L 6.5 14 L 6.5 2 Z"/>
+    <rect fill="currentColor" stroke="currentColor" x="0.5" y="1.5" width="4" height="13"/>
+    <rect fill="none" stroke="currentColor" x="4.5" y="1.5" width="11" height="13"/>
 </svg>

Modified: trunk/Source/WebInspectorUI/UserInterface/Images/DockRight.svg (285973 => 285974)


--- trunk/Source/WebInspectorUI/UserInterface/Images/DockRight.svg	2021-11-18 03:13:16 UTC (rev 285973)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/DockRight.svg	2021-11-18 03:28:23 UTC (rev 285974)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright © 2015 Apple Inc. All rights reserved. -->
+<!-- Copyright © 2021 Apple Inc. All rights reserved. -->
 <svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" viewBox="0 0 16 16">
-    <rect fill="none" stroke="currentColor" x="0.5" y="1.5" width="15" height="13"/>
-    <path fill="none" stroke="currentColor" d="M 9.5 2 L 9.5 14 L 9.5 2 Z"/>
-</svg>
+    <rect fill="none" stroke="currentColor" x="0.5" y="1.5" width="11" height="13"/>
+    <rect fill="currentColor" stroke="currentColor" x="11.5" y="1.5" width="4" height="13"/>
+</svg>
\ No newline at end of file
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to