morgan pushed to branch tor-browser-128.2.0esr-14.0-1 at The Tor Project / Applications / Tor Browser
Commits:
-
a6a8e4e6
by Fatih at 2024-09-23T18:23:54+00:00
-
9a15523f
by Fatih at 2024-09-23T18:23:54+00:00
-
57016f3f
by Morgan at 2024-09-23T18:23:54+00:00
-
6463bb2d
by Morgan at 2024-09-23T18:23:54+00:00
9 changed files:
- browser/components/BrowserGlue.sys.mjs
- browser/components/preferences/main.inc.xhtml
- gfx/layers/apz/src/APZInputBridge.cpp
- gfx/layers/apz/src/APZPublicUtils.cpp
- gfx/layers/apz/src/GenericScrollAnimation.cpp
- gfx/layers/apz/src/WheelScrollAnimation.cpp
- layout/base/nsLayoutUtils.cpp
- layout/xul/nsSliderFrame.cpp
- widget/cocoa/nsChildView.mm
Changes:
| ... | ... | @@ -4780,7 +4780,8 @@ BrowserGlue.prototype = { |
| 4780 | 4780 | // the security level anymore (tor-browser#42149).
|
| 4781 | 4781 | // Also, reset security.xfocsp.errorReporting.automatic since we
|
| 4782 | 4782 | // hid its neterror checkbox. tor-browser#42653.
|
| 4783 | - const MIGRATION_VERSION = 2;
|
|
| 4783 | + // Version 3: 14.0a7: Reset general.smoothScroll. tor-browser#42070.
|
|
| 4784 | + const MIGRATION_VERSION = 3;
|
|
| 4784 | 4785 | const MIGRATION_PREF = "basebrowser.migration.version";
|
| 4785 | 4786 | // We do not care whether this is a new or old profile, since in version 1
|
| 4786 | 4787 | // we just quickly clear a user preference, which should not do anything to
|
| ... | ... | @@ -4808,6 +4809,11 @@ BrowserGlue.prototype = { |
| 4808 | 4809 | Services.prefs.clearUserPref(prefName);
|
| 4809 | 4810 | }
|
| 4810 | 4811 | }
|
| 4812 | + if (currentVersion < 3) {
|
|
| 4813 | + Services.prefs.clearUserPref(
|
|
| 4814 | + "general.smoothScroll"
|
|
| 4815 | + );
|
|
| 4816 | + }
|
|
| 4811 | 4817 | Services.prefs.setIntPref(MIGRATION_PREF, MIGRATION_VERSION);
|
| 4812 | 4818 | },
|
| 4813 | 4819 |
| ... | ... | @@ -731,7 +731,8 @@ |
| 731 | 731 | preference="general.autoScroll"/>
|
| 732 | 732 | <checkbox id="useSmoothScrolling"
|
| 733 | 733 | data-l10n-id="browsing-use-smooth-scrolling"
|
| 734 | - preference="general.smoothScroll"/>
|
|
| 734 | + preference="general.smoothScroll"
|
|
| 735 | + hidden="true"/>
|
|
| 735 | 736 | #ifdef MOZ_WIDGET_GTK
|
| 736 | 737 | <checkbox id="useOverlayScrollbars"
|
| 737 | 738 | data-l10n-id="browsing-gtk-use-non-overlay-scrollbars"
|
| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | #include "InputData.h" // for MouseInput, etc
|
| 11 | 11 | #include "InputBlockState.h" // for InputBlockState
|
| 12 | 12 | #include "OverscrollHandoffState.h" // for OverscrollHandoffState
|
| 13 | +#include "nsLayoutUtils.h" // for IsSmoothScrollingEnabled
|
|
| 13 | 14 | #include "mozilla/EventForwards.h"
|
| 14 | 15 | #include "mozilla/dom/WheelEventBinding.h" // for WheelEvent constants
|
| 15 | 16 | #include "mozilla/EventStateManager.h" // for EventStateManager
|
| ... | ... | @@ -270,7 +271,7 @@ APZEventResult APZInputBridge::ReceiveInputEvent( |
| 270 | 271 | if (Maybe<APZWheelAction> action = ActionForWheelEvent(&wheelEvent)) {
|
| 271 | 272 | ScrollWheelInput::ScrollMode scrollMode =
|
| 272 | 273 | ScrollWheelInput::SCROLLMODE_INSTANT;
|
| 273 | - if (StaticPrefs::general_smoothScroll() &&
|
|
| 274 | + if (nsLayoutUtils::IsSmoothScrollingEnabled() &&
|
|
| 274 | 275 | ((wheelEvent.mDeltaMode ==
|
| 275 | 276 | dom::WheelEvent_Binding::DOM_DELTA_LINE &&
|
| 276 | 277 | StaticPrefs::general_smoothScroll_mouseWheel()) ||
|
| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | #include "mozilla/layers/APZPublicUtils.h"
|
| 8 | 8 | |
| 9 | 9 | #include "AsyncPanZoomController.h"
|
| 10 | +#include "nsLayoutUtils.h"
|
|
| 10 | 11 | #include "mozilla/HelperMacros.h"
|
| 11 | 12 | #include "mozilla/StaticPrefs_general.h"
|
| 12 | 13 | |
| ... | ... | @@ -36,9 +37,10 @@ ScrollAnimationBezierPhysicsSettings ComputeBezierAnimationSettingsForOrigin( |
| 36 | 37 | int32_t minMS = 0;
|
| 37 | 38 | int32_t maxMS = 0;
|
| 38 | 39 | bool isOriginSmoothnessEnabled = false;
|
| 40 | + bool isGeneralSmoothnessEnabled = nsLayoutUtils::IsSmoothScrollingEnabled();
|
|
| 39 | 41 | |
| 40 | 42 | #define READ_DURATIONS(prefbase) \
|
| 41 | - isOriginSmoothnessEnabled = StaticPrefs::general_smoothScroll() && \
|
|
| 43 | + isOriginSmoothnessEnabled = isGeneralSmoothnessEnabled && \
|
|
| 42 | 44 | StaticPrefs::general_smoothScroll_##prefbase(); \
|
| 43 | 45 | if (isOriginSmoothnessEnabled) { \
|
| 44 | 46 | minMS = StaticPrefs::general_smoothScroll_##prefbase##_durationMinMS(); \
|
| ... | ... | @@ -88,7 +90,8 @@ ScrollAnimationBezierPhysicsSettings ComputeBezierAnimationSettingsForOrigin( |
| 88 | 90 | }
|
| 89 | 91 | |
| 90 | 92 | ScrollMode GetScrollModeForOrigin(ScrollOrigin origin) {
|
| 91 | - if (!StaticPrefs::general_smoothScroll()) return ScrollMode::Instant;
|
|
| 93 | + bool isSmoothScrollingEnabled = nsLayoutUtils::IsSmoothScrollingEnabled();
|
|
| 94 | + if (!isSmoothScrollingEnabled) return ScrollMode::Instant;
|
|
| 92 | 95 | switch (origin) {
|
| 93 | 96 | case ScrollOrigin::Lines:
|
| 94 | 97 | return StaticPrefs::general_smoothScroll_lines() ? ScrollMode::Smooth
|
| ... | ... | @@ -101,8 +104,8 @@ ScrollMode GetScrollModeForOrigin(ScrollOrigin origin) { |
| 101 | 104 | : ScrollMode::Instant;
|
| 102 | 105 | default:
|
| 103 | 106 | MOZ_ASSERT(false, "Unknown keyboard scroll origin");
|
| 104 | - return StaticPrefs::general_smoothScroll() ? ScrollMode::Smooth
|
|
| 105 | - : ScrollMode::Instant;
|
|
| 107 | + return isSmoothScrollingEnabled ? ScrollMode::Smooth
|
|
| 108 | + : ScrollMode::Instant;
|
|
| 106 | 109 | }
|
| 107 | 110 | }
|
| 108 | 111 |
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | |
| 9 | 9 | #include "AsyncPanZoomController.h"
|
| 10 | 10 | #include "FrameMetrics.h"
|
| 11 | +#include "nsLayoutUtils.h"
|
|
| 11 | 12 | #include "mozilla/layers/APZPublicUtils.h"
|
| 12 | 13 | #include "nsPoint.h"
|
| 13 | 14 | #include "ScrollAnimationPhysics.h"
|
| ... | ... | @@ -28,7 +29,7 @@ GenericScrollAnimation::GenericScrollAnimation(AsyncPanZoomController& aApzc, |
| 28 | 29 | // ScrollAnimationBezierPhysics (despite its name) handles the case of
|
| 29 | 30 | // general.smoothScroll being disabled whereas ScrollAnimationMSDPhysics does
|
| 30 | 31 | // not (ie it scrolls smoothly).
|
| 31 | - if (StaticPrefs::general_smoothScroll() &&
|
|
| 32 | + if (nsLayoutUtils::IsSmoothScrollingEnabled() &&
|
|
| 32 | 33 | StaticPrefs::general_smoothScroll_msdPhysics_enabled()) {
|
| 33 | 34 | mAnimationPhysics = MakeUnique<ScrollAnimationMSDPhysics>(aInitialPosition);
|
| 34 | 35 | } else {
|
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | |
| 9 | 9 | #include <tuple>
|
| 10 | 10 | #include "AsyncPanZoomController.h"
|
| 11 | +#include "nsLayoutUtils.h"
|
|
| 11 | 12 | #include "mozilla/StaticPrefs_general.h"
|
| 12 | 13 | #include "mozilla/layers/APZPublicUtils.h"
|
| 13 | 14 | #include "nsPoint.h"
|
| ... | ... | @@ -35,7 +36,7 @@ WheelScrollAnimation::WheelScrollAnimation( |
| 35 | 36 | ScrollWheelInput::ScrollDeltaType aDeltaType)
|
| 36 | 37 | : GenericScrollAnimation(aApzc, aInitialPosition,
|
| 37 | 38 | OriginForDeltaType(aDeltaType)) {
|
| 38 | - MOZ_ASSERT(StaticPrefs::general_smoothScroll(),
|
|
| 39 | + MOZ_ASSERT(nsLayoutUtils::IsSmoothScrollingEnabled(),
|
|
| 39 | 40 | "We shouldn't be creating a WheelScrollAnimation if smooth "
|
| 40 | 41 | "scrolling is disabled");
|
| 41 | 42 | mDirectionForcedToOverscroll =
|
| ... | ... | @@ -7765,28 +7765,23 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame, |
| 7765 | 7765 | |
| 7766 | 7766 | /* static */
|
| 7767 | 7767 | void nsLayoutUtils::RecomputeSmoothScrollDefault() {
|
| 7768 | + // We want prefers-reduced-motion to determine the default
|
|
| 7769 | + // value of the general.smoothScroll pref. If the user
|
|
| 7770 | + // changed the pref we want to respect the change.
|
|
| 7771 | + Preferences::SetBool(
|
|
| 7772 | + StaticPrefs::GetPrefName_general_smoothScroll(),
|
|
| 7773 | + !LookAndFeel::GetInt(LookAndFeel::IntID::PrefersReducedMotion, 0),
|
|
| 7774 | + PrefValueKind::Default);
|
|
| 7775 | +}
|
|
| 7776 | + |
|
| 7777 | +/* static */
|
|
| 7778 | +bool nsLayoutUtils::IsSmoothScrollingEnabled() {
|
|
| 7768 | 7779 | if (nsContentUtils::ShouldResistFingerprinting(
|
| 7769 | 7780 | "We use the global RFP pref to maintain consistent scroll behavior "
|
| 7770 | 7781 | "in the browser.",
|
| 7771 | 7782 | RFPTarget::CSSPrefersReducedMotion)) {
|
| 7772 | - // When resist fingerprinting is enabled, we should not default disable
|
|
| 7773 | - // smooth scrolls when the user prefers-reduced-motion to avoid leaking
|
|
| 7774 | - // the value of the OS pref to sites.
|
|
| 7775 | - Preferences::SetBool(StaticPrefs::GetPrefName_general_smoothScroll(), true,
|
|
| 7776 | - PrefValueKind::Default);
|
|
| 7777 | - } else {
|
|
| 7778 | - // We want prefers-reduced-motion to determine the default
|
|
| 7779 | - // value of the general.smoothScroll pref. If the user
|
|
| 7780 | - // changed the pref we want to respect the change.
|
|
| 7781 | - Preferences::SetBool(
|
|
| 7782 | - StaticPrefs::GetPrefName_general_smoothScroll(),
|
|
| 7783 | - !LookAndFeel::GetInt(LookAndFeel::IntID::PrefersReducedMotion, 0),
|
|
| 7784 | - PrefValueKind::Default);
|
|
| 7783 | + return true;
|
|
| 7785 | 7784 | }
|
| 7786 | -}
|
|
| 7787 | - |
|
| 7788 | -/* static */
|
|
| 7789 | -bool nsLayoutUtils::IsSmoothScrollingEnabled() {
|
|
| 7790 | 7785 | return StaticPrefs::general_smoothScroll();
|
| 7791 | 7786 | }
|
| 7792 | 7787 |
| ... | ... | @@ -1535,7 +1535,7 @@ void nsSliderFrame::PageScroll(bool aClickAndHold) { |
| 1535 | 1535 | |
| 1536 | 1536 | mCurrentClickHoldDestination = Some(pos);
|
| 1537 | 1537 | sf->ScrollTo(pos,
|
| 1538 | - StaticPrefs::general_smoothScroll() &&
|
|
| 1538 | + nsLayoutUtils::IsSmoothScrollingEnabled() &&
|
|
| 1539 | 1539 | StaticPrefs::general_smoothScroll_pages()
|
| 1540 | 1540 | ? ScrollMode::Smooth
|
| 1541 | 1541 | : ScrollMode::Instant,
|
| ... | ... | @@ -3266,7 +3266,7 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) { |
| 3266 | 3266 | } else {
|
| 3267 | 3267 | ScrollWheelInput::ScrollMode scrollMode =
|
| 3268 | 3268 | ScrollWheelInput::SCROLLMODE_INSTANT;
|
| 3269 | - if (StaticPrefs::general_smoothScroll() &&
|
|
| 3269 | + if (nsLayoutUtils::IsSmoothScrollingEnabled() &&
|
|
| 3270 | 3270 | StaticPrefs::general_smoothScroll_mouseWheel()) {
|
| 3271 | 3271 | scrollMode = ScrollWheelInput::SCROLLMODE_SMOOTH;
|
| 3272 | 3272 | }
|