Backed out 2 changesets (bug 1753565) for GTest failure on MultipleSmoothScrollsSmooth . CLOSED TREE

Backed out changeset d454667254ed (bug 1753565)
Backed out changeset 1c5305d4d10a (bug 1753565)
This commit is contained in:
Narcis Beleuzu 2023-04-24 20:58:57 +03:00
parent cfcf4ebb8e
commit f8f8179943
7 changed files with 10 additions and 45 deletions

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,22 +7769,6 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame,
return total;
}
/* static */
void nsLayoutUtils::RecomputeSmoothScrollDefault() {
// We want prefers-reduced-motion to determine the default
// value of the general.smoothScroll pref. If the user
// changed the pref we want to respect the change.
Preferences::SetBool(
"general.smoothScroll",
!LookAndFeel::GetInt(LookAndFeel::IntID::PrefersReducedMotion, 0),
PrefValueKind::Default);
}
/* static */
bool nsLayoutUtils::IsSmoothScrollingEnabled() {
return StaticPrefs::general_smoothScroll();
}
/* static */
void nsLayoutUtils::Initialize() {
nsComputedDOMStyle::RegisterPrefChangeCallbacks();

View File

@ -3039,19 +3039,6 @@ class nsLayoutUtils {
**/
static nsIFrame* GetNearestOverflowClipFrame(nsIFrame* aFrame);
/*
* Returns true if the user's preferences allow for smooth scrolling.
*/
static bool IsSmoothScrollingEnabled();
/*
* Recompute the default value of general.smoothScroll based on
* the system settings for prefers-reduced-motion.
*
* Note: Must only be called from the main thread.
*/
static void RecomputeSmoothScrollDefault();
private:
/**
* Helper function for LogTestDataForPaint().

View File

@ -2234,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
@ -2555,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);
@ -7899,7 +7903,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

@ -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("general.smoothScroll", true);

View File

@ -83,5 +83,3 @@ user_pref("remote.experimental.enabled", true);
user_pref("privacy.partition.always_partition_third_party_non_cookie_storage", false);
// Disable OCSP checks in WPT (webtransport triggers these occasionally)
user_pref("security.OCSP.enabled", 0);
// Disable prefers-reduced-motion to ensure that smooth scrolls can be tested.
user_pref("general.smoothScroll", true);

View File

@ -17,7 +17,6 @@
#include "nsFont.h"
#include "nsIFrame.h"
#include "nsIXULRuntime.h"
#include "nsLayoutUtils.h"
#include "Theme.h"
#include "SurfaceCacheUtils.h"
#include "mozilla/dom/ContentParent.h"
@ -550,10 +549,6 @@ void nsXPLookAndFeel::Init() {
RecomputeColorSchemes();
if (XRE_IsParentProcess()) {
nsLayoutUtils::RecomputeSmoothScrollDefault();
}
// XXX If we could reorganize the pref names, we should separate the branch
// for each types. Then, we could reduce the unnecessary loop from
// nsXPLookAndFeel::OnPrefChanged().
@ -1175,9 +1170,8 @@ void nsXPLookAndFeel::RefreshImpl() {
sIntCache.Clear();
RecomputeColorSchemes();
// Clear any cached FullLookAndFeel data, which is now invalid.
if (XRE_IsParentProcess()) {
nsLayoutUtils::RecomputeSmoothScrollDefault();
// Clear any cached FullLookAndFeel data, which is now invalid.
widget::RemoteLookAndFeel::ClearCachedData();
}
}