From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- layout/generic/ScrollAnimationMSDPhysics.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'layout/generic/ScrollAnimationMSDPhysics.cpp') diff --git a/layout/generic/ScrollAnimationMSDPhysics.cpp b/layout/generic/ScrollAnimationMSDPhysics.cpp index de67f9c59a..8f0ae32d3b 100644 --- a/layout/generic/ScrollAnimationMSDPhysics.cpp +++ b/layout/generic/ScrollAnimationMSDPhysics.cpp @@ -5,7 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "ScrollAnimationMSDPhysics.h" +#include "mozilla/Logging.h" #include "mozilla/StaticPrefs_general.h" +#include "mozilla/ToString.h" + +static mozilla::LazyLogModule sApzMsdLog("apz.msd"); +#define MSD_LOG(...) MOZ_LOG(sApzMsdLog, LogLevel::Debug, (__VA_ARGS__)) using namespace mozilla; @@ -108,13 +113,17 @@ double ScrollAnimationMSDPhysics::ComputeSpringConstant( } void ScrollAnimationMSDPhysics::SimulateUntil(const TimeStamp& aTime) { - if (!mLastSimulatedTime || aTime < mLastSimulatedTime) { + if (!mLastSimulatedTime || aTime <= mLastSimulatedTime) { return; } TimeDuration delta = aTime - mLastSimulatedTime; mModelX.Simulate(delta); mModelY.Simulate(delta); mLastSimulatedTime = aTime; + MSD_LOG("Simulated for duration %f, finished %d position %s velocity %s\n", + delta.ToMilliseconds(), IsFinished(aTime), + ToString(CSSPoint::FromAppUnits(PositionAt(aTime))).c_str(), + ToString(CSSPoint::FromAppUnits(VelocityAt(aTime))).c_str()); } nsPoint ScrollAnimationMSDPhysics::PositionAt(const TimeStamp& aTime) { @@ -152,6 +161,9 @@ ScrollAnimationMSDPhysics::NonOscillatingAxisPhysicsMSDModel:: ClampVelocityToMaximum(aInitialVelocity, aInitialPosition, aInitialDestination, aSpringConstant), aSpringConstant, aDampingRatio) { + MSD_LOG("Constructing axis physics model with parameters %f %f %f %f %f\n", + aInitialPosition, aInitialDestination, aInitialVelocity, + aSpringConstant, aDampingRatio); MOZ_ASSERT(aDampingRatio >= 1.0, "Damping ratio must be >= 1.0 to avoid oscillation"); } -- cgit v1.2.3