From 55d6400db55ae6d75f137e9bd6e9bc8b332fb41a Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Fri, 13 Jun 2025 21:14:58 +0200 Subject: [PATCH] firefox-unwrapped: backport patch for mozbz 1955112 Works around a wayland bug that makes the UI appear frozen, when a tab drag visual wasn't ended properly. --- .../firefox/139-wayland-drag-animation.patch | 53 +++++++++++++++++++ .../networking/browsers/firefox/common.nix | 5 ++ 2 files changed, 58 insertions(+) create mode 100644 pkgs/applications/networking/browsers/firefox/139-wayland-drag-animation.patch diff --git a/pkgs/applications/networking/browsers/firefox/139-wayland-drag-animation.patch b/pkgs/applications/networking/browsers/firefox/139-wayland-drag-animation.patch new file mode 100644 index 000000000000..9e0053a1f336 --- /dev/null +++ b/pkgs/applications/networking/browsers/firefox/139-wayland-drag-animation.patch @@ -0,0 +1,53 @@ +# HG changeset patch +# User Dão Gottwald +# Date 1742828426 0 +# Node ID aa8a29bd1fb9668c81475b534b4ceb220dd4fe55 +# Parent 653a7b21210b5b61a36af11b99ccd51e6c85a905 +Bug 1955112 - Finish tab moving animation when a drag session wasn't ended properly. r=dwalker,tabbrowser-reviewers + +Differential Revision: https://phabricator.services.mozilla.com/D242631 + +diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js +--- a/browser/components/tabbrowser/content/tabs.js ++++ b/browser/components/tabbrowser/content/tabs.js +@@ -1012,18 +1012,39 @@ + newMargin *= -1; + } + ind.style.transform = this.verticalMode + ? "translateY(" + Math.round(newMargin) + "px)" + : "translateX(" + Math.round(newMargin) + "px)"; + } + + #setMovingTabMode(movingTab) { ++ if (movingTab == this.#isMovingTab()) { ++ return; ++ } ++ + this.toggleAttribute("movingtab", movingTab); + gNavToolbox.toggleAttribute("movingtab", movingTab); ++ ++ if (movingTab) { ++ // This is a bit of an escape hatch in case a tab drag & drop session ++ // wasn't ended properly, leaving behind the movingtab attribute, which ++ // may break the UI (bug 1954163). We don't get mousemove events while ++ // dragging tabs, so at that point it should be safe to assume that we ++ // should not be in drag and drop mode, and clean things up if needed. ++ requestAnimationFrame(() => { ++ this.addEventListener( ++ "mousemove", ++ () => { ++ this.finishAnimateTabMove(); ++ }, ++ { once: true } ++ ); ++ }); ++ } + } + + #isMovingTab() { + return this.hasAttribute("movingtab"); + } + + #expandGroupOnDrop(draggedTab) { + if ( + diff --git a/pkgs/applications/networking/browsers/firefox/common.nix b/pkgs/applications/networking/browsers/firefox/common.nix index 965afea61031..3f21274f81a7 100644 --- a/pkgs/applications/networking/browsers/firefox/common.nix +++ b/pkgs/applications/networking/browsers/firefox/common.nix @@ -310,6 +310,11 @@ buildStdenv.mkDerivation { ./no-buildconfig-ffx121.patch ] ++ lib.optionals (lib.versionAtLeast version "136") [ ./no-buildconfig-ffx136.patch ] + ++ lib.optionals (lib.versionAtLeast version "139" && lib.versionOlder version "141") [ + # https://bugzilla.mozilla.org/show_bug.cgi?id=1955112 + # https://hg-edge.mozilla.org/mozilla-central/rev/aa8a29bd1fb9 + ./139-wayland-drag-animation.patch + ] ++ lib.optionals (lib.versionAtLeast version "139") [ ./139-relax-apple-sdk.patch ] ++ lib.optionals (lib.versionOlder version "139") [ # Fix for missing vector header on macOS