Disable prefers reduced motion: Disables the possibility of retrieving the device user setting via css prefers-reduced-motion (#2032)

This commit is contained in:
Carmelo Messina
2025-06-03 10:38:51 +02:00
parent 2bf7dd4fc4
commit ea6c4fa536
2 changed files with 57 additions and 0 deletions
+1
View File
@@ -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
@@ -0,0 +1,56 @@
From: uazo <uazo@users.noreply.github.com>
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.
--