Modified: trunk/Source/WebInspectorUI/ChangeLog (258777 => 258778)
--- trunk/Source/WebInspectorUI/ChangeLog 2020-03-20 18:59:26 UTC (rev 258777)
+++ trunk/Source/WebInspectorUI/ChangeLog 2020-03-20 19:22:02 UTC (rev 258778)
@@ -1,3 +1,49 @@
+2020-03-20 Devin Rousso <drou...@apple.com>
+
+ Web Inspector: REGRESSION(r257835): close and undock buttons are shown in remote inspector
+ https://bugs.webkit.org/show_bug.cgi?id=209346
+
+ Reviewed by Timothy Hatcher.
+
+ In the case of remote inspection, the frontend is told that docking is not available before
+ it is even shown (via `InspectorFrontendAPI.setDockingUnavailable`). Additionally, the
+ backend (`WebKit::RemoteWebInspectorUI`) never tells the frontend what dock side it actually
+ is (via `InspectorFrontendAPI.setDockSide`), as there would be no point, given that docking
+ is unavailable, meaning that the frontend must be undocked.
+
+ Before r257835, the docking state held by `WI._dockConfiguration` and `WI.docked`, neither
+ of which would be set as described above. As a result, in `WI._updateDockNavigationItems`
+ `WI.docked` would be undefined, which is falsy, thereby causing all docking navigation items
+ to be hidden. After r257835, these were merged into one `WI.dockConfiguration`, which is
+ compared against `WI.DockConfiguration.Undocked` instead of just being falsy checked,
+ meaning it would result in `true` which would not hide all of the docking navigation items.
+
+ Change the logic of `WI.updateDockingAvailability` such that if the frontend is told that
+ docking is unavailable, mark the `WI.dockConfiguration` as `WI.DockConfiguration.Undocked`.
+ This way, the frontend will always have a valid value for `WI.dockConfiguration`.
+
+ Additionally, further leverage `InspectorFrontendHost.supportsDockSide` to only create the
+ docking navigation items that are actually supported by the host.
+
+ * UserInterface/Base/Main.js:
+ (WI.contentLoaded):
+ (WI.updateDockingAvailability):
+ (WI.resizeDockedFrameMouseDown):
+ (WI.dockedConfigurationSupportsSplitContentBrowser):
+ (WI._updateDockNavigationItems):
+ (WI._updateTabBarDividers):
+
+ * UserInterface/Views/TabBar.js:
+ (WI.TabBar.get horizontalPadding):
+ (WI.TabBar.prototype.resetCachedWidths): Added.
+ When switching dock configurations, we need to reset the cached width of each tab bar item,
+ as otherwise, a large width cached when undocked can incorrectly be used when docked.
+
+ * UserInterface/Views/TabBarItem.js:
+ (WI.TabBarItem.get horizontalMargin):
+ Replace negative checks of `WI.dockConfiguration` with positive ones that can't be fooled by
+ a falsy value.
+
2020-03-19 Nikita Vasilyev <nvasil...@apple.com>
Web Inspector: AXI: disabled buttons shouldn't be focusable
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (258777 => 258778)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2020-03-20 18:59:26 UTC (rev 258777)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2020-03-20 19:22:02 UTC (rev 258778)
@@ -366,12 +366,20 @@
WI._togglePreviousDockConfigurationKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "D", WI._togglePreviousDockConfiguration);
- WI._closeTabBarButton = new WI.ButtonNavigationItem("dock-close", WI.UIString("Close"), "Images/CloseLarge.svg");
- WI._closeTabBarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI.close);
-
let dockingConfigurationNavigationItems = [];
- if (InspectorFrontendHost.supportsDockSide(WI.DockConfiguration.Right) && InspectorFrontendHost.supportsDockSide(WI.DockConfiguration.Left)) {
+ let supportsDockRight = InspectorFrontendHost.supportsDockSide(WI.DockConfiguration.Right);
+ let supportsDockLeft = InspectorFrontendHost.supportsDockSide(WI.DockConfiguration.Left);
+ 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);
+ dockingConfigurationNavigationItems.push(WI._closeTabBarButton);
+ }
+
+ 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);
@@ -378,7 +386,7 @@
dockingConfigurationNavigationItems.push(WI._dockToSideTabBarButton);
}
- if (InspectorFrontendHost.supportsDockSide(WI.DockConfiguration.Bottom)) {
+ 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);
@@ -385,7 +393,7 @@
dockingConfigurationNavigationItems.push(WI._dockBottomTabBarButton);
}
- if (InspectorFrontendHost.supportsDockSide(WI.DockConfiguration.Undocked)) {
+ 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);
@@ -426,7 +434,6 @@
}
WI.tabBar.addNavigationItemBefore(new WI.GroupNavigationItem([
- WI._closeTabBarButton,
...dockingConfigurationNavigationItems,
...inspectedPageControlNavigationItems,
]));
@@ -466,12 +473,16 @@
WI.consoleManager.addEventListener(WI.ConsoleManager.Event.Cleared, WI._updateConsoleTabBarButtons, WI);
WI._updateConsoleTabBarButtons();
- WI._dockedResizerElement = document.getElementById("docked-resizer");
- WI._dockedResizerElement.classList.add(WI.Popover.IgnoreAutoDismissClassName);
- WI._dockedResizerElement.addEventListener("mousedown", WI._handleDockedResizerMouseDown);
+ if (supportsDockRight || supportsDockLeft || supportsDockBottom) {
+ WI._dockedResizerElement = document.getElementById("docked-resizer");
+ WI._dockedResizerElement.classList.add(WI.Popover.IgnoreAutoDismissClassName);
+ WI._dockedResizerElement.addEventListener("mousedown", WI._handleDockedResizerMouseDown);
+ }
- let undockedTitleAreaElement = document.getElementById("undocked-title-area");
- undockedTitleAreaElement.addEventListener("mousedown", WI._handleUndockedTitleAreaMouseDown);
+ if (supportsUndocked) {
+ let undockedTitleAreaElement = document.getElementById("undocked-title-area");
+ undockedTitleAreaElement.addEventListener("mousedown", WI._handleUndockedTitleAreaMouseDown);
+ }
WI._dockingAvailable = false;
@@ -839,6 +850,11 @@
{
WI._dockingAvailable = available;
+ if (!WI._dockingAvailable) {
+ WI.updateDockedState(WI.DockConfiguration.Undocked);
+ return;
+ }
+
WI._updateDockNavigationItems();
};
@@ -881,6 +897,8 @@
WI._updateDockNavigationItems();
+ WI.tabBar.resetCachedWidths();
+
if (!WI.dockedConfigurationSupportsSplitContentBrowser() && !WI.doesCurrentTabSupportSplitContentBrowser())
WI.hideSplitConsole();
};
@@ -887,7 +905,7 @@
WI.resizeDockedFrameMouseDown = function(event)
{
- console.assert(WI.dockConfiguration !== WI.DockConfiguration.Undocked);
+ console.assert(WI.dockConfiguration && WI.dockConfiguration !== WI.DockConfiguration.Undocked);
if (event.button !== 0 || event.ctrlKey)
return;
@@ -1102,7 +1120,7 @@
WI.dockedConfigurationSupportsSplitContentBrowser = function()
{
- return WI.dockConfiguration !== WI.DockConfiguration.Bottom;
+ return !WI.dockConfiguration || WI.dockConfiguration !== WI.DockConfiguration.Bottom;
};
WI.doesCurrentTabSupportSplitContentBrowser = function()
@@ -1863,10 +1881,11 @@
WI._updateDockNavigationItems = function()
{
- let docked = WI.dockConfiguration !== WI.DockConfiguration.Undocked;
+ let docked = WI.dockedConfigurationSupportsSplitContentBrowser && WI.dockConfiguration !== WI.DockConfiguration.Undocked;
if (WI._dockingAvailable || docked) {
- WI._closeTabBarButton.hidden = !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._dockBottomTabBarButton)
@@ -1874,7 +1893,8 @@
if (WI._undockTabBarButton)
WI._undockTabBarButton.hidden = WI.dockConfiguration === WI.DockConfiguration.Undocked;
} else {
- WI._closeTabBarButton.hidden = true;
+ if (WI._closeTabBarButton)
+ WI._closeTabBarButton.hidden = true;
if (WI._dockToSideTabBarButton)
WI._dockToSideTabBarButton.hidden = true;
if (WI._dockBottomTabBarButton)
@@ -2336,7 +2356,7 @@
WI._updateTabBarDividers = function()
{
- let closeHidden = WI._closeTabBarButton.hidden;
+ let closeHidden = WI._closeTabBarButton?.hidden;
let dockToSideHidden = WI._dockToSideTabBarButton?.hidden;
let dockBottomHidden = WI._dockBottomTabBarButton?.hidden;
let undockHidden = WI._undockTabBarButton?.hidden;
@@ -3354,3 +3374,5 @@
Bottom: "bottom",
Undocked: "undocked",
};
+
+WI.DockConfigurationChangedLayoutReason = Symbol("dock-configuration-changed");
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js (258777 => 258778)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js 2020-03-20 18:59:26 UTC (rev 258777)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js 2020-03-20 19:22:02 UTC (rev 258778)
@@ -72,7 +72,7 @@
static get horizontalPadding()
{
- return (WI.dockConfiguration !== WI.DockConfiguration.Undocked) ? 8 : 0; // Keep in sync with `body.docked .tab-bar .tabs`
+ return (WI.dockConfiguration === WI.DockConfiguration.Undocked) ? 0 : 8; // Keep in sync with `body.docked .tab-bar .tabs`
}
// Public
@@ -425,6 +425,12 @@
return this._tabBarItems.filter((item) => !(item instanceof WI.PinnedTabBarItem)).length;
}
+ resetCachedWidths()
+ {
+ for (let tabBarItem of this._tabBarItems)
+ tabBarItem[WI.TabBar.CachedWidthSymbol] = 0;
+ }
+
// Protected
layout()