From ea6c4fa536a84926a9c62af662ddc1abe6a6bc89 Mon Sep 17 00:00:00 2001 From: Carmelo Messina Date: Tue, 3 Jun 2025 10:38:51 +0200 Subject: [PATCH] Disable prefers reduced motion: Disables the possibility of retrieving the device user setting via css prefers-reduced-motion (#2032) --- build/cromite_patches_list.txt | 1 + .../Disable-prefers-reduced-motion.patch | 56 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 build/patches/Disable-prefers-reduced-motion.patch diff --git a/build/cromite_patches_list.txt b/build/cromite_patches_list.txt index c225e21d..1186e508 100644 --- a/build/cromite_patches_list.txt +++ b/build/cromite_patches_list.txt @@ -299,6 +299,7 @@ Android-fonts-fingerprinting-mitigation.patch Disable-Android-Tab-Declutter.patch Disable-CSSDynamicRangeLimit.patch Android-Import-Passwords.patch +Disable-prefers-reduced-motion.patch # temporary or wip patches Temp-PerformanceNavigationTiming-privacy-fix.patch diff --git a/build/patches/Disable-prefers-reduced-motion.patch b/build/patches/Disable-prefers-reduced-motion.patch new file mode 100644 index 00000000..f70734a7 --- /dev/null +++ b/build/patches/Disable-prefers-reduced-motion.patch @@ -0,0 +1,56 @@ +From: uazo +Date: Fri, 30 May 2025 10:29:39 +0000 +Subject: Disable prefers reduced motion + +Disables the possibility of retrieving the device user setting via +css prefers-reduced-motion + +License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html +--- + ui/android/java/src/org/chromium/ui/gfx/Animation.java | 1 + + ui/gfx/animation/animation_linux.cc | 1 + + ui/gfx/animation/animation_win.cc | 2 ++ + 3 files changed, 4 insertions(+) + +diff --git a/ui/android/java/src/org/chromium/ui/gfx/Animation.java b/ui/android/java/src/org/chromium/ui/gfx/Animation.java +--- a/ui/android/java/src/org/chromium/ui/gfx/Animation.java ++++ b/ui/android/java/src/org/chromium/ui/gfx/Animation.java +@@ -21,6 +21,7 @@ import org.chromium.build.annotations.NullMarked; + public class Animation { + @CalledByNative + private static boolean prefersReducedMotion() { ++ if ((true)) return false; + // We default to assuming that animations are enabled, to avoid impacting the experience for + // users that don't have ANIMATOR_DURATION_SCALE defined. + final float defaultScale = 1f; +diff --git a/ui/gfx/animation/animation_linux.cc b/ui/gfx/animation/animation_linux.cc +--- a/ui/gfx/animation/animation_linux.cc ++++ b/ui/gfx/animation/animation_linux.cc +@@ -13,6 +13,7 @@ namespace { + // Linux toolkits only have a global setting for whether animations should be + // enabled. So use it for all of the specific settings that Chrome needs. + bool AnimationsEnabled() { ++ if ((true)) return true; + auto* linux_ui = ui::LinuxUi::instance(); + return !linux_ui || linux_ui->AnimationsEnabled(); + } +diff --git a/ui/gfx/animation/animation_win.cc b/ui/gfx/animation/animation_win.cc +--- a/ui/gfx/animation/animation_win.cc ++++ b/ui/gfx/animation/animation_win.cc +@@ -12,6 +12,7 @@ namespace gfx { + + // static + bool Animation::ShouldRenderRichAnimationImpl() { ++ if ((true)) return true; + BOOL result; + // Get "Turn off all unnecessary animations" value. + if (::SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, &result, 0)) { +@@ -27,6 +28,7 @@ bool Animation::ScrollAnimationsEnabledBySystem() { + + // static + void Animation::UpdatePrefersReducedMotion() { ++ if ((true)) return false; + // prefers_reduced_motion_ should only be modified on the UI thread. + // TODO(crbug.com/40611878): DCHECK this assertion once tests are + // well-behaved. +--