Changeset 293260 in webkit
- Timestamp:
- Apr 22, 2022 3:52:23 PM (3 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/scrolling/programmatic-smooth-scroll-after-focus-expected.txt (added)
-
LayoutTests/fast/scrolling/programmatic-smooth-scroll-after-focus.html (added)
-
LayoutTests/platform/win/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Element.cpp (modified) (1 diff)
-
Source/WebCore/page/DOMWindow.cpp (modified) (1 diff)
-
Source/WebCore/page/FrameView.cpp (modified) (6 diffs)
-
Source/WebCore/page/FrameView.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r293254 r293260 1 2022-04-22 Simon Fraser <simon.fraser@apple.com> 2 3 Focusing scroll container before scrolling breaks smooth scrolling 4 https://bugs.webkit.org/show_bug.cgi?id=239605 5 6 Reviewed by Wenson Hsieh. 7 8 * fast/scrolling/programmatic-smooth-scroll-after-focus-expected.txt: Added. 9 * fast/scrolling/programmatic-smooth-scroll-after-focus.html: Added. 10 * platform/win/TestExpectations: 11 1 12 2022-04-22 Matteo Flores <matteo_flores@apple.com> 2 13 -
trunk/LayoutTests/platform/win/TestExpectations
r293006 r293260 534 534 webkit.org/b/208559 fast/scrolling/rtl-point-in-iframe.html [ Skip ] 535 535 fast/scrolling/rtl-scrollbars-alternate-iframe-body-dir-attr-does-not-update-scrollbar-placement.html [ ImageOnlyFailure ] 536 537 # waitForScrollCompletion() not supported 538 fast/scrolling/programmatic-smooth-scroll-after-focus.html [ Skip ] 536 539 537 540 # TODO Needs testRunner.enableAutoResizeMode() -
trunk/Source/WebCore/ChangeLog
r293251 r293260 1 2022-04-22 Simon Fraser <simon.fraser@apple.com> 2 3 Focusing scroll container before scrolling breaks smooth scrolling 4 https://bugs.webkit.org/show_bug.cgi?id=239605 5 6 Reviewed by Wenson Hsieh. 7 8 If script calls focus() and then scrollTo({ behavior: smooth }) in the same runloop, the 9 scrollToFocusedElementInternal() that happens on a zero-delay timer in FrameView will stop 10 the animated scroll. 11 12 Fix by having programmatic scrolls on Element and DOMWindow cancel any pending focus-related 13 scroll. 14 15 Test: fast/scrolling/programmatic-smooth-scroll-after-focus.html 16 17 * dom/Element.cpp: 18 (WebCore::Element::scrollTo): 19 * page/DOMWindow.cpp: 20 (WebCore::DOMWindow::scrollTo const): 21 * page/FrameView.cpp: 22 (WebCore::FrameView::maintainScrollPositionAtAnchor): 23 (WebCore::FrameView::setScrollPosition): 24 (WebCore::FrameView::cancelScheduledScrollToFocusedElement): 25 (WebCore::FrameView::scrollToAnchor): 26 (WebCore::FrameView::setWasScrolledByUser): 27 * page/FrameView.h: 28 1 29 2022-04-22 Alan Bujtas <zalan@apple.com> 2 30 -
trunk/Source/WebCore/dom/Element.cpp
r293059 r293260 1101 1101 return; 1102 1102 } 1103 1104 if (auto* view = document().view()) 1105 view->cancelScheduledScrollToFocusedElement(); 1103 1106 1104 1107 document().updateLayoutIgnorePendingStylesheets(); -
trunk/Source/WebCore/page/DOMWindow.cpp
r292677 r293260 1739 1739 } 1740 1740 1741 view->cancelScheduledScrollToFocusedElement(); 1741 1742 document()->updateLayoutIgnorePendingStylesheets(); 1742 1743 -
trunk/Source/WebCore/page/FrameView.cpp
r292512 r293260 2330 2330 if (!m_maintainScrollPositionAnchor) 2331 2331 return; 2332 m_shouldScrollToFocusedElement = false; 2333 m_delayedScrollToFocusedElementTimer.stop();2332 2333 cancelScheduledScrollToFocusedElement(); 2334 2334 2335 2335 // We need to update the layout before scrolling, otherwise we could … … 2364 2364 2365 2365 m_maintainScrollPositionAnchor = nullptr; 2366 m_shouldScrollToFocusedElement = false;2367 m_delayedScrollToFocusedElementTimer.stop(); 2366 cancelScheduledScrollToFocusedElement(); 2367 2368 2368 Page* page = frame().page(); 2369 2369 if (page && page->isMonitoringWheelEvents()) … … 2411 2411 m_shouldScrollToFocusedElement = true; 2412 2412 m_delayedScrollToFocusedElementTimer.startOneShot(0_s); 2413 } 2414 2415 void FrameView::cancelScheduledScrollToFocusedElement() 2416 { 2417 m_shouldScrollToFocusedElement = false; 2418 m_delayedScrollToFocusedElementTimer.stop(); 2413 2419 } 2414 2420 … … 3289 3295 return; 3290 3296 3291 m_shouldScrollToFocusedElement = false; 3292 m_delayedScrollToFocusedElementTimer.stop(); 3297 cancelScheduledScrollToFocusedElement(); 3293 3298 3294 3299 LayoutRect rect; … … 3314 3319 LOG_WITH_STREAM(Scrolling, stream << " restoring anchor node to " << anchorNode.get()); 3315 3320 m_maintainScrollPositionAnchor = anchorNode; 3316 m_shouldScrollToFocusedElement = false; 3317 m_delayedScrollToFocusedElementTimer.stop(); 3321 cancelScheduledScrollToFocusedElement(); 3318 3322 } 3319 3323 … … 4323 4327 LOG(Scrolling, "FrameView::setWasScrolledByUser at %d", wasScrolledByUser); 4324 4328 4325 m_shouldScrollToFocusedElement = false; 4326 m_delayedScrollToFocusedElementTimer.stop(); 4329 cancelScheduledScrollToFocusedElement(); 4327 4330 if (currentScrollType() == ScrollType::Programmatic) 4328 4331 return; -
trunk/Source/WebCore/page/FrameView.h
r292042 r293260 267 267 void restoreScrollbar(); 268 268 void scheduleScrollToFocusedElement(SelectionRevealMode); 269 void cancelScheduledScrollToFocusedElement(); 269 270 void scrollToFocusedElementImmediatelyIfNeeded(); 270 271 void updateLayerPositionsAfterScrolling() final;
Note: See TracChangeset
for help on using the changeset viewer.