Changeset 286793 in webkit
- Timestamp:
- Dec 9, 2021, 11:53:55 AM (5 years ago)
- Location:
- branches/safari-612-branch/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
page/scrolling/ScrollingTree.h (modified) (2 diffs)
-
page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h (modified) (1 diff)
-
page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-612-branch/Source/WebCore/ChangeLog
r286692 r286793 1 2021-12-09 Alan Coon <alancoon@apple.com> 2 3 Apply patch. rdar://problem/86235842 4 5 2021-12-09 Simon Fraser <simon.fraser@apple.com> 6 7 rdar://86235842 ([root] J316c: Rubber-banding is more stuttery with the momentum generator enabled) 8 9 Reviewed by Tim Horton. 10 11 Branch-only patch (this timer does not exist on trunk). 12 13 To avoid raciness between displayDidRefresh callbacks and the rubberbanding timer, offset 14 the timer by 1/4 frame. After the first frame, we reset its fire interval back to the 15 nominal frame rate. 16 17 stopAnimationCallback() sets m_isAnimationTimerInOffsetPhase to false to avoid any chance 18 of restarting a stopped timer in the callback. 19 20 * page/scrolling/ScrollingTree.h: 21 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: 22 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: 23 (WebCore::ScrollingTreeScrollingNodeDelegateMac::startAnimationCallback): 24 (WebCore::ScrollingTreeScrollingNodeDelegateMac::stopAnimationCallback): 25 (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollControllerAnimationTimerFired): 26 1 27 2021-12-03 Alan Coon <alancoon@apple.com> 2 28 -
branches/safari-612-branch/Source/WebCore/page/scrolling/ScrollingTree.h
r286692 r286793 224 224 void windowScreenDidChange(PlatformDisplayID, std::optional<FramesPerSecond> nominalFramesPerSecond); 225 225 PlatformDisplayID displayID(); 226 226 227 std::optional<FramesPerSecond> nominalFramesPerSecond(); 228 227 229 bool hasProcessedWheelEventsRecently(); 228 230 WEBCORE_EXPORT void willProcessWheelEvent(); … … 258 260 std::optional<WheelScrollGestureState> gestureState(); 259 261 260 std::optional<FramesPerSecond> nominalFramesPerSecond();261 262 262 void applyLayerPositionsInternal() WTF_REQUIRES_LOCK(m_treeLock); 263 263 void removeAllNodes() WTF_REQUIRES_LOCK(m_treeLock); -
branches/safari-612-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h
r286692 r286793 111 111 112 112 std::unique_ptr<RunLoop::Timer<ScrollingTreeScrollingNodeDelegateMac>> m_scrollControllerAnimationTimer; 113 bool m_isAnimationTimerInOffsetPhase { false }; 113 114 114 115 bool m_inMomentumPhase { false }; -
branches/safari-612-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm
r286692 r286793 29 29 #if ENABLE(ASYNC_SCROLLING) && PLATFORM(MAC) 30 30 31 #import "AnimationFrameRate.h" 31 32 #import "Logging.h" 32 33 #import "ScrollingStateScrollingNode.h" … … 230 231 return; 231 232 232 m_scrollControllerAnimationTimer->startRepeating(1_s / 60.); 233 // We offset the timer by a 1/4 frame to avoid it racing with displayDidRefresh callbacks (rdar://86235842). 234 auto framesPerSecond = scrollingTree().nominalFramesPerSecond().value_or(FullSpeedFramesPerSecond); 235 auto firstInterval = (1_s / framesPerSecond) / 4; 236 m_isAnimationTimerInOffsetPhase = true; 237 m_scrollControllerAnimationTimer->startRepeating(firstInterval); 233 238 } 234 239 235 240 void ScrollingTreeScrollingNodeDelegateMac::stopAnimationCallback(ScrollController&) 236 241 { 242 m_isAnimationTimerInOffsetPhase = false; 237 243 if (m_scrollControllerAnimationTimer) 238 244 m_scrollControllerAnimationTimer->stop(); … … 241 247 void ScrollingTreeScrollingNodeDelegateMac::scrollControllerAnimationTimerFired() 242 248 { 249 if (m_scrollControllerAnimationTimer && m_isAnimationTimerInOffsetPhase) { 250 auto framesPerSecond = scrollingTree().nominalFramesPerSecond().value_or(FullSpeedFramesPerSecond); 251 m_scrollControllerAnimationTimer->startRepeating(1_s / framesPerSecond); 252 m_isAnimationTimerInOffsetPhase = false; 253 } 254 243 255 m_scrollController.animationCallback(MonotonicTime::now()); 244 256 }
Note:
See TracChangeset
for help on using the changeset viewer.