Title: [286793] branches/safari-612-branch/Source/WebCore
- Revision
- 286793
- Author
- [email protected]
- Date
- 2021-12-09 11:53:55 -0800 (Thu, 09 Dec 2021)
Log Message
Apply patch. rdar://problem/86235842
Modified Paths
Diff
Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (286792 => 286793)
--- branches/safari-612-branch/Source/WebCore/ChangeLog 2021-12-09 19:39:43 UTC (rev 286792)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog 2021-12-09 19:53:55 UTC (rev 286793)
@@ -1,3 +1,29 @@
+2021-12-09 Alan Coon <[email protected]>
+
+ Apply patch. rdar://problem/86235842
+
+ 2021-12-09 Simon Fraser <[email protected]>
+
+ rdar://86235842 ([root] J316c: Rubber-banding is more stuttery with the momentum generator enabled)
+
+ Reviewed by Tim Horton.
+
+ Branch-only patch (this timer does not exist on trunk).
+
+ To avoid raciness between displayDidRefresh callbacks and the rubberbanding timer, offset
+ the timer by 1/4 frame. After the first frame, we reset its fire interval back to the
+ nominal frame rate.
+
+ stopAnimationCallback() sets m_isAnimationTimerInOffsetPhase to false to avoid any chance
+ of restarting a stopped timer in the callback.
+
+ * page/scrolling/ScrollingTree.h:
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::startAnimationCallback):
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::stopAnimationCallback):
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollControllerAnimationTimerFired):
+
2021-12-03 Alan Coon <[email protected]>
Cherry-pick r285526. rdar://problem/85928816
Modified: branches/safari-612-branch/Source/WebCore/page/scrolling/ScrollingTree.h (286792 => 286793)
--- branches/safari-612-branch/Source/WebCore/page/scrolling/ScrollingTree.h 2021-12-09 19:39:43 UTC (rev 286792)
+++ branches/safari-612-branch/Source/WebCore/page/scrolling/ScrollingTree.h 2021-12-09 19:53:55 UTC (rev 286793)
@@ -223,7 +223,9 @@
void windowScreenDidChange(PlatformDisplayID, std::optional<FramesPerSecond> nominalFramesPerSecond);
PlatformDisplayID displayID();
-
+
+ std::optional<FramesPerSecond> nominalFramesPerSecond();
+
bool hasProcessedWheelEventsRecently();
WEBCORE_EXPORT void willProcessWheelEvent();
@@ -257,8 +259,6 @@
void setGestureState(std::optional<WheelScrollGestureState>);
std::optional<WheelScrollGestureState> gestureState();
- std::optional<FramesPerSecond> nominalFramesPerSecond();
-
void applyLayerPositionsInternal() WTF_REQUIRES_LOCK(m_treeLock);
void removeAllNodes() WTF_REQUIRES_LOCK(m_treeLock);
Modified: branches/safari-612-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h (286792 => 286793)
--- branches/safari-612-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h 2021-12-09 19:39:43 UTC (rev 286792)
+++ branches/safari-612-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h 2021-12-09 19:53:55 UTC (rev 286793)
@@ -110,6 +110,7 @@
RetainPtr<NSScrollerImp> m_horizontalScrollerImp;
std::unique_ptr<RunLoop::Timer<ScrollingTreeScrollingNodeDelegateMac>> m_scrollControllerAnimationTimer;
+ bool m_isAnimationTimerInOffsetPhase { false };
bool m_inMomentumPhase { false };
};
Modified: branches/safari-612-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm (286792 => 286793)
--- branches/safari-612-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm 2021-12-09 19:39:43 UTC (rev 286792)
+++ branches/safari-612-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm 2021-12-09 19:53:55 UTC (rev 286793)
@@ -28,6 +28,7 @@
#if ENABLE(ASYNC_SCROLLING) && PLATFORM(MAC)
+#import "AnimationFrameRate.h"
#import "Logging.h"
#import "ScrollingStateScrollingNode.h"
#import "ScrollingTree.h"
@@ -229,11 +230,16 @@
if (m_scrollControllerAnimationTimer->isActive())
return;
- m_scrollControllerAnimationTimer->startRepeating(1_s / 60.);
+ // We offset the timer by a 1/4 frame to avoid it racing with displayDidRefresh callbacks (rdar://86235842).
+ auto framesPerSecond = scrollingTree().nominalFramesPerSecond().value_or(FullSpeedFramesPerSecond);
+ auto firstInterval = (1_s / framesPerSecond) / 4;
+ m_isAnimationTimerInOffsetPhase = true;
+ m_scrollControllerAnimationTimer->startRepeating(firstInterval);
}
void ScrollingTreeScrollingNodeDelegateMac::stopAnimationCallback(ScrollController&)
{
+ m_isAnimationTimerInOffsetPhase = false;
if (m_scrollControllerAnimationTimer)
m_scrollControllerAnimationTimer->stop();
}
@@ -240,6 +246,12 @@
void ScrollingTreeScrollingNodeDelegateMac::scrollControllerAnimationTimerFired()
{
+ if (m_scrollControllerAnimationTimer && m_isAnimationTimerInOffsetPhase) {
+ auto framesPerSecond = scrollingTree().nominalFramesPerSecond().value_or(FullSpeedFramesPerSecond);
+ m_scrollControllerAnimationTimer->startRepeating(1_s / framesPerSecond);
+ m_isAnimationTimerInOffsetPhase = false;
+ }
+
m_scrollController.animationCallback(MonotonicTime::now());
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes