Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1e3a0217e8c5d42624ddeef016daf9cd79b205f1
https://github.com/WebKit/WebKit/commit/1e3a0217e8c5d42624ddeef016daf9cd79b205f1
Author: Tim Horton <[email protected]>
Date: 2026-09-29 (Tue, 29 Sep 2026)
Changed paths:
A
LayoutTests/fast/events/touch/ios/content-observation/empty-container-with-floats-gains-new-renderer-expected.txt
A
LayoutTests/fast/events/touch/ios/content-observation/empty-container-with-floats-gains-new-renderer.html
A
LayoutTests/fast/events/touch/ios/content-observation/offscreen-content-gains-new-renderer-below-viewport-expected.txt
A
LayoutTests/fast/events/touch/ios/content-observation/offscreen-content-gains-new-renderer-below-viewport.html
A
LayoutTests/fast/events/touch/ios/content-observation/offscreen-content-gains-new-renderer-iframe-expected.txt
A
LayoutTests/fast/events/touch/ios/content-observation/offscreen-content-gains-new-renderer-iframe.html
A
LayoutTests/fast/events/touch/ios/content-observation/offscreen-content-gains-new-renderer-overflow-clip-expected.txt
A
LayoutTests/fast/events/touch/ios/content-observation/offscreen-content-gains-new-renderer-overflow-clip.html
A
LayoutTests/fast/events/touch/ios/content-observation/offscreen-content-gains-new-renderer-then-timer-reveals-content-expected.txt
A
LayoutTests/fast/events/touch/ios/content-observation/offscreen-content-gains-new-renderer-then-timer-reveals-content.html
A
LayoutTests/fast/events/touch/ios/content-observation/offscreen-content-gains-new-renderer-transform-expected.txt
A
LayoutTests/fast/events/touch/ios/content-observation/offscreen-content-gains-new-renderer-transform.html
A
LayoutTests/fast/events/touch/ios/content-observation/offscreen-content-gains-new-renderer-with-mouseout-listener-expected.txt
A
LayoutTests/fast/events/touch/ios/content-observation/offscreen-content-gains-new-renderer-with-mouseout-listener.html
M Source/WebCore/page/cocoa/ContentChangeObserver.cpp
M Source/WebCore/page/cocoa/ContentChangeObserver.h
Log Message:
-----------
[Content Change Observer] Offscreen DOM rebuilds trigger unnecessary hover
pauses
https://bugs.webkit.org/show_bug.cgi?id=325690
rdar://188017007
Reviewed by Abrar Rahman Protyasha and Alan Baradlay.
Some inefficiently-constructed pages rebuild offscreen content on every touch.
If this rebuilding happens while ContentChangeObserver is watching for changes,
it can falsely trigger unnecessary hover states, requiring two taps to send
a click for content that does not in any way visually change.
Resolve this by comparing visibility changes against the viewport, filtering
out offscreen changes that don't have e.g. transitions that might bring them
on-screen.
* Source/WebCore/page/cocoa/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::viewportVisibilityForElement):
Make use of the recently-extracted
computeClippedRectInMainFrameContentCoordinates
viewport intersection logic to determine if a given element is "visible".
(WebCore::ContentChangeObserver::reset):
Reset the new bits.
(WebCore::ContentChangeObserver::elementDidBecomeVisible):
Don't declare hover victory immediately if any element becomes visible, because
it's just a candidate, and might be demoted during confirmation, if it's
off-screen.
(WebCore::ContentChangeObserver::confirmVisibilityCandidates):
Work out if any of our visibilty change candidates are on-screen.
If none are, reset to "no change" state.
Consider candidates with running transitions to be "unknown"; we don't filter
elements we aren't sure are offscreen.
(WebCore::ContentChangeObserver::canNotifyClient const):
Factored out of `notifyClientIfNeeded`.
(WebCore::ContentChangeObserver::scheduleClientNotification):
(WebCore::ContentChangeObserver::notifyClientAfterConfirmingVisibilityCandidates):
Because we need to do layout to determine visibility, and can be under style
resolution,
we need to asynchronously confirm candidates. Because of this, we defer client
notification.
In many cases there are already timers involved, so this should be fine.
(WebCore::ContentChangeObserver::adjustObservedState):
Don't give up the instant we get a visibility candidate, because it might get
demoted, as mentioned above.
Also, keep a *separate* bit for DidAddMouseoutListenerAboveClickTarget, because
it will always win, and we don't want to reset to "no change" even if all
visibility
change candidates turn out to be offscreen.
* Source/WebCore/page/cocoa/ContentChangeObserver.h:
(WebCore::ContentChangeObserver::observedContentChange const):
Canonical link: https://commits.webkit.org/322251@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications