Changeset 285974 in webkit
- Timestamp:
- Nov 17, 2021, 7:28:23 PM (4 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r285896 r285974 1 2021-11-17 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: allow left docking when in LTR and right docking when in RTL 4 https://bugs.webkit.org/show_bug.cgi?id=233294 5 6 Reviewed by Patrick Angle. 7 8 Some developers prefer docking to the left even when in LTR and/or docking to the right when 9 in RTL. There's no technical reason to disallow this, so let's make it possible. 10 11 * UserInterface/Base/Main.js: 12 (WI.contentLoaded): 13 (WI.contentLoaded.addDockButton): Added. 14 (WI.contentLoaded.addDockLeftButton): Added. 15 (WI.contentLoaded.addDockRightButton): Added. 16 (WI._updateDockNavigationItems): 17 (WI._updateTabBarDividers): 18 (WI.setLayoutDirection): 19 Instead of having a single `_dockToSideTabBarButton` that looks at the layout direction to 20 decide its image, tooltip, and action, split it into two distinct `_dockLeftTabBarButton` 21 and `_dockRightTabBarButton` buttons that are both always visible (unless Web Inspector is 22 already in the corresponding docking state). 23 24 * UserInterface/Images/DockBottom.svg: 25 * UserInterface/Images/DockLeft.svg: 26 * UserInterface/Images/DockRight.svg: 27 Fill in the area representing Web Inspector and make it a bit smaller so it's not as heavy. 28 29 * Localizations/en.lproj/localizedStrings.js: 30 1 31 2021-11-16 Nikita Vasilyev <nvasilyev@apple.com> 2 32 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r282905 r285974 499 499 localizedStrings["Do not fade unexecuted code"] = "Do not fade unexecuted code"; 500 500 localizedStrings["Dock to bottom of window"] = "Dock to bottom of window"; 501 localizedStrings["Dock to side of window"] = "Dock to side of window"; 501 localizedStrings["Dock to left of window"] = "Dock to left of window"; 502 localizedStrings["Dock to right of window"] = "Dock to right of window"; 502 503 localizedStrings["Document"] = "Document"; 503 504 localizedStrings["Document Fragment"] = "Document Fragment"; -
trunk/Source/WebInspectorUI/UserInterface/Base/Main.js
r283921 r285974 354 354 let supportsUndocked = InspectorFrontendHost.supportsDockSide(WI.DockConfiguration.Undocked); 355 355 356 if (supportsDockRight || supportsDockLeft || supportsDockBottom) { 357 WI._closeTabBarButton = new WI.ButtonNavigationItem("dock-close", WI.UIString("Close"), "Images/CloseLarge.svg"); 358 WI._closeTabBarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI.close, WI); 359 dockingConfigurationNavigationItems.push(WI._closeTabBarButton); 360 } 361 362 if ((supportsDockRight || supportsDockLeft) && (supportsDockBottom || supportsUndocked)) { 363 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); 364 WI._dockToSideTabBarButton.element.classList.add(WI.Popover.IgnoreAutoDismissClassName); 365 WI._dockToSideTabBarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? WI._dockLeft : WI._dockRight, WI); 366 dockingConfigurationNavigationItems.push(WI._dockToSideTabBarButton); 367 } 368 369 if (supportsDockBottom && (supportsDockRight || supportsDockLeft || supportsUndocked)) { 370 WI._dockBottomTabBarButton = new WI.ButtonNavigationItem("dock-bottom", WI.UIString("Dock to bottom of window"), "Images/DockBottom.svg", 16, 16); 371 WI._dockBottomTabBarButton.element.classList.add(WI.Popover.IgnoreAutoDismissClassName); 372 WI._dockBottomTabBarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI._dockBottom, WI); 373 dockingConfigurationNavigationItems.push(WI._dockBottomTabBarButton); 374 } 375 376 if (supportsUndocked && (supportsDockRight || supportsDockLeft || supportsDockBottom)) { 377 WI._undockTabBarButton = new WI.ButtonNavigationItem("undock", WI.UIString("Detach into separate window"), "Images/Undock.svg", 16, 16); 378 WI._undockTabBarButton.element.classList.add(WI.Popover.IgnoreAutoDismissClassName); 379 WI._undockTabBarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI._undock, WI); 380 dockingConfigurationNavigationItems.push(WI._undockTabBarButton); 381 } 356 function addDockButton(identifier, tooltip, image, handler) { 357 let button = new WI.ButtonNavigationItem(identifier, tooltip, image); 358 button.element.classList.add(WI.Popover.IgnoreAutoDismissClassName); 359 button.addEventListener(WI.ButtonNavigationItem.Event.Clicked, handler, WI); 360 dockingConfigurationNavigationItems.push(button); 361 return button; 362 } 363 364 function addDockLeftButton() { 365 if (!supportsDockLeft || (!supportsDockRight && !supportsDockBottom && !supportsUndocked)) 366 return; 367 368 WI._dockLeftTabBarButton = addDockButton("dock-left", WI.UIString("Dock to left of window"), "Images/DockLeft.svg", WI._dockLeft); 369 } 370 371 function addDockRightButton() { 372 if (!supportsDockRight || (!supportsDockLeft && !supportsDockBottom && !supportsUndocked)) 373 return; 374 375 WI._dockRightTabBarButton = addDockButton("dock-right", WI.UIString("Dock to right of window"), "Images/DockRight.svg", WI._dockRight); 376 } 377 378 if (supportsDockRight || supportsDockLeft || supportsDockBottom) 379 WI._closeTabBarButton = addDockButton("dock-close", WI.UIString("Close"), "Images/CloseLarge.svg", WI.close); 380 381 if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL) 382 addDockRightButton(); 383 else 384 addDockLeftButton(); 385 386 if (supportsDockBottom && (supportsDockRight || supportsDockLeft || supportsUndocked)) 387 WI._dockBottomTabBarButton = addDockButton("dock-bottom", WI.UIString("Dock to bottom of window"), "Images/DockBottom.svg", WI._dockBottom); 388 389 if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL) 390 addDockLeftButton(); 391 else 392 addDockRightButton(); 393 394 if (supportsUndocked && (supportsDockRight || supportsDockLeft || supportsDockBottom)) 395 WI._undockTabBarButton = addDockButton("undock", WI.UIString("Detach into separate window"), "Images/Undock.svg", WI._undock); 382 396 383 397 let inspectedPageControlNavigationItems = []; … … 1897 1911 if (WI._closeTabBarButton) 1898 1912 WI._closeTabBarButton.hidden = !docked; 1899 if (WI._dock ToSideTabBarButton)1900 WI._dock ToSideTabBarButton.hidden = WI.dockConfiguration === WI.DockConfiguration.Right ||WI.dockConfiguration === WI.DockConfiguration.Left;1913 if (WI._dockLeftTabBarButton) 1914 WI._dockLeftTabBarButton.hidden = WI.dockConfiguration === WI.DockConfiguration.Left; 1901 1915 if (WI._dockBottomTabBarButton) 1902 1916 WI._dockBottomTabBarButton.hidden = WI.dockConfiguration === WI.DockConfiguration.Bottom; 1917 if (WI._dockRightTabBarButton) 1918 WI._dockRightTabBarButton.hidden = WI.dockConfiguration === WI.DockConfiguration.Right; 1903 1919 if (WI._undockTabBarButton) 1904 1920 WI._undockTabBarButton.hidden = WI.dockConfiguration === WI.DockConfiguration.Undocked; … … 1906 1922 if (WI._closeTabBarButton) 1907 1923 WI._closeTabBarButton.hidden = true; 1908 if (WI._dock ToSideTabBarButton)1909 WI._dock ToSideTabBarButton.hidden = true;1924 if (WI._dockLeftTabBarButton) 1925 WI._dockLeftTabBarButton.hidden = true; 1910 1926 if (WI._dockBottomTabBarButton) 1911 1927 WI._dockBottomTabBarButton.hidden = true; 1928 if (WI._dockRightTabBarButton) 1929 WI._dockRightTabBarButton.hidden = true; 1912 1930 if (WI._undockTabBarButton) 1913 1931 WI._undockTabBarButton.hidden = true; … … 2503 2521 2504 2522 let closeHidden = isHidden(WI._closeTabBarButton); 2505 let dock ToSideHidden = isHidden(WI._dockToSideTabBarButton);2523 let dockLeftHidden = isHidden(WI._dockLeftTabBarButton); 2506 2524 let dockBottomHidden = isHidden(WI._dockBottomTabBarButton); 2525 let dockRightHidden = isHidden(WI._dockRightTabBarButton); 2507 2526 let undockHidden = isHidden(WI._undockTabBarButton); 2508 2527 … … 2516 2535 2517 2536 // Hide the divider if everything to the left is hidden OR if everything to the right is hidden. 2518 WI._consoleDividerNavigationItem.hidden = (closeHidden && dock ToSideHidden && dockBottomHidden && undockHidden && inspectModeHidden && deviceSettingsHidden && reloadHidden && downloadHidden) || (warningsHidden && errorsHidden);2537 WI._consoleDividerNavigationItem.hidden = (closeHidden && dockLeftHidden && dockBottomHidden && dockRightHidden && undockHidden && inspectModeHidden && deviceSettingsHidden && reloadHidden && downloadHidden) || (warningsHidden && errorsHidden); 2519 2538 2520 2539 WI.tabBar.needsLayout(); … … 2901 2920 WI.settings.debugLayoutDirection.value = value; 2902 2921 2903 if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL && WI.dockConfiguration === WI.DockConfiguration.Right)2904 WI._dockLeft();2905 2906 if (WI.resolvedLayoutDirection() === WI.LayoutDirection.LTR && WI.dockConfiguration === WI.DockConfiguration.Left)2907 WI._dockRight();2908 2909 2922 InspectorFrontendHost.reopen(); 2910 2923 }; -
trunk/Source/WebInspectorUI/UserInterface/Images/DockBottom.svg
r191693 r285974 1 1 <?xml version="1.0" encoding="utf-8"?> 2 <!-- Copyright © 20 15Apple Inc. All rights reserved. -->2 <!-- Copyright © 2021 Apple Inc. All rights reserved. --> 3 3 <svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" viewBox="0 0 16 16"> 4 <rect fill="none" stroke="currentColor" x="0.5" y="1.5" width="15" height=" 13"/>5 < path fill="none" stroke="currentColor" d="M 1 9.5 L 15 9.5 L 1 9.5 Z"/>4 <rect fill="none" stroke="currentColor" x="0.5" y="1.5" width="15" height="9"/> 5 <rect fill="currentColor" stroke="currentColor" x="0.5" y="10.5" width="15" height="4"/> 6 6 </svg> -
trunk/Source/WebInspectorUI/UserInterface/Images/DockLeft.svg
r212597 r285974 1 1 <?xml version="1.0" encoding="utf-8"?> 2 <!-- Copyright © 20 17Apple Inc. All rights reserved. -->2 <!-- Copyright © 2021 Apple Inc. All rights reserved. --> 3 3 <svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" viewBox="0 0 16 16"> 4 <rect fill=" none" stroke="currentColor" x="0.5" y="1.5" width="15" height="13"/>5 < path fill="none" stroke="currentColor" d="M 6.5 2 L 6.5 14 L 6.5 2 Z"/>4 <rect fill="currentColor" stroke="currentColor" x="0.5" y="1.5" width="4" height="13"/> 5 <rect fill="none" stroke="currentColor" x="4.5" y="1.5" width="11" height="13"/> 6 6 </svg> -
trunk/Source/WebInspectorUI/UserInterface/Images/DockRight.svg
r191693 r285974 1 1 <?xml version="1.0" encoding="utf-8"?> 2 <!-- Copyright © 20 15Apple Inc. All rights reserved. -->2 <!-- Copyright © 2021 Apple Inc. All rights reserved. --> 3 3 <svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" viewBox="0 0 16 16"> 4 <rect fill="none" stroke="currentColor" x="0.5" y="1.5" width="1 5" height="13"/>5 < path fill="none" stroke="currentColor" d="M 9.5 2 L 9.5 14 L 9.5 2 Z"/>4 <rect fill="none" stroke="currentColor" x="0.5" y="1.5" width="11" height="13"/> 5 <rect fill="currentColor" stroke="currentColor" x="11.5" y="1.5" width="4" height="13"/> 6 6 </svg>
Note:
See TracChangeset
for help on using the changeset viewer.