Diff
Modified: trunk/Source/WebCore/ChangeLog (285386 => 285387)
--- trunk/Source/WebCore/ChangeLog 2021-11-06 23:39:51 UTC (rev 285386)
+++ trunk/Source/WebCore/ChangeLog 2021-11-06 23:58:42 UTC (rev 285387)
@@ -1,3 +1,39 @@
+2021-11-06 Simon Fraser <[email protected]>
+
+ Improve ScrollAnimation logging
+ https://bugs.webkit.org/show_bug.cgi?id=232789
+
+ Reviewed by Wenson Hsieh.
+
+ Add ScrollAnimation::debugDescription() and implement in concrete subclasses so each
+ can dump more information about the animation. In particular, the destination of
+ a momentum scroll is useful for debugging.
+
+ Improve logging at some locations that start animations.
+
+ * platform/ScrollAnimation.cpp:
+ (WebCore::operator<<):
+ * platform/ScrollAnimation.h:
+ * platform/ScrollAnimationKinetic.cpp:
+ (WebCore::ScrollAnimationKinetic::debugDescription const):
+ * platform/ScrollAnimationKinetic.h:
+ * platform/ScrollAnimationMomentum.cpp:
+ (WebCore::ScrollAnimationMomentum::debugDescription const):
+ * platform/ScrollAnimationMomentum.h:
+ * platform/ScrollAnimationSmooth.cpp:
+ (WebCore::ScrollAnimationSmooth::debugDescription const):
+ * platform/ScrollAnimationSmooth.h:
+ * platform/ScrollingEffectsController.cpp:
+ (WebCore::ScrollingEffectsController::startAnimatedScrollToDestination):
+ (WebCore::ScrollingEffectsController::startMomentumScrollWithInitialVelocity):
+ * platform/ScrollingEffectsController.h:
+ * platform/mac/ScrollAnimationRubberBand.h:
+ * platform/mac/ScrollAnimationRubberBand.mm:
+ (WebCore::ScrollAnimationRubberBand::debugDescription const):
+ * platform/mac/ScrollingEffectsController.mm:
+ (WebCore::ScrollingEffectsController::startRubberBandAnimation): The return value isn't used
+ by the caller but is a convenient way to avoid an unused variable warning.
+
2021-11-06 Myles C. Maxfield <[email protected]>
Fixing style checks in WebGPU bindings code
Modified: trunk/Source/WebCore/platform/ScrollAnimation.cpp (285386 => 285387)
--- trunk/Source/WebCore/platform/ScrollAnimation.cpp 2021-11-06 23:39:51 UTC (rev 285386)
+++ trunk/Source/WebCore/platform/ScrollAnimation.cpp 2021-11-06 23:58:42 UTC (rev 285387)
@@ -43,7 +43,7 @@
TextStream& operator<<(TextStream& ts, const ScrollAnimation& animation)
{
- ts << "ScrollAnimation " << &animation << " " << animation.type() << " active " << animation.isActive() << " current offset " << animation.currentOffset();
+ ts << animation.debugDescription();
return ts;
}
Modified: trunk/Source/WebCore/platform/ScrollAnimation.h (285386 => 285387)
--- trunk/Source/WebCore/platform/ScrollAnimation.h 2021-11-06 23:39:51 UTC (rev 285386)
+++ trunk/Source/WebCore/platform/ScrollAnimation.h 2021-11-06 23:58:42 UTC (rev 285387)
@@ -82,6 +82,8 @@
virtual void serviceAnimation(MonotonicTime) = 0;
+ virtual String debugDescription() const = 0;
+
protected:
void didStart(MonotonicTime currentTime)
{
Modified: trunk/Source/WebCore/platform/ScrollAnimationKinetic.cpp (285386 => 285387)
--- trunk/Source/WebCore/platform/ScrollAnimationKinetic.cpp 2021-11-06 23:39:51 UTC (rev 285386)
+++ trunk/Source/WebCore/platform/ScrollAnimationKinetic.cpp 2021-11-06 23:58:42 UTC (rev 285387)
@@ -29,6 +29,7 @@
#include "PlatformWheelEvent.h"
#include "ScrollExtents.h"
+#include <wtf/text/TextStream.h>
/*
* PerAxisData is a port of GtkKineticScrolling as of GTK+ 3.20,
@@ -224,4 +225,12 @@
didEnd();
}
+String ScrollAnimationKinetic::debugDescription() const
+{
+ TextStream textStream;
+ textStream << "ScrollAnimationKinetic " << this << " active " << isActive() << " current offset " << currentOffset();
+ return textStream.release();
+}
+
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/ScrollAnimationKinetic.h (285386 => 285387)
--- trunk/Source/WebCore/platform/ScrollAnimationKinetic.h 2021-11-06 23:39:51 UTC (rev 285386)
+++ trunk/Source/WebCore/platform/ScrollAnimationKinetic.h 2021-11-06 23:58:42 UTC (rev 285387)
@@ -70,6 +70,7 @@
private:
void serviceAnimation(MonotonicTime) final;
+ String debugDescription() const final;
std::optional<PerAxisData> m_horizontalData;
std::optional<PerAxisData> m_verticalData;
Modified: trunk/Source/WebCore/platform/ScrollAnimationMomentum.cpp (285386 => 285387)
--- trunk/Source/WebCore/platform/ScrollAnimationMomentum.cpp 2021-11-06 23:39:51 UTC (rev 285386)
+++ trunk/Source/WebCore/platform/ScrollAnimationMomentum.cpp 2021-11-06 23:58:42 UTC (rev 285387)
@@ -111,4 +111,11 @@
retargetActiveAnimation(constrainedOffset);
}
+String ScrollAnimationMomentum::debugDescription() const
+{
+ TextStream textStream;
+ textStream << "ScrollAnimationMomentum " << this << " active " << isActive() << " destination " << (m_momentumCalculator ? m_momentumCalculator->destinationScrollOffset() : FloatPoint()) << " current offset " << currentOffset();
+ return textStream.release();
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/ScrollAnimationMomentum.h (285386 => 285387)
--- trunk/Source/WebCore/platform/ScrollAnimationMomentum.h 2021-11-06 23:39:51 UTC (rev 285386)
+++ trunk/Source/WebCore/platform/ScrollAnimationMomentum.h 2021-11-06 23:58:42 UTC (rev 285387)
@@ -42,6 +42,8 @@
void updateScrollExtents() final;
private:
+ String debugDescription() const final;
+
std::unique_ptr<ScrollingMomentumCalculator> m_momentumCalculator;
};
Modified: trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp (285386 => 285387)
--- trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp 2021-11-06 23:39:51 UTC (rev 285386)
+++ trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp 2021-11-06 23:58:42 UTC (rev 285387)
@@ -33,6 +33,7 @@
#include "ScrollExtents.h"
#include "ScrollableArea.h"
#include "TimingFunction.h"
+#include <wtf/text/TextStream.h>
namespace WebCore {
@@ -128,4 +129,11 @@
return currentTime < endTime;
}
+String ScrollAnimationSmooth::debugDescription() const
+{
+ TextStream textStream;
+ textStream << "ScrollAnimationSmooth " << this << " active " << isActive() << " from " << m_startOffset << " to " << m_destinationOffset << " current offset " << currentOffset();
+ return textStream.release();
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/ScrollAnimationSmooth.h (285386 => 285387)
--- trunk/Source/WebCore/platform/ScrollAnimationSmooth.h 2021-11-06 23:39:51 UTC (rev 285386)
+++ trunk/Source/WebCore/platform/ScrollAnimationSmooth.h 2021-11-06 23:58:42 UTC (rev 285387)
@@ -47,6 +47,7 @@
void updateScrollExtents() final;
void serviceAnimation(MonotonicTime) final;
+ String debugDescription() const final;
Seconds durationFromDistance(const FloatSize&) const;
Modified: trunk/Source/WebCore/platform/ScrollingEffectsController.cpp (285386 => 285387)
--- trunk/Source/WebCore/platform/ScrollingEffectsController.cpp 2021-11-06 23:39:51 UTC (rev 285386)
+++ trunk/Source/WebCore/platform/ScrollingEffectsController.cpp 2021-11-06 23:58:42 UTC (rev 285387)
@@ -99,12 +99,12 @@
if (m_currentAnimation)
m_currentAnimation->stop();
- LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController " << this << " startAnimatedScrollToDestination start " << startOffset << " end " << destinationOffset);
-
// We always create and attempt to start the animation. If it turns out to not need animating, then the animation
// remains inactive, and we'll remove it on the next animationCallback().
m_currentAnimation = makeUnique<ScrollAnimationSmooth>(*this);
- return downcast<ScrollAnimationSmooth>(*m_currentAnimation).startAnimatedScrollToDestination(startOffset, destinationOffset);
+ bool started = downcast<ScrollAnimationSmooth>(*m_currentAnimation).startAnimatedScrollToDestination(startOffset, destinationOffset);
+ LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController " << this << " startAnimatedScrollToDestination " << *m_currentAnimation << " started " << started);
+ return started;
}
bool ScrollingEffectsController::retargetAnimatedScroll(FloatPoint newDestinationOffset)
@@ -150,8 +150,9 @@
if (!m_currentAnimation)
m_currentAnimation = makeUnique<ScrollAnimationMomentum>(*this);
- LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController " << this << " startMomentumScrollWithInitialVelocity " << initialVelocity << " initialDelta " << initialDelta << " from " << initialOffset);
- return downcast<ScrollAnimationMomentum>(*m_currentAnimation).startAnimatedScrollWithInitialVelocity(initialOffset, initialVelocity, initialDelta, destinationModifier);
+ bool started = downcast<ScrollAnimationMomentum>(*m_currentAnimation).startAnimatedScrollWithInitialVelocity(initialOffset, initialVelocity, initialDelta, destinationModifier);
+ LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController::startMomentumScrollWithInitialVelocity() - animation " << *m_currentAnimation << " started " << started);
+ return started;
}
void ScrollingEffectsController::setIsAnimatingRubberBand(bool isAnimatingRubberBand)
Modified: trunk/Source/WebCore/platform/ScrollingEffectsController.h (285386 => 285387)
--- trunk/Source/WebCore/platform/ScrollingEffectsController.h 2021-11-06 23:39:51 UTC (rev 285386)
+++ trunk/Source/WebCore/platform/ScrollingEffectsController.h 2021-11-06 23:58:42 UTC (rev 285387)
@@ -205,7 +205,7 @@
void startRubberBandAnimationIfNecessary();
- void startRubberBandAnimation(const FloatPoint& targetOffset, const FloatSize& initialVelocity, const FloatSize& initialOverscroll);
+ bool startRubberBandAnimation(const FloatPoint& targetOffset, const FloatSize& initialVelocity, const FloatSize& initialOverscroll);
void stopRubberBandAnimation();
void willStartRubberBandAnimation();
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimationRubberBand.h (285386 => 285387)
--- trunk/Source/WebCore/platform/mac/ScrollAnimationRubberBand.h 2021-11-06 23:39:51 UTC (rev 285386)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimationRubberBand.h 2021-11-06 23:58:42 UTC (rev 285387)
@@ -43,6 +43,7 @@
void serviceAnimation(MonotonicTime) final;
bool retargetActiveAnimation(const FloatPoint&) final;
ScrollClamping clamping() const final { return ScrollClamping::Unclamped; }
+ String debugDescription() const final;
bool animateScroll(MonotonicTime);
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimationRubberBand.mm (285386 => 285387)
--- trunk/Source/WebCore/platform/mac/ScrollAnimationRubberBand.mm 2021-11-06 23:39:51 UTC (rev 285386)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimationRubberBand.mm 2021-11-06 23:58:42 UTC (rev 285387)
@@ -100,6 +100,13 @@
didEnd();
}
+String ScrollAnimationRubberBand::debugDescription() const
+{
+ TextStream textStream;
+ textStream << "ScrollAnimationRubberBand " << this << " active " << isActive() << " target " << m_targetOffset << " current offset " << currentOffset();
+ return textStream.release();
+}
+
} // namespace WebCore
#endif // HAVE(RUBBER_BANDING)
Modified: trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm (285386 => 285387)
--- trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm 2021-11-06 23:39:51 UTC (rev 285386)
+++ trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm 2021-11-06 23:58:42 UTC (rev 285387)
@@ -391,14 +391,15 @@
updateRubberBandingState();
}
-void ScrollingEffectsController::startRubberBandAnimation(const FloatPoint& targetOffset, const FloatSize& initialVelocity, const FloatSize& initialOverscroll)
+bool ScrollingEffectsController::startRubberBandAnimation(const FloatPoint& targetOffset, const FloatSize& initialVelocity, const FloatSize& initialOverscroll)
{
if (m_currentAnimation)
m_currentAnimation->stop();
m_currentAnimation = makeUnique<ScrollAnimationRubberBand>(*this);
- LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController::startRubberBandAnimation() - starting rubbberband with targetOffset " << targetOffset << " initialVelocity " << initialVelocity << " initialOverscroll " << initialOverscroll);
- downcast<ScrollAnimationRubberBand>(*m_currentAnimation).startRubberBandAnimation(targetOffset, initialVelocity, initialOverscroll);
+ bool started = downcast<ScrollAnimationRubberBand>(*m_currentAnimation).startRubberBandAnimation(targetOffset, initialVelocity, initialOverscroll);
+ LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController::startRubberBandAnimation() - animation " << *m_currentAnimation << " started " << started);
+ return started;
}
void ScrollingEffectsController::stopRubberBandAnimation()