Skip to content

Commit

Permalink
Removed ability to adjust density in CustomizeUI mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard-Woessner committed Nov 5, 2024
1 parent bd3c8d1 commit 99eedfd
Show file tree
Hide file tree
Showing 4 changed files with 615 additions and 3 deletions.
35 changes: 32 additions & 3 deletions src/browser/components/customizableui/CustomizeMode-sys-mjs.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/browser/components/customizableui/CustomizeMode.sys.mjs b/browser/components/customizableui/CustomizeMode.sys.mjs
index 41f347130e754ad0ee3416c1a3881211c4d2f777..9f906fd5f11731025abdf55eb5e60a824f8dd81f 100644
index f303b9fe6b9c046f87be1d3614402563d01a579b..f66501cedc8b2087af5dbbdde73f0c6f77ad133a 100644
--- a/browser/components/customizableui/CustomizeMode.sys.mjs
+++ b/browser/components/customizableui/CustomizeMode.sys.mjs
@@ -354,7 +354,7 @@ CustomizeMode.prototype = {
Expand All @@ -11,7 +11,15 @@ index 41f347130e754ad0ee3416c1a3881211c4d2f777..9f906fd5f11731025abdf55eb5e60a82
browser.hidden = true;
customizer.hidden = false;

@@ -485,7 +485,7 @@ CustomizeMode.prototype = {
@@ -384,7 +384,6 @@ CustomizeMode.prototype = {
this._updateResetButton();
this._updateUndoResetButton();
this._updateTouchBarButton();
- this._updateDensityMenu();

this._skipSourceNodeCheck =
Services.prefs.getPrefType(kSkipSourceNodePref) ==
@@ -485,7 +484,7 @@ CustomizeMode.prototype = {
}

let customizer = document.getElementById("customization-container");
Expand All @@ -20,7 +28,28 @@ index 41f347130e754ad0ee3416c1a3881211c4d2f777..9f906fd5f11731025abdf55eb5e60a82
customizer.hidden = true;
browser.hidden = false;

@@ -2276,6 +2276,20 @@ CustomizeMode.prototype = {
@@ -1546,20 +1545,6 @@ CustomizeMode.prototype = {
touchBarSpacer.hidden = !isTouchBarInitialized;
},

- _updateDensityMenu() {
- // If we're entering Customize Mode, and we're using compact mode,
- // then show the button after that.
- let gUIDensity = this.window.gUIDensity;
- if (gUIDensity.getCurrentDensity().mode == gUIDensity.MODE_COMPACT) {
- Services.prefs.setBoolPref(kCompactModeShowPref, true);
- }
-
- let button = this.document.getElementById("customization-uidensity-button");
- button.hidden =
- !Services.prefs.getBoolPref(kCompactModeShowPref) &&
- !button.querySelector("#customization-uidensity-menuitem-touch");
- },
-
handleEvent(aEvent) {
switch (aEvent.type) {
case "toolbarvisibilitychange":
@@ -2272,6 +2257,20 @@ CustomizeMode.prototype = {
if (makeSpaceImmediately) {
aItem.setAttribute("notransition", "true");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
diff --git a/browser/components/customizableui/content/customizeMode.inc.xhtml b/browser/components/customizableui/content/customizeMode.inc.xhtml
index 38c9dbe15f9e89a63471c5ea4439b2f468f31073..d0f7998e158c9b391acea726231c79f188f20163 100644
--- a/browser/components/customizableui/content/customizeMode.inc.xhtml
+++ b/browser/components/customizableui/content/customizeMode.inc.xhtml
@@ -32,57 +32,6 @@
<button id="customization-toolbar-visibility-button" class="footer-button" type="menu" data-l10n-id="customize-mode-toolbars">
<menupopup id="customization-toolbar-menu" onpopupshowing="if (event.target == this) ToolbarContextMenu.onViewToolbarsPopupShowing(event)"/>
</button>
-<button id="customization-uidensity-button"
- data-l10n-id="customize-mode-uidensity"
- class="footer-button"
- type="menu"
- hidden="true">
- <panel type="arrow" id="customization-uidensity-menu"
- orient="vertical"
- onpopupshowing="gCustomizeMode.onUIDensityMenuShowing();"
- position="topleft bottomleft"
- flip="none"
- role="menu">
- <menuitem id="customization-uidensity-menuitem-compact"
- class="menuitem-iconic customization-uidensity-menuitem"
- role="menuitemradio"
- data-l10n-id="customize-mode-uidensity-menu-compact-unsupported"
- tabindex="0"
- onfocus="gCustomizeMode.updateUIDensity(this.mode);"
- onmouseover="gCustomizeMode.updateUIDensity(this.mode);"
- onblur="gCustomizeMode.resetUIDensity();"
- onmouseout="gCustomizeMode.resetUIDensity();"
- oncommand="gCustomizeMode.setUIDensity(this.mode);"/>
- <menuitem id="customization-uidensity-menuitem-normal"
- class="menuitem-iconic customization-uidensity-menuitem"
- role="menuitemradio"
- data-l10n-id="customize-mode-uidensity-menu-normal"
- tabindex="0"
- onfocus="gCustomizeMode.updateUIDensity(this.mode);"
- onmouseover="gCustomizeMode.updateUIDensity(this.mode);"
- onblur="gCustomizeMode.resetUIDensity();"
- onmouseout="gCustomizeMode.resetUIDensity();"
- oncommand="gCustomizeMode.setUIDensity(this.mode);"/>
-#ifndef XP_MACOSX
- <menuitem id="customization-uidensity-menuitem-touch"
- class="menuitem-iconic customization-uidensity-menuitem"
- role="menuitemradio"
- data-l10n-id="customize-mode-uidensity-menu-touch"
- tabindex="0"
- onfocus="gCustomizeMode.updateUIDensity(this.mode);"
- onmouseover="gCustomizeMode.updateUIDensity(this.mode);"
- onblur="gCustomizeMode.resetUIDensity();"
- onmouseout="gCustomizeMode.resetUIDensity();"
- oncommand="gCustomizeMode.setUIDensity(this.mode);">
- </menuitem>
- <spacer hidden="true" id="customization-uidensity-touch-spacer"/>
- <checkbox id="customization-uidensity-autotouchmode-checkbox"
- hidden="true"
- data-l10n-id="customize-mode-uidensity-auto-touch-mode-checkbox"
- oncommand="gCustomizeMode.updateAutoTouchMode(this.checked)"/>
-#endif
- </panel>
-</button>
<label is="text-link"
id="customization-lwtheme-link"
class="customization-link"
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
diff --git a/browser/components/customizableui/test/browser_970511_undo_restore_default.js b/browser/components/customizableui/test/browser_970511_undo_restore_default.js
index 5477b41b803eca4aa2e6e7d8c00811502908c286..363de1f00896e1630ae66af5159dcd24243568ea 100644
--- a/browser/components/customizableui/test/browser_970511_undo_restore_default.js
+++ b/browser/components/customizableui/test/browser_970511_undo_restore_default.js
@@ -26,51 +26,14 @@ add_task(async function () {
);
is(undoResetButton.hidden, true, "The undo button is hidden before reset");

- let densityButton = document.getElementById("customization-uidensity-button");
- let popup = document.getElementById("customization-uidensity-menu");
- let popupShownPromise = popupShown(popup);
- EventUtils.synthesizeMouseAtCenter(densityButton, {});
- info("Clicked on density button");
- await popupShownPromise;
-
- let compactModeItem = document.getElementById(
- "customization-uidensity-menuitem-compact"
- );
- let win = document.getElementById("main-window");
- let densityChangedPromise = new Promise(resolve => {
- let observer = new MutationObserver(() => {
- if (win.getAttribute("uidensity") == "compact") {
- resolve();
- observer.disconnect();
- }
- });
- observer.observe(win, {
- attributes: true,
- attributeFilter: ["uidensity"],
- });
- });
-
- compactModeItem.doCommand();
- info("Clicked on compact density");
- await densityChangedPromise;

await gCustomizeMode.reset();

ok(CustomizableUI.inDefaultState, "In default state after reset");
is(undoResetButton.hidden, false, "The undo button is visible after reset");
- is(
- win.hasAttribute("uidensity"),
- false,
- "The window has been restored to normal density."
- );

await gCustomizeMode.undoReset();

- is(
- win.getAttribute("uidensity"),
- "compact",
- "Density has been reset to compact."
- );
ok(!CustomizableUI.inDefaultState, "Not in default state after undo-reset");
is(
undoResetButton.hidden,
Loading

0 comments on commit 99eedfd

Please sign in to comment.