Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 16a8a13f3916c670aebb3e3f4367f07234d25051
https://github.com/WebKit/WebKit/commit/16a8a13f3916c670aebb3e3f4367f07234d25051
Author: Wenson Hsieh <[email protected]>
Date: 2026-07-18 (Sat, 18 Jul 2026)
Changed paths:
A
LayoutTests/editing/selection/ios/autoscroll-does-not-scroll-main-frame-in-fixed-container-expected.txt
A
LayoutTests/editing/selection/ios/autoscroll-does-not-scroll-main-frame-in-fixed-container.html
M Source/WebCore/page/AutoscrollController.cpp
M Source/WebCore/page/AutoscrollController.h
M Source/WebCore/page/EventHandler.h
M Source/WebCore/page/cocoa/EventHandlerCocoa.mm
M Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Log Message:
-----------
REGRESSION (290497@main): [iOS] Adjusting selection handles in Google search
field causes page to autoscroll
https://bugs.webkit.org/show_bug.cgi?id=319722
rdar://181954850
Reviewed by Abrar Rahman Protyasha.
On Google search results on iPhone and iPad, the search field is fixed to the
top of the page.
Selecting text in it and then dragging a selection handle causes the main frame
to autoscroll on
its own because the fixed field stays in place while the page scrolls
underneath it.
290497@main made selection autoscroll engage as soon as the drag point is close
to the viewport
edge, dropping the earlier requirement that the drag first move toward the
edge. A field fixed to
the top of the page is always inside the top edge band, so merely adjusting its
selection now starts
a main-frame autoscroll.
Scrolling the main frame can never reveal more of a fixed-position container,
so autoscrolling it
for such a selection serves no purpose. Rather than restore the drag-distance
requirement (which
would undo the scrolling smoothness 290497@main added), don't start main-frame
selection autoscroll
when the selection is anchored inside a fixed-position container; a scrollable
subframe nested
within it may still autoscroll, since scrolling it can reveal more content.
AutoscrollController::startAutoscrollForSelection now reports whether it
actually started
autoscrolling, and the UI process marks itself autoscrolling only once the web
process confirms it
did.
Test:
editing/selection/ios/autoscroll-does-not-scroll-main-frame-in-fixed-container.html
*
LayoutTests/editing/selection/ios/autoscroll-does-not-scroll-main-frame-in-fixed-container-expected.txt:
Added.
*
LayoutTests/editing/selection/ios/autoscroll-does-not-scroll-main-frame-in-fixed-container.html:
Added.
* Source/WebCore/page/AutoscrollController.cpp:
(WebCore::AutoscrollController::startAutoscrollForSelection):
* Source/WebCore/page/AutoscrollController.h:
* Source/WebCore/page/EventHandler.h:
* Source/WebCore/page/cocoa/EventHandlerCocoa.mm:
(WebCore::EventHandler::startSelectionAutoscroll):
Make this return whether or not autoscrolling started, and bubble that result
back into the WebKit
client layer (as well as through the IPC reply to `StartAutoscrollAtPosition`).
This returns `false`
in the case where the selection is inside a fixed-position renderer, and the
mainframe is the
autoscrolled renderer.
* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::startAutoscrollAtPosition):
(WebKit::WebPageProxy::cancelAutoscroll):
* Source/WebKit/UIProcess/WebPageProxy.h:
Turn `m_isAutoscrolling` into a tri-state enum, since the value is now set
asynchronously. In the
case where we start and then immediately stop autoscrolling before the IPC
reply for autoscroll
start is received, we won't end up permanently stuck in autoscrolling state.
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::startAutoscrollAtPosition):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
Canonical link: https://commits.webkit.org/317473@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications