Diff
Modified: trunk/Source/WebCore/ChangeLog (283071 => 283072)
--- trunk/Source/WebCore/ChangeLog 2021-09-25 00:45:15 UTC (rev 283071)
+++ trunk/Source/WebCore/ChangeLog 2021-09-25 03:39:35 UTC (rev 283072)
@@ -1,3 +1,35 @@
+2021-09-24 Simon Fraser <[email protected]>
+
+ Add a ScrollAnimations log channel
+ https://bugs.webkit.org/show_bug.cgi?id=230772
+
+ Reviewed by Tim Horton.
+
+ Add a ScrollAnimations log channel and do some logging in ScrollingEffectsController,
+ as well as logging some rubberbanding info via this channel.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/Logging.h:
+ * platform/ScrollAnimation.cpp: Added.
+ (WebCore::operator<<):
+ * platform/ScrollAnimation.h:
+ * platform/ScrollAnimationMomentum.cpp:
+ (WebCore::ScrollAnimationMomentum::serviceAnimation):
+ * platform/ScrollingEffectsController.cpp:
+ (WebCore::ScrollingEffectsController::animationCallback):
+ (WebCore::ScrollingEffectsController::startAnimatedScrollToDestination):
+ (WebCore::ScrollingEffectsController::regargetAnimatedScroll):
+ (WebCore::ScrollingEffectsController::stopAnimatedScroll):
+ (WebCore::ScrollingEffectsController::startMomentumScrollWithInitialVelocity):
+ (WebCore::ScrollingEffectsController::scrollAnimationDidUpdate):
+ (WebCore::ScrollingEffectsController::scrollAnimationWillStart):
+ (WebCore::ScrollingEffectsController::scrollAnimationDidEnd):
+ * platform/mac/ScrollingEffectsController.mm:
+ (WebCore::ScrollingEffectsController::handleWheelEvent):
+ (WebCore::ScrollingEffectsController::updateRubberBandAnimatingState):
+ (WebCore::ScrollingEffectsController::updateRubberBandingState):
+
2021-09-24 Lauro Moura <[email protected]>
Non-unified partial build fixes late September edition
Modified: trunk/Source/WebCore/Sources.txt (283071 => 283072)
--- trunk/Source/WebCore/Sources.txt 2021-09-25 00:45:15 UTC (rev 283071)
+++ trunk/Source/WebCore/Sources.txt 2021-09-25 03:39:35 UTC (rev 283072)
@@ -1823,6 +1823,7 @@
platform/RemoteCommandListener.cpp
platform/RuntimeApplicationChecks.cpp
platform/SSLKeyGenerator.cpp
+platform/ScrollAnimation.cpp
platform/ScrollAnimationKinetic.cpp
platform/ScrollAnimationMomentum.cpp
platform/ScrollAnimationSmooth.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (283071 => 283072)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-09-25 00:45:15 UTC (rev 283071)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-09-25 03:39:35 UTC (rev 283072)
@@ -6243,6 +6243,7 @@
0F6A12BC1A00923700C6DE72 /* DebugPageOverlays.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugPageOverlays.h; sourceTree = "<group>"; };
0F6B7077237BC12F0052CA47 /* CSSUnits.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSUnits.h; sourceTree = "<group>"; };
0F6B7079237BC12F0052CA47 /* CSSUnits.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSUnits.cpp; sourceTree = "<group>"; };
+ 0F6EAD6626FE728000064D03 /* ScrollAnimation.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollAnimation.cpp; sourceTree = "<group>"; };
0F70495D211B524200369968 /* ActivityState.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ActivityState.cpp; sourceTree = "<group>"; };
0F736ECA26CCB97A000AD7CA /* LayerTreeAsTextOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayerTreeAsTextOptions.h; sourceTree = "<group>"; };
0F73B765222B327F00805316 /* ScrollingStateScrollingNodeMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingStateScrollingNodeMac.mm; sourceTree = "<group>"; };
@@ -28123,6 +28124,7 @@
411223B8260244FE00B0A0B6 /* ScriptExecutionContextIdentifier.h */,
BC8AE34C12EA096A00EB3AE6 /* ScrollableArea.cpp */,
BC8AE34D12EA096A00EB3AE6 /* ScrollableArea.h */,
+ 0F6EAD6626FE728000064D03 /* ScrollAnimation.cpp */,
0FA61B0C26F43212001AADB6 /* ScrollAnimation.h */,
0FC692BC257C0F410098E3F9 /* ScrollAnimationKinetic.cpp */,
0FC692BA257C0F400098E3F9 /* ScrollAnimationKinetic.h */,
Modified: trunk/Source/WebCore/platform/Logging.h (283071 => 283072)
--- trunk/Source/WebCore/platform/Logging.h 2021-09-25 00:45:15 UTC (rev 283071)
+++ trunk/Source/WebCore/platform/Logging.h 2021-09-25 03:39:35 UTC (rev 283072)
@@ -100,6 +100,7 @@
M(ResourceLoading) \
M(ResourceLoadObserver) \
M(ResourceLoadStatistics) \
+ M(ScrollAnimations) \
M(ScrollSnap) \
M(Scrolling) \
M(ScrollingTree) \
Added: trunk/Source/WebCore/platform/ScrollAnimation.cpp (0 => 283072)
--- trunk/Source/WebCore/platform/ScrollAnimation.cpp (rev 0)
+++ trunk/Source/WebCore/platform/ScrollAnimation.cpp 2021-09-25 03:39:35 UTC (rev 283072)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ScrollAnimation.h"
+
+#include <wtf/text/TextStream.h>
+
+namespace WebCore {
+
+TextStream& operator<<(TextStream& ts, ScrollAnimation::Type animationType)
+{
+ switch (animationType) {
+ case ScrollAnimation::Type::Smooth: ts << "smooth"; break;
+ case ScrollAnimation::Type::Kinetic: ts << "kinetic"; break;
+ case ScrollAnimation::Type::Momentum: ts << "momentum"; break;
+ }
+ return ts;
+}
+
+TextStream& operator<<(TextStream& ts, const ScrollAnimation& animation)
+{
+ ts << "ScrollAnimation " << &animation << " " << animation.type() << " active " << animation.isActive() << " current offset " << animation.currentOffset();
+ return ts;
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/platform/ScrollAnimation.h (283071 => 283072)
--- trunk/Source/WebCore/platform/ScrollAnimation.h 2021-09-25 00:45:15 UTC (rev 283071)
+++ trunk/Source/WebCore/platform/ScrollAnimation.h 2021-09-25 03:39:35 UTC (rev 283072)
@@ -103,6 +103,9 @@
FloatPoint m_currentOffset;
};
+WTF::TextStream& operator<<(WTF::TextStream&, ScrollAnimation::Type);
+WTF::TextStream& operator<<(WTF::TextStream&, const ScrollAnimation&);
+
} // namespace WebCore
#define SPECIALIZE_TYPE_TRAITS_SCROLL_ANIMATION(ToValueTypeName, predicate) \
Modified: trunk/Source/WebCore/platform/ScrollAnimationMomentum.cpp (283071 => 283072)
--- trunk/Source/WebCore/platform/ScrollAnimationMomentum.cpp 2021-09-25 00:45:15 UTC (rev 283071)
+++ trunk/Source/WebCore/platform/ScrollAnimationMomentum.cpp 2021-09-25 03:39:35 UTC (rev 283072)
@@ -88,9 +88,9 @@
auto elapsedTime = timeSinceStart(currentTime);
bool animationComplete = elapsedTime >= m_momentumCalculator->animationDuration();
- auto newOffset = m_momentumCalculator->scrollOffsetAfterElapsedTime(elapsedTime);
+ m_currentOffset = m_momentumCalculator->scrollOffsetAfterElapsedTime(elapsedTime);
- m_client.scrollAnimationDidUpdate(*this, newOffset);
+ m_client.scrollAnimationDidUpdate(*this, m_currentOffset);
if (animationComplete)
didEnd();
Modified: trunk/Source/WebCore/platform/ScrollingEffectsController.cpp (283071 => 283072)
--- trunk/Source/WebCore/platform/ScrollingEffectsController.cpp 2021-09-25 00:45:15 UTC (rev 283071)
+++ trunk/Source/WebCore/platform/ScrollingEffectsController.cpp 2021-09-25 03:39:35 UTC (rev 283072)
@@ -46,8 +46,6 @@
void ScrollingEffectsController::animationCallback(MonotonicTime currentTime)
{
- LOG_WITH_STREAM(Scrolling, stream << "ScrollingEffectsController " << this << " animationCallback: isAnimatingRubberBand " << m_isAnimatingRubberBand << " isAnimatingScrollSnap " << m_isAnimatingScrollSnap << "isAnimatingKeyboardScrolling" << m_isAnimatingKeyboardScrolling);
-
if (m_currentAnimation) {
if (m_currentAnimation->isActive())
m_currentAnimation->serviceAnimation(currentTime);
@@ -93,6 +91,8 @@
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);
@@ -104,6 +104,8 @@
if (!is<ScrollAnimationSmooth>(m_currentAnimation.get()))
return false;
+ LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController " << this << " regargetAnimatedScroll to " << newDestinationOffset);
+
ASSERT(m_currentAnimation->isActive());
return downcast<ScrollAnimationSmooth>(*m_currentAnimation).retargetActiveAnimation(newDestinationOffset);
}
@@ -110,6 +112,8 @@
void ScrollingEffectsController::stopAnimatedScroll()
{
+ LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController " << this << " stopAnimatedScroll");
+
if (m_currentAnimation)
m_currentAnimation->stop();
}
@@ -155,6 +159,7 @@
if (!m_currentAnimation)
m_currentAnimation = makeUnique<ScrollAnimationMomentum>(*this);
+ LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController " << this << " startMomentumScrollWithInitialVelocity " << initialVelocity << " from " << initialOffset);
return downcast<ScrollAnimationMomentum>(*m_currentAnimation).startAnimatedScrollWithInitialVelocity(initialOffset, initialVelocity, initialDelta, destinationModifier);
}
@@ -309,18 +314,27 @@
m_client.immediateScrollBy(scrollDelta);
}
-void ScrollingEffectsController::scrollAnimationDidUpdate(ScrollAnimation&, const FloatPoint& currentOffset)
+void ScrollingEffectsController::scrollAnimationDidUpdate(ScrollAnimation& animation, const FloatPoint& currentOffset)
{
+ LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController " << this << " scrollAnimationDidUpdate " << animation << " (main thread " << isMainThread() << ")");
+ UNUSED_PARAM(animation);
+
scrollToOffsetForAnimation(currentOffset);
}
-void ScrollingEffectsController::scrollAnimationWillStart(ScrollAnimation&)
+void ScrollingEffectsController::scrollAnimationWillStart(ScrollAnimation& animation)
{
+ LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController " << this << " scrollAnimationWillStart " << animation);
+ UNUSED_PARAM(animation);
+
startOrStopAnimationCallbacks();
}
-void ScrollingEffectsController::scrollAnimationDidEnd(ScrollAnimation&)
+void ScrollingEffectsController::scrollAnimationDidEnd(ScrollAnimation& animation)
{
+ LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController " << this << " scrollAnimationDidEnd " << animation);
+ UNUSED_PARAM(animation);
+
if (usesScrollSnap() && m_isAnimatingScrollSnap) {
m_scrollSnapState->transitionToDestinationReachedState();
stopScrollSnapAnimation();
Modified: trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm (283071 => 283072)
--- trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm 2021-09-25 00:45:15 UTC (rev 283071)
+++ trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm 2021-09-25 03:39:35 UTC (rev 283072)
@@ -228,8 +228,6 @@
shouldStretch = deltaX || deltaY;
}
}
-
- LOG_WITH_STREAM(Scrolling, stream << "ScrollingEffectsController::handleWheelEvent() - deltaX " << deltaX << " deltaY " << deltaY << " pinned " << m_client.isPinnedForScrollDelta(FloatSize(deltaX, deltaY)) << " shouldStretch " << shouldStretch);
}
bool handled = true;
@@ -286,6 +284,8 @@
FloatSize dampedDelta(ceilf(elasticDeltaForReboundDelta(m_stretchScrollForce.width())), ceilf(elasticDeltaForReboundDelta(m_stretchScrollForce.height())));
+ LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController::handleWheelEvent() - overscrolled by " << m_overflowScrollDelta << " stretchScrollForce " << m_stretchScrollForce << " move delta " << FloatSize(deltaX, deltaY) << " dampedDelta " << dampedDelta);
+
m_client.immediateScrollByWithoutContentEdgeConstraints(dampedDelta - stretchAmount);
}
}
@@ -382,8 +382,6 @@
if (isScrollSnapInProgress())
return;
- LOG_WITH_STREAM(Scrolling, stream << "ScrollingEffectsController::updateRubberBandAnimatingState() - main thread " << isMainThread());
-
if (!m_momentumScrollInProgress || m_ignoreMomentumScrolls) {
auto timeDelta = currentTime - m_startTime;
@@ -407,23 +405,33 @@
// Don't rubber-band vertically if it's not possible to scroll vertically
if (!m_client.allowsVerticalScrolling())
m_origVelocity.setHeight(0);
+
+ LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController::updateRubberBandAnimatingState() - starting rubbberband with m_origVelocity" << m_origVelocity << " m_startStretch " << m_startStretch);
}
- FloatPoint delta(roundToDevicePixelTowardZero(elasticDeltaForTimeDelta(m_startStretch.width(), -m_origVelocity.width(), timeDelta)),
- roundToDevicePixelTowardZero(elasticDeltaForTimeDelta(m_startStretch.height(), -m_origVelocity.height(), timeDelta)));
+ auto rubberBandDelta = FloatSize {
+ roundToDevicePixelTowardZero(elasticDeltaForTimeDelta(m_startStretch.width(), -m_origVelocity.width(), timeDelta)),
+ roundToDevicePixelTowardZero(elasticDeltaForTimeDelta(m_startStretch.height(), -m_origVelocity.height(), timeDelta))
+ };
- if (fabs(delta.x()) >= 1 || fabs(delta.y()) >= 1) {
- m_client.immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_client.stretchAmount());
+ if (fabs(rubberBandDelta.width()) >= 1 || fabs(rubberBandDelta.height()) >= 1) {
+ auto stretchDelta = rubberBandDelta - FloatSize(m_client.stretchAmount());
+ LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController::updateRubberBandAnimatingState() - rubberBandDelta " << rubberBandDelta << " stretched " << m_client.stretchAmount() << " moving by " << stretchDelta);
+
+ m_client.immediateScrollByWithoutContentEdgeConstraints(stretchDelta);
+
FloatSize newStretch = m_client.stretchAmount();
m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(newStretch.width()));
m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(newStretch.height()));
} else {
+ LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController::updateRubberBandAnimatingState() - rubber band complete");
m_client.adjustScrollPositionToBoundsIfNecessary();
stopRubberbanding();
}
} else {
+ LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController::updateRubberBandAnimatingState() - not animating, momentumScrollInProgress " << m_momentumScrollInProgress << " ignoreMomentumScrolls " << m_ignoreMomentumScrolls);
m_startTime = currentTime;
m_startStretch = { };
if (!isRubberBandInProgressInternal())
@@ -531,6 +539,8 @@
if (isRubberBanding == m_isRubberBanding)
return;
+ LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollingEffectsController " << this << " updateRubberBandingState - isRubberBanding " << isRubberBanding);
+
m_isRubberBanding = isRubberBanding;
if (m_isRubberBanding)
updateRubberBandingEdges(m_client.stretchAmount());