Backed out changeset 6ad99c7c787d (bug 1914452) for causing bc sider bar related failures. CLOSED TREE

This commit is contained in:
Sandor Molnar
2024-10-02 21:25:44 +03:00
parent 378adb8805
commit fbc2bb1bd2
10 changed files with 54 additions and 146 deletions

View File

@@ -156,21 +156,11 @@ add_task(async function testTabStopsNoPageWithHomeButton() {
AddHomeBesideReload();
await withNewBlankTab(async function () {
startFromUrlBar();
if (sidebarRevampEnabled) {
await expectFocusAfterKey("Shift+Tab", "sidebar-button");
await expectFocusAfterKey("ArrowRight", "home-button");
} else {
await expectFocusAfterKey("Shift+Tab", "home-button");
}
await expectFocusAfterKey("Shift+Tab", "home-button");
await expectFocusAfterKey("Shift+Tab", "tabs-newtab-button");
await expectFocusAfterKey("Shift+Tab", gBrowser.selectedTab);
await expectFocusAfterKey("Tab", "tabs-newtab-button");
if (sidebarRevampEnabled) {
await expectFocusAfterKey("Tab", "sidebar-button");
await expectFocusAfterKey("ArrowRight", "home-button");
} else {
await expectFocusAfterKey("Tab", "home-button");
}
await expectFocusAfterKey("Tab", "home-button");
await expectFocusAfterKey("Tab", gURLBar.inputField);
await expectFocusAfterKey("Tab", afterUrlBarButton);
if (sidebarRevampEnabled) {
@@ -197,21 +187,11 @@ async function doTestTabStopsPageLoaded(aPageActionsVisible) {
"Shift+Tab",
"tracking-protection-icon-container"
);
if (sidebarRevampEnabled) {
await expectFocusAfterKey("Shift+Tab", "sidebar-button");
await expectFocusAfterKey("ArrowRight", "reload-button");
} else {
await expectFocusAfterKey("Shift+Tab", "reload-button");
}
await expectFocusAfterKey("Shift+Tab", "reload-button");
await expectFocusAfterKey("Shift+Tab", "tabs-newtab-button");
await expectFocusAfterKey("Shift+Tab", gBrowser.selectedTab);
await expectFocusAfterKey("Tab", "tabs-newtab-button");
if (sidebarRevampEnabled) {
await expectFocusAfterKey("Tab", "sidebar-button");
await expectFocusAfterKey("ArrowRight", "reload-button");
} else {
await expectFocusAfterKey("Tab", "reload-button");
}
await expectFocusAfterKey("Tab", "reload-button");
await expectFocusAfterKey("Tab", "tracking-protection-icon-container");
await expectFocusAfterKey("Tab", gURLBar.inputField);
await expectFocusAfterKey(
@@ -319,11 +299,14 @@ add_task(async function testTabStopNoButtons() {
resetToolbarWithoutDevEditionButtons();
AddHomeBesideReload();
if (!sidebarRevampEnabled) {
CustomizableUI.addWidgetToArea("sidebar-button", "nav-bar", 0);
CustomizableUI.addWidgetToArea(
"sidebar-button",
"nav-bar",
CustomizableUI.getPlacementOfWidget("home-button").position + 1
);
}
// Make sure the button is reachable now that it has been re-added.
await expectFocusAfterKey("Shift+Tab", "sidebar-button", true);
await expectFocusAfterKey("ArrowRight", "home-button");
await expectFocusAfterKey("Shift+Tab", "home-button", true);
RemoveHomeButton();
});
});
@@ -392,26 +375,13 @@ add_task(async function testArrowsDisabledButtons() {
"tracking-protection-icon-container"
);
// Back and Forward buttons are disabled.
if (sidebarRevampEnabled) {
await expectFocusAfterKey("Shift+Tab", "sidebar-button");
await expectFocusAfterKey("ArrowRight", "reload-button");
} else {
await expectFocusAfterKey("Shift+Tab", "reload-button");
}
await expectFocusAfterKey("Shift+Tab", "reload-button");
EventUtils.synthesizeKey("KEY_ArrowLeft");
if (sidebarRevampEnabled) {
is(
document.activeElement.id,
"sidebar-button",
"ArrowLeft on Reload button when prior buttons disabled navigates to sidebar-button"
);
} else {
is(
document.activeElement.id,
"reload-button",
"ArrowLeft on Reload button when prior buttons disabled does nothing"
);
}
is(
document.activeElement.id,
"reload-button",
"ArrowLeft on Reload button when prior buttons disabled does nothing"
);
BrowserTestUtils.startLoadingURIString(aBrowser, "https://example.com/2");
await BrowserTestUtils.browserLoaded(aBrowser);
@@ -421,12 +391,7 @@ add_task(async function testArrowsDisabledButtons() {
"Shift+Tab",
"tracking-protection-icon-container"
);
if (sidebarRevampEnabled) {
await expectFocusAfterKey("Shift+Tab", "sidebar-button");
await expectFocusAfterKey("ArrowRight", "back-button");
} else {
await expectFocusAfterKey("Shift+Tab", "back-button");
}
await expectFocusAfterKey("Shift+Tab", "back-button");
// Forward button is still disabled.
await expectFocusAfterKey("ArrowRight", "reload-button");
}

View File

@@ -217,10 +217,26 @@ XPCOMUtils.defineLazyPreferenceGetter(
CustomizableUI.AREA_NAVBAR
);
if (!navbarPlacements.includes("sidebar-button")) {
// Find a spot for the sidebar-button.
// If any of the home, reload or fwd button are in there, we'll place next that.
let position;
for (let widgetId of [
"home-button",
"stop-reload-button",
"forward-button",
]) {
position = navbarPlacements.indexOf(widgetId);
if (position > -1) {
position += 1;
break;
}
}
// Its not currently possible to move the forward-button out of the navbar, but we'll
// ensure the insert position is at least 0 just in case
CustomizableUI.addWidgetToArea(
"sidebar-button",
CustomizableUI.AREA_NAVBAR,
0
Math.max(0, position)
);
}
}
@@ -297,13 +313,13 @@ var CustomizableUIInternal = {
);
let navbarPlacements = [
lazy.sidebarRevampEnabled ? "sidebar-button" : null,
"back-button",
"forward-button",
"stop-reload-button",
Services.policies.isAllowed("removeHomeButtonByDefault")
? null
: "home-button",
lazy.sidebarRevampEnabled ? "sidebar-button" : null,
"spring",
"urlbar-container",
"spring",
@@ -504,7 +520,7 @@ var CustomizableUIInternal = {
}
if (!newPlacements.includes("sidebar-button")) {
newPlacements.unshift("sidebar-button");
newPlacements.push("sidebar-button");
}
gSavedState.placements[CustomizableUI.AREA_NAVBAR] = newPlacements;

View File

@@ -308,6 +308,7 @@ export const CustomizableWidgets = [
let obPosition = doc.createXULElement("observes");
obPosition.setAttribute("element", "sidebar-box");
obPosition.setAttribute("attribute", "positionend");
aNode.appendChild(obChecked);
aNode.appendChild(obPosition);
}

View File

@@ -596,17 +596,13 @@ var SidebarController = {
// the launcher should be on the right of the sidebar-box
sidebarContainer.style.order = parseInt(this._box.style.order) + 1;
// Indicate we've switched ordering to the box
this._box.toggleAttribute("positionend", true);
sidebarMain.toggleAttribute("positionend", true);
sidebarContainer.toggleAttribute("positionend", true);
this.toolbarButton &&
this.toolbarButton.toggleAttribute("positionend", true);
this._box.setAttribute("positionend", true);
sidebarMain.setAttribute("positionend", true);
sidebarContainer.setAttribute("positionend", true);
} else {
this._box.toggleAttribute("positionend", false);
sidebarMain.toggleAttribute("positionend", false);
sidebarContainer.toggleAttribute("positionend", false);
this.toolbarButton &&
this.toolbarButton.toggleAttribute("positionend", false);
this._box.removeAttribute("positionend");
sidebarMain.removeAttribute("positionend");
sidebarContainer.removeAttribute("positionend");
}
this.hideSwitcherPanel();
@@ -986,9 +982,10 @@ var SidebarController = {
if (!isHidden && this.isOpen) {
// Sidebar is currently visible, but now we want to hide it.
this.hide();
} else if (isHidden) {
// Sidebar is currently hidden, but now we want to show it.
this.toggleExpanded(true);
}
// Sidebar is currently hidden, but now we want to show it.
this.toggleExpanded(isHidden);
this.sidebarContainer.hidden = !isHidden;
this.updateToolbarButton();
break;
@@ -1004,11 +1001,6 @@ var SidebarController = {
// For the non-revamped sidebar, this is handled by CustomizableWidgets.
return;
}
this.toolbarButton.toggleAttribute("expanded", this.sidebarMain.expanded);
this.toolbarButton.toggleAttribute(
"open",
this._box.hasAttribute("checked")
);
switch (this.sidebarRevampVisibility) {
case "always-show":
// Toolbar button controls expanded state.

View File

@@ -257,7 +257,7 @@ export class SidebarCustomize extends SidebarPage {
? this.getWindow().SidebarController._positionStart
: !this.getWindow().SidebarController._positionStart
}
iconsrc="chrome://browser/skin/sidebar-expanded-right.svg"
iconsrc="chrome://browser/skin/sidebar-right.svg"
data-l10n-id="sidebar-position-right"
></moz-radio>
</moz-radio-group>

View File

@@ -75,11 +75,6 @@ add_task(async function test_expanded_state_for_always_show() {
document,
} = win;
await TestUtils.waitForCondition(
() => toolbarButton.hasAttribute("shown"),
"Toolbar button shown attribute is present."
);
const checkExpandedState = async (
expanded,
component = sidebarMain,
@@ -105,12 +100,6 @@ add_task(async function test_expanded_state_for_always_show() {
},
"Toolbar button has the correct tooltip."
);
await TestUtils.waitForCondition(
() => button.hasAttribute("expanded") == expanded,
expanded
? "Toolbar button expanded attribute is present."
: "Toolbar button expanded attribute is absent."
);
};
info("Check default expanded state.");
@@ -168,11 +157,6 @@ add_task(async function test_states_for_hide_sidebar() {
const { SidebarController } = win;
const { sidebarContainer, sidebarMain, toolbarButton } = SidebarController;
await TestUtils.waitForCondition(
() => !toolbarButton.hasAttribute("shown"),
"Toolbar button shown attribute is absent."
);
const checkStates = async (
{ hidden, expanded },
container = sidebarContainer,
@@ -201,12 +185,6 @@ add_task(async function test_states_for_hide_sidebar() {
},
"Toolbar button has the correct tooltip."
);
await TestUtils.waitForCondition(
() => button.hasAttribute("expanded") == expanded,
expanded
? "Toolbar button expanded attribute is present."
: "Toolbar button expanded attribute is absent."
);
};
// Hide the sidebar

View File

@@ -1,6 +0,0 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" fill="context-fill" fill-opacity="context-fill-opacity" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M14 2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h12zm-2 10.5H2a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5h10v9z"/>
</svg>

Before

Width:  |  Height:  |  Size: 515 B

View File

@@ -3,4 +3,4 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" fill="context-fill" fill-opacity="context-fill-opacity" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 2a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H2zm-.5 2a.5.5 0 0 1 .5-.5h8v9H2a.5.5 0 0 1-.5-.5V4z"/>
</svg>
</svg>

Before

Width:  |  Height:  |  Size: 511 B

After

Width:  |  Height:  |  Size: 510 B

View File

@@ -193,11 +193,10 @@
skin/classic/browser/save.svg (../shared/icons/save.svg)
skin/classic/browser/screenshot.svg (../shared/icons/screenshot.svg)
skin/classic/browser/sidebar-collapsed.svg (../shared/icons/sidebar-collapsed.svg)
skin/classic/browser/sidebar-collapsed-right.svg (../shared/icons/sidebar-collapsed-right.svg)
skin/classic/browser/sidebar-expanded.svg (../shared/icons/sidebar-expanded.svg)
skin/classic/browser/sidebar-expanded-right.svg (../shared/icons/sidebar-expanded-right.svg)
skin/classic/browser/sidebar-hidden.svg (../shared/icons/sidebar-hidden.svg)
skin/classic/browser/sidebar-horizontal-tabs.svg (../shared/icons/sidebar-horizontal-tabs.svg)
skin/classic/browser/sidebar-right.svg (../shared/icons/sidebar-right.svg)
skin/classic/browser/sidebars.svg (../shared/icons/sidebars.svg)
skin/classic/browser/sidebars-right.svg (../shared/icons/sidebars-right.svg)
#ifndef MOZ_WIDGET_GTK

View File

@@ -203,49 +203,12 @@
}
#sidebar-button {
/* stylelint-disable-next-line media-query-no-invalid */
@media not (-moz-bool-pref: "sidebar.revamp") {
list-style-image: url("chrome://browser/skin/sidebars-right.svg");
list-style-image: url("chrome://browser/skin/sidebars-right.svg");
}
&:-moz-locale-dir(ltr):not([positionend]),
&:-moz-locale-dir(rtl)[positionend] {
list-style-image: url("chrome://browser/skin/sidebars.svg");
}
}
/* stylelint-disable-next-line media-query-no-invalid */
@media (-moz-bool-pref: "sidebar.revamp") {
list-style-image: url("chrome://browser/skin/sidebar-expanded-right.svg");
&[expanded], &[open] {
list-style-image: url("chrome://browser/skin/sidebar-hidden.svg");
}
&[expanded][open], &[open][shown] {
list-style-image: url("chrome://browser/skin/sidebar-expanded-right.svg");
}
&[expanded][shown] {
list-style-image: url("chrome://browser/skin/sidebar-collapsed-right.svg");
}
&:-moz-locale-dir(ltr):not([positionend]),
&:-moz-locale-dir(rtl)[positionend] {
list-style-image: url("chrome://browser/skin/sidebar-expanded.svg");
&[expanded], &[open] {
list-style-image: url("chrome://browser/skin/sidebar-hidden.svg");
}
&[expanded][open], &[open][shown] {
list-style-image: url("chrome://browser/skin/sidebar-expanded.svg");
}
&[expanded][shown] {
list-style-image: url("chrome://browser/skin/sidebar-collapsed.svg");
}
}
}
#sidebar-button:-moz-locale-dir(ltr):not([positionend]),
#sidebar-button:-moz-locale-dir(rtl)[positionend] {
list-style-image: url("chrome://browser/skin/sidebars.svg");
}
#panic-button {