Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 389a07672e9c041d41b81f60a1657b47010d2ee4
      
https://github.com/WebKit/WebKit/commit/389a07672e9c041d41b81f60a1657b47010d2ee4
  Author: Wenson Hsieh <[email protected]>
  Date:   2026-08-10 (Mon, 10 Aug 2026)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView+TextExtraction.mm
    M 
Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeDrawingAreaProxyIOS.h
    M 
Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeDrawingAreaProxyIOS.mm
    M Tools/Scripts/webkitpy/api_tests/allowlist.txt
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm

  Log Message:
  -----------
  iOS: Automatic Password Fixes sometimes stall or time out after the device is 
locked
https://bugs.webkit.org/show_bug.cgi?id=321406
rdar://184191816

Reviewed by Abrar Rahman Protyasha.

When the device is locked, display link updates stop, which causes the 
rendering update lifecycle to
also stop. This breaks (among other things) `callAfterNextPresentationUpdate`, 
CSS animations and
transitions, and other behaviors that rely on regular rendering updates. In the 
context of
Automatically Fix Passwords, this may (for instance) cause a menu that appears 
after finishing a
view transition or animation runs to completion, to never show up after the 
agent issues a click
interaction.

To mitigate this, we add a mechanism that allows us to (manually) drive the 
display link update
lifecycle after issuing a text extraction interaction, only when 
`backgroundTextExtraction` is also
specified, as if the display were still refreshing.

Since this is all happening in the background anyways, there's no need to 
refresh at at the normal
rate of 120, 60 or even 30 fps — just a few frames a second is sufficient to 
ensure that it's still
possible to interact with these websites. For now, this is set to 4 frames per 
second (250 ms
between frames).

See below for more details.

Test: TextExtractionTests.ClickInteractionWithStalledDisplayLink

* Source/WebKit/UIProcess/API/Cocoa/WKWebView+TextExtraction.mm:
(-[WKWebView 
_performInteraction:inFrame:actionType:nodeIdentifier:staleNodeNote:shouldResolveStaleNodeIdentifier:completionHandler:]):

Use `startForcedDisplayRefreshWindowWithInterval` to kick off the forced 
display refresh mechanism
for up to 2 minutes.

* 
Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeDrawingAreaProxyIOS.h:
* 
Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeDrawingAreaProxyIOS.mm:
(-[WKDisplayLinkHandler displayLinkFired:]):
(-[WKDisplayLinkHandler startForcedDisplayRefreshWindowWithInterval:duration:]):

Add a helper method to restart the forced display refresh timer, until the 
given duration.

(-[WKDisplayLinkHandler _stopForcedDisplayRefresh]):
(-[WKDisplayLinkHandler _forcedRefreshTimerFired]):
(-[WKDisplayLinkHandler _needsForcedDisplayRefresh]):

If the display link is firing normally, make the forced display refresh timer 
duck out of the way to
avoid unnecessarily rendering updates.

(-[WKDisplayLinkHandler timerFired]):
(-[WKDisplayLinkHandler invalidate]):
(WebKit::RemoteLayerTreeDrawingAreaProxyIOS::startForcedDisplayRefreshWindow):
* Tools/Scripts/webkitpy/api_tests/allowlist.txt:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm:
(TestWebKitAPI::(TextExtractionTests, ClickInteractionWithStalledDisplayLink)):

Canonical link: https://commits.webkit.org/318919@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to