Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 53a56f18efe58689adda39c52b9c49cd3c884bd9
https://github.com/WebKit/WebKit/commit/53a56f18efe58689adda39c52b9c49cd3c884bd9
Author: Basuke Suzuki <[email protected]>
Date: 2025-12-10 (Wed, 10 Dec 2025)
Changed paths:
A
LayoutTests/http/tests/navigation-api/navigate-event-scroll-deferred-with-pending-stylesheet-expected.txt
A
LayoutTests/http/tests/navigation-api/navigate-event-scroll-deferred-with-pending-stylesheet.html
M Source/WebCore/page/NavigateEvent.cpp
Log Message:
-----------
[Navigation API] processScrollBehavior should wait for stylesheet loading
before scrolling to fragment.
https://bugs.webkit.org/show_bug.cgi?id=303783
rdar://164271286
Reviewed by Chris Dumez.
The scrollToAnchorFragment() that is called from scrollToFragment() contains a
RELEASE_ASSERT(document.haveStylesheetsLoaded()), requiring stylesheets to be
fully
loaded before the function can be safely called. This constraint necessitates
conditional execution where scrollToFragment() is only invoked when stylesheets
are loaded, with alternative handling used when they are not.
However, the current processScrollBehavior() implementation unconditionally
calls
scrollToFragment() and relies on its boolean return value to determine whether
fallback scroll behavior should be applied. This pattern prevents moving to the
required conditional call approach, as the decision logic is embedded within
scrollToFragment() rather than being determined beforehand.
To enable this transition, the current implementation must be refactored to
eliminate dependency on scrollToFragment() return values. Instead, all
decision logic needs to be moved to explicit pre-checks that determine the
appropriate scroll behavior before any fragment scrolling is attempted.
Refactor the implementation to:
- Pre-validate anchor existence using Document::findAnchor() before calling
scrollToFragment().
- Check stylesheet loading status and use
setGotoAnchorNeededAfterStylesheetsLoad()
when needed.
- Remove dependency on scrollToFragment() return value by handling all fallback
cases through explicit conditionals.
- Maintain identical logic flow for all navigation types.
No behavior change.
*
LayoutTests/http/tests/navigation-api/navigate-event-scroll-deferred-with-pending-stylesheet-expected.txt:
Added.
*
LayoutTests/http/tests/navigation-api/navigate-event-scroll-deferred-with-pending-stylesheet.html:
Added.
* Source/WebCore/page/NavigateEvent.cpp:
(WebCore::NavigateEvent::processScrollBehavior):
Co-authored-by: Nipun Shukla <[email protected]>
Canonical link: https://commits.webkit.org/304273@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications