Backed out 2 changesets (bug 1753565) for causing bc failures in browser_proton_moreTools_panel.js CLOSED TREE

Backed out changeset 817b0cf1e4e0 (bug 1753565)
Backed out changeset 947534ff1319 (bug 1753565)
This commit is contained in:
Cristian Tuns 2023-04-18 02:03:20 -04:00
parent 5b6634089f
commit f65f34399a
21 changed files with 48 additions and 117 deletions

View file

@ -862,7 +862,6 @@ struct ScrollMetadata {
mForceMousewheelAutodir(false),
mForceMousewheelAutodirHonourRoot(false),
mIsPaginatedPresentation(false),
mPrefersReducedMotion(false),
mOverscrollBehavior() {}
bool operator==(const ScrollMetadata& aOther) const {
@ -882,7 +881,6 @@ struct ScrollMetadata {
mForceMousewheelAutodirHonourRoot ==
aOther.mForceMousewheelAutodirHonourRoot &&
mIsPaginatedPresentation == aOther.mIsPaginatedPresentation &&
mPrefersReducedMotion == aOther.mPrefersReducedMotion &&
mDisregardedDirection == aOther.mDisregardedDirection &&
mOverscrollBehavior == aOther.mOverscrollBehavior &&
mScrollUpdates == aOther.mScrollUpdates;
@ -967,9 +965,6 @@ struct ScrollMetadata {
}
bool IsPaginatedPresentation() const { return mIsPaginatedPresentation; }
void SetPrefersReducedMotion(bool aValue) { mPrefersReducedMotion = aValue; }
bool PrefersReducedMotion() const { return mPrefersReducedMotion; }
bool DidContentGetPainted() const { return mDidContentGetPainted; }
private:
@ -1084,10 +1079,6 @@ struct ScrollMetadata {
// to different transforms, which constrains the assumptions APZ can make.
bool mIsPaginatedPresentation : 1;
// Whether the user has the prefers-reduced-motion system setting
// enabled.
bool mPrefersReducedMotion : 1;
// The disregarded direction means the direction which is disregarded anyway,
// even if the scroll frame overflows in that direction and the direction is
// specified as scrollable. This could happen in some scenarios, for instance,

View file

@ -66,14 +66,13 @@ gfx::IntSize GetDisplayportAlignmentMultiplier(const ScreenSize& aBaseSize);
* given origin, based on pref values.
*/
ScrollAnimationBezierPhysicsSettings ComputeBezierAnimationSettingsForOrigin(
ScrollOrigin aOrigin, bool aSmoothScrollingEnabled);
ScrollOrigin aOrigin);
/**
* Calculate if the scrolling should be instant or smooth based based on
* preferences and the origin
*/
ScrollMode GetScrollModeForOrigin(ScrollOrigin origin,
bool aSmoothScrollingEnabled);
ScrollMode GetScrollModeForOrigin(ScrollOrigin origin);
} // namespace apz

View file

@ -22,7 +22,6 @@
#include "mozilla/TouchEvents.h" // for WidgetTouchEvent
#include "mozilla/WheelHandlingHelper.h" // for WheelDeltaHorizontalizer,
// WheelDeltaAdjustmentStrategy
#include "nsLayoutUtils.h" // for IsSmoothScrollingEnabled
namespace mozilla {
namespace layers {
@ -229,7 +228,7 @@ APZEventResult APZInputBridge::ReceiveInputEvent(
if (Maybe<APZWheelAction> action = ActionForWheelEvent(&wheelEvent)) {
ScrollWheelInput::ScrollMode scrollMode =
ScrollWheelInput::SCROLLMODE_INSTANT;
if (nsLayoutUtils::IsSmoothScrollingEnabled() &&
if (StaticPrefs::general_smoothScroll() &&
((wheelEvent.mDeltaMode ==
dom::WheelEvent_Binding::DOM_DELTA_LINE &&
StaticPrefs::general_smoothScroll_mouseWheel()) ||

View file

@ -32,13 +32,13 @@ namespace apz {
}
ScrollAnimationBezierPhysicsSettings ComputeBezierAnimationSettingsForOrigin(
ScrollOrigin aOrigin, bool aSmoothScrollingEnabled) {
ScrollOrigin aOrigin) {
int32_t minMS = 0;
int32_t maxMS = 0;
bool isOriginSmoothnessEnabled = false;
#define READ_DURATIONS(prefbase) \
isOriginSmoothnessEnabled = aSmoothScrollingEnabled && \
isOriginSmoothnessEnabled = StaticPrefs::general_smoothScroll() && \
StaticPrefs::general_smoothScroll_##prefbase(); \
if (isOriginSmoothnessEnabled) { \
minMS = StaticPrefs::general_smoothScroll_##prefbase##_durationMinMS(); \
@ -87,9 +87,8 @@ ScrollAnimationBezierPhysicsSettings ComputeBezierAnimationSettingsForOrigin(
return ScrollAnimationBezierPhysicsSettings{minMS, maxMS, intervalRatio};
}
ScrollMode GetScrollModeForOrigin(ScrollOrigin origin,
bool aSmoothScrollingEnabled) {
if (!aSmoothScrollingEnabled) return ScrollMode::Instant;
ScrollMode GetScrollModeForOrigin(ScrollOrigin origin) {
if (!StaticPrefs::general_smoothScroll()) return ScrollMode::Instant;
switch (origin) {
case ScrollOrigin::Lines:
return StaticPrefs::general_smoothScroll_lines() ? ScrollMode::Smooth
@ -102,7 +101,8 @@ ScrollMode GetScrollModeForOrigin(ScrollOrigin origin,
: ScrollMode::Instant;
default:
MOZ_ASSERT(false, "Unknown keyboard scroll origin");
return ScrollMode::Instant;
return StaticPrefs::general_smoothScroll() ? ScrollMode::Smooth
: ScrollMode::Instant;
}
}

View file

@ -2041,8 +2041,7 @@ nsEventStatus AsyncPanZoomController::OnKeyboard(const KeyboardInput& aEvent) {
SmoothScrollAnimation::GetScrollOriginForAction(aEvent.mAction.mType);
Maybe<CSSSnapTarget> snapTarget = MaybeAdjustDestinationForScrollSnapping(
aEvent, destination, GetScrollSnapFlagsForKeyboardAction(aEvent.mAction));
ScrollMode scrollMode =
apz::GetScrollModeForOrigin(scrollOrigin, IsSmoothScrollingEnabled());
ScrollMode scrollMode = apz::GetScrollModeForOrigin(scrollOrigin);
RecordScrollPayload(aEvent.mTimeStamp);
// If the scrolling is instant, then scroll immediately to the destination
@ -3555,12 +3554,6 @@ void AsyncPanZoomController::UpdateWithTouchAtDevicePoint(
mY.UpdateWithTouchAtDevicePoint(point.y, aEvent.mTimeStamp);
}
bool AsyncPanZoomController::IsSmoothScrollingEnabled() const {
RecursiveMutexAutoLock lock(mRecursiveMutex);
return StaticPrefs::general_smoothScroll_DoNotUseDirectly() &&
!mScrollMetadata.PrefersReducedMotion();
}
Maybe<CompositionPayload> AsyncPanZoomController::NotifyScrollSampling() {
RecursiveMutexAutoLock lock(mRecursiveMutex);
return mSampledState.front().TakeScrollPayload();
@ -5449,8 +5442,6 @@ void AsyncPanZoomController::NotifyLayersUpdated(
aScrollMetadata.GetDisregardedDirection());
mScrollMetadata.SetOverscrollBehavior(
aScrollMetadata.GetOverscrollBehavior());
mScrollMetadata.SetPrefersReducedMotion(
aScrollMetadata.PrefersReducedMotion());
}
bool scrollOffsetUpdated = false;

View file

@ -20,7 +20,6 @@
#include "mozilla/RefPtr.h"
#include "mozilla/ScrollTypes.h"
#include "mozilla/StaticPrefs_apz.h"
#include "mozilla/StaticPrefs_general.h"
#include "mozilla/UniquePtr.h"
#include "InputData.h"
#include "Axis.h" // for Axis, Side, etc.
@ -1137,12 +1136,6 @@ class AsyncPanZoomController {
friend class Axis;
public:
/**
* Returns true if smooth scrolls are enabled and the user does not
* prefer reduced motion.
*/
bool IsSmoothScrollingEnabled() const;
Maybe<CompositionPayload> NotifyScrollSampling();
/**

View file

@ -21,10 +21,10 @@ GenericScrollAnimation::GenericScrollAnimation(
AsyncPanZoomController& aApzc, const nsPoint& aInitialPosition,
const ScrollAnimationBezierPhysicsSettings& aSettings)
: mApzc(aApzc), mFinalDestination(aInitialPosition) {
// ScrollAnimationBezierPhysics (despite its name) handles the case of
// ScrollAnimationBezierPhysics (despite it's name) handles the case of
// general.smoothScroll being disabled whereas ScrollAnimationMSDPhysics does
// not (ie it scrolls smoothly).
if (aApzc.IsSmoothScrollingEnabled() &&
if (StaticPrefs::general_smoothScroll() &&
StaticPrefs::general_smoothScroll_msdPhysics_enabled()) {
mAnimationPhysics = MakeUnique<ScrollAnimationMSDPhysics>(aInitialPosition);
} else {

View file

@ -7,7 +7,6 @@
#include "SmoothScrollAnimation.h"
#include "ScrollAnimationBezierPhysics.h"
#include "mozilla/layers/APZPublicUtils.h"
#include "AsyncPanZoomController.h"
namespace mozilla {
namespace layers {
@ -15,9 +14,9 @@ namespace layers {
SmoothScrollAnimation::SmoothScrollAnimation(AsyncPanZoomController& aApzc,
const nsPoint& aInitialPosition,
ScrollOrigin aOrigin)
: GenericScrollAnimation(aApzc, aInitialPosition,
apz::ComputeBezierAnimationSettingsForOrigin(
aOrigin, aApzc.IsSmoothScrollingEnabled())),
: GenericScrollAnimation(
aApzc, aInitialPosition,
apz::ComputeBezierAnimationSettingsForOrigin(aOrigin)),
mOrigin(aOrigin) {}
SmoothScrollAnimation* SmoothScrollAnimation::AsSmoothScrollAnimation() {

View file

@ -62,12 +62,10 @@ async function test() {
await scrollendPromise;
// If general.smoothScroll is set and the user does not prefer reduced motion,
// the behavior of the scroll should be "smooth". If general.smoothScroll is
// disabled, we should respect it and the scrolls should instant regardless of
// the specified behavior.
if (SpecialPowers.getBoolPref("general.smoothScroll") &&
SpecialPowers.getIntPref("ui.prefersReducedMotion") == 0) {
// If general.smoothScroll is set, the behavior of the scroll should be
// "smooth". If general.smoothScroll is disabled, we should respect it and
// the scrolls should instant regardless of the specified behavior.
if (SpecialPowers.getBoolPref("general.smoothScroll")) {
info("final enabled scroll count: " + scrollCount);
ok(scrollCount > 1, "The programmatic scroll should create more than one scroll event");
} else {

View file

@ -9,20 +9,19 @@
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
let preferenceSets = [
[["general.smoothScroll", true], ["ui.prefersReducedMotion", 0]],
[["general.smoothScroll", false], ["ui.prefersReducedMotion", 0]],
[["general.smoothScroll", true], ["ui.prefersReducedMotion", 1]],
];
let smoothScrollEnabled = [["general.smoothScroll", true]];
let smoothScrollDisabled = [["general.smoothScroll", false]];
let subtests = preferenceSets.flatMap((prefs) => {
return [
{"file": "helper_programmatic_scroll_behavior.html?action=scrollIntoView", "prefs": prefs},
{"file": "helper_programmatic_scroll_behavior.html?action=scrollBy", "prefs": prefs},
{"file": "helper_programmatic_scroll_behavior.html?action=scrollTo", "prefs": prefs},
{"file": "helper_programmatic_scroll_behavior.html?action=scroll", "prefs": prefs},
];
});
var subtests = [
{"file": "helper_programmatic_scroll_behavior.html?action=scrollIntoView", "prefs": smoothScrollEnabled},
{"file": "helper_programmatic_scroll_behavior.html?action=scrollIntoView", "prefs": smoothScrollDisabled},
{"file": "helper_programmatic_scroll_behavior.html?action=scrollBy", "prefs": smoothScrollEnabled},
{"file": "helper_programmatic_scroll_behavior.html?action=scrollBy", "prefs": smoothScrollDisabled},
{"file": "helper_programmatic_scroll_behavior.html?action=scrollTo", "prefs": smoothScrollEnabled},
{"file": "helper_programmatic_scroll_behavior.html?action=scrollTo", "prefs": smoothScrollDisabled},
{"file": "helper_programmatic_scroll_behavior.html?action=scroll", "prefs": smoothScrollEnabled},
{"file": "helper_programmatic_scroll_behavior.html?action=scroll", "prefs": smoothScrollDisabled},
];
if (isApzEnabled()) {
SimpleTest.waitForExplicitFinish();

View file

@ -10,8 +10,6 @@
var basePrefs = [
["apz.test.mac.synth_wheel_input", true],
["general.smoothScroll", true],
["ui.prefersReducedMotion", 0],
];
var scrollendDisabledPrefs = [
@ -25,8 +23,8 @@ var prefs = [
];
var smoothScrollDisabled = [
["apz.test.mac.synth_wheel_input", true],
["general.smoothScroll", false],
...basePrefs,
["general.smoothScroll", true],
];
var subtests = [

View file

@ -571,7 +571,6 @@ struct ParamTraits<mozilla::layers::ScrollMetadata>
WriteParam(aWriter, aParam.mForceMousewheelAutodir);
WriteParam(aWriter, aParam.mForceMousewheelAutodirHonourRoot);
WriteParam(aWriter, aParam.mIsPaginatedPresentation);
WriteParam(aWriter, aParam.mPrefersReducedMotion);
WriteParam(aWriter, aParam.mDisregardedDirection);
WriteParam(aWriter, aParam.mOverscrollBehavior);
WriteParam(aWriter, aParam.mScrollUpdates);
@ -615,8 +614,6 @@ struct ParamTraits<mozilla::layers::ScrollMetadata>
&paramType::SetForceMousewheelAutodirHonourRoot) &&
ReadBoolForBitfield(aReader, aResult,
&paramType::SetIsPaginatedPresentation) &&
ReadBoolForBitfield(aReader, aResult,
&paramType::SetPrefersReducedMotion) &&
ReadParam(aReader, &aResult->mDisregardedDirection) &&
ReadParam(aReader, &aResult->mOverscrollBehavior) &&
ReadParam(aReader, &aResult->mScrollUpdates);

View file

@ -2367,8 +2367,7 @@ NS_IMETHODIMP
PresShell::ScrollPage(bool aForward) {
nsIScrollableFrame* scrollFrame =
GetScrollableFrameToScroll(VerticalScrollDirection);
ScrollMode scrollMode = apz::GetScrollModeForOrigin(
ScrollOrigin::Pages, nsLayoutUtils::IsSmoothScrollingEnabled());
ScrollMode scrollMode = apz::GetScrollModeForOrigin(ScrollOrigin::Pages);
if (scrollFrame) {
scrollFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1), ScrollUnit::PAGES,
scrollMode, nullptr,
@ -2384,8 +2383,7 @@ NS_IMETHODIMP
PresShell::ScrollLine(bool aForward) {
nsIScrollableFrame* scrollFrame =
GetScrollableFrameToScroll(VerticalScrollDirection);
ScrollMode scrollMode = apz::GetScrollModeForOrigin(
ScrollOrigin::Lines, nsLayoutUtils::IsSmoothScrollingEnabled());
ScrollMode scrollMode = apz::GetScrollModeForOrigin(ScrollOrigin::Lines);
if (scrollFrame) {
nsRect scrollPort = scrollFrame->GetScrollPortRect();
nsSize lineSize = scrollFrame->GetLineScrollAmount();
@ -2405,8 +2403,7 @@ NS_IMETHODIMP
PresShell::ScrollCharacter(bool aRight) {
nsIScrollableFrame* scrollFrame =
GetScrollableFrameToScroll(HorizontalScrollDirection);
ScrollMode scrollMode = apz::GetScrollModeForOrigin(
ScrollOrigin::Lines, nsLayoutUtils::IsSmoothScrollingEnabled());
ScrollMode scrollMode = apz::GetScrollModeForOrigin(ScrollOrigin::Lines);
if (scrollFrame) {
int32_t h = StaticPrefs::toolkit_scrollbox_horizontalScrollDistance();
scrollFrame->ScrollBy(
@ -2421,8 +2418,7 @@ NS_IMETHODIMP
PresShell::CompleteScroll(bool aForward) {
nsIScrollableFrame* scrollFrame =
GetScrollableFrameToScroll(VerticalScrollDirection);
ScrollMode scrollMode = apz::GetScrollModeForOrigin(
ScrollOrigin::Other, nsLayoutUtils::IsSmoothScrollingEnabled());
ScrollMode scrollMode = apz::GetScrollModeForOrigin(ScrollOrigin::Other);
if (scrollFrame) {
scrollFrame->ScrollBy(
nsIntPoint(0, aForward ? 1 : -1), ScrollUnit::WHOLE, scrollMode,

View file

@ -85,7 +85,6 @@
#include "mozilla/StaticPrefs_apz.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/StaticPrefs_font.h"
#include "mozilla/StaticPrefs_general.h"
#include "mozilla/StaticPrefs_gfx.h"
#include "mozilla/StaticPrefs_image.h"
#include "mozilla/StaticPrefs_layers.h"
@ -7770,16 +7769,6 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame,
return total;
}
bool nsLayoutUtils::PrefersReducedMotion() {
MOZ_ASSERT(NS_IsMainThread());
return LookAndFeel::GetInt(LookAndFeel::IntID::PrefersReducedMotion, 0) == 1;
}
bool nsLayoutUtils::IsSmoothScrollingEnabled() {
return StaticPrefs::general_smoothScroll_DoNotUseDirectly() &&
!PrefersReducedMotion();
}
/* static */
void nsLayoutUtils::Initialize() {
nsComputedDOMStyle::RegisterPrefChangeCallbacks();
@ -9008,7 +8997,6 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata(
metadata.SetIsPaginatedPresentation(presContext->Type() !=
nsPresContext::eContext_Galley);
metadata.SetPrefersReducedMotion(PrefersReducedMotion());
return metadata;
}

View file

@ -3039,21 +3039,6 @@ class nsLayoutUtils {
**/
static nsIFrame* GetNearestOverflowClipFrame(nsIFrame* aFrame);
/**
* Returns true if the user's preferences and system settings allow for smooth
* scrolling.
*
* Note: Must only be called on the main thread.
*/
static bool IsSmoothScrollingEnabled();
/**
* Returns true if the user's system settings prefer reduced motion.
*
* Note: Must only be called on the main thread.
*/
static bool PrefersReducedMotion();
private:
/**
* Helper function for LogTestDataForPaint().

View file

@ -2222,8 +2222,7 @@ void nsHTMLScrollFrame::AsyncScroll::InitSmoothScroll(
MakeUnique<ScrollAnimationMSDPhysics>(aInitialPosition);
} else {
ScrollAnimationBezierPhysicsSettings settings =
layers::apz::ComputeBezierAnimationSettingsForOrigin(
mOrigin, nsLayoutUtils::IsSmoothScrollingEnabled());
layers::apz::ComputeBezierAnimationSettingsForOrigin(mOrigin);
mAnimationPhysics =
MakeUnique<ScrollAnimationBezierPhysics>(aInitialPosition, settings);
}
@ -2235,6 +2234,11 @@ void nsHTMLScrollFrame::AsyncScroll::InitSmoothScroll(
mAnimationPhysics->Update(aTime, aDestination, aCurrentVelocity);
}
/* static */
bool nsHTMLScrollFrame::IsSmoothScrollingEnabled() {
return StaticPrefs::general_smoothScroll();
}
/*
* Callback function from AsyncSmoothMSDScroll, used in
* nsHTMLScrollFrame::ScrollTo
@ -2556,8 +2560,7 @@ void nsHTMLScrollFrame::ScrollToWithOrigin(nsPoint aScrollPosition,
mAsyncScroll->SetRefreshObserver(this);
}
const bool isSmoothScroll =
aParams.IsSmooth() && nsLayoutUtils::IsSmoothScrollingEnabled();
const bool isSmoothScroll = aParams.IsSmooth() && IsSmoothScrollingEnabled();
if (isSmoothScroll) {
mAsyncScroll->InitSmoothScroll(now, GetScrollPosition(), mDestination,
aParams.mOrigin, range, currentVelocity);
@ -7913,7 +7916,7 @@ bool nsHTMLScrollFrame::IsSmoothScroll(dom::ScrollBehavior aBehavior) const {
// smooth scrolls. A requested smooth scroll when smooth scrolling is
// disabled should be equivalent to an instant scroll.
if (aBehavior == dom::ScrollBehavior::Instant ||
!nsLayoutUtils::IsSmoothScrollingEnabled()) {
!nsHTMLScrollFrame::IsSmoothScrollingEnabled()) {
return false;
}

View file

@ -538,6 +538,8 @@ class nsHTMLScrollFrame : public nsContainerFrame,
void PostScrolledAreaEvent();
MOZ_CAN_RUN_SCRIPT void FireScrolledAreaEvent();
static bool IsSmoothScrollingEnabled();
/**
* @note This method might destroy the frame, pres shell and other objects.
*/

View file

@ -5442,7 +5442,6 @@
type: RelaxedAtomicBool
value: true
mirror: always
do_not_use_directly: true
# This pref and general.smoothScroll.stopDecelerationWeighting determine
# the timing function.

View file

@ -13,6 +13,3 @@ user_pref("javascript.options.asyncstack_capture_debuggee_only", false);
// is suppressed, synthetic click events and co. go to the old page, which can
// be confusing for tests that send click events before the first paint.
user_pref("nglayout.initialpaint.unsuppress_with_no_background", true);
// Disable prefers-reduced-motion to ensure that smooth scrolls can be tested.
user_pref("ui.prefersReducedMotion", 0);

View file

@ -81,5 +81,3 @@ user_pref("layout.css.font-loading-api.workers.enabled", true);
user_pref("remote.experimental.enabled", true);
// Disable always partitioning storage with the Storage Access API
user_pref("privacy.partition.always_partition_third_party_non_cookie_storage", false);
// Disable prefers-reduced-motion to ensure that smooth scrolls can be tested.
user_pref("ui.prefersReducedMotion", 0);

View file

@ -3189,8 +3189,7 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
geckoChildDeathGrip->DispatchAPZWheelInputEvent(wheelEvent);
} else {
ScrollWheelInput::ScrollMode scrollMode = ScrollWheelInput::SCROLLMODE_INSTANT;
if (nsLayoutUtils::IsSmoothScrollingEnabled() &&
StaticPrefs::general_smoothScroll_mouseWheel()) {
if (StaticPrefs::general_smoothScroll() && StaticPrefs::general_smoothScroll_mouseWheel()) {
scrollMode = ScrollWheelInput::SCROLLMODE_SMOOTH;
}
ScrollWheelInput wheelEvent(eventTimeStamp, modifiers, scrollMode,