Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: de6e12d23e001e314af5f10b62e7b978bd4c9e42
      
https://github.com/WebKit/WebKit/commit/de6e12d23e001e314af5f10b62e7b978bd4c9e42
  Author: Ryan Reno <[email protected]>
  Date:   2026-02-25 (Wed, 25 Feb 2026)

  Changed paths:
    M Source/WebCore/page/scrolling/ScrollingTree.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
    M Tools/TestWebKitAPI/Tests/ios/WKScrollViewTests.mm

  Log Message:
  -----------
  Throttle visible content rect updates when changing obscured insets 
interactively.
https://bugs.webkit.org/show_bug.cgi?id=307463
rdar://156417823

Reviewed by Simon Fraser.

When changing obscured insets interactively we will get visible content rect 
updates every frame.
We update bookkeeping, scrolling tree state, trigger rendering update and tile 
painting,
as well as firing resize and viewport events. These things all add up to be 
expensive in terms
of power use. By throttling these updates we can save significant power, up to 
2% as measured by
an iOS browsing power benchmark on iPhones.

A previous attempt at improving the efficiency of this in 307417@main led to a 
bad regression when there
were fixed elements at the top or bottom of the view. During an interactive 
insets change the fixed
elements would be stuck in place until the throttle interval elapsed, at which 
time the layers would jump
into the correct position. This is fixed by throttling updates to WebContent 
still but we will update UI
process side bookkeeping so that the layer positions will continute to stay 
fixed relative to the viewport
and not fixed to the last, now stale, commit we got from WebContent. A new API 
test
(WKScrollViewTests.FixedLayerPositionDoesNotFreezeDuringInteractiveObscuredInsetsChange)
 verifies that the
layer does not have an egregious delta in position when in this state.

* Source/WebCore/page/scrolling/ScrollingTree.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _scheduleForcedVisibleContentRectUpdate]):
(-[WKWebView _cancelPendingVisibleContentRectUpdateTimer]):
(-[WKWebView _scheduleVisibleContentRectUpdateWithDelay:]):
(-[WKWebView _updateVisibleContentRects]):
(-[WKWebView _endInteractiveObscuredInsetsChange]):
* Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _hasPendingVisibleContentRectUpdateTimerForTesting]):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::updateVisibleContentRectsLocally):
* Tools/TestWebKitAPI/Tests/ios/WKScrollViewTests.mm:
(TestWebKitAPI::TEST(WKScrollViewTests, 
VisibleContentRectUpdatesDuringInteractiveObscuredInsetsChangeAreThrottled)):
(TestWebKitAPI::TEST(WKScrollViewTests, 
ThrottledVisibleContentRectUpdateTimerCancelledWhenEndingInteractiveUpdates)):
(TestWebKitAPI::TEST(WKScrollViewTests, 
ForcedVisibleContentRectUpdateCancelsPendingThrottleTimer)):
(TestWebKitAPI::TEST(WKScrollViewTests, 
FixedLayerPositionDoesNotFreezeDuringInteractiveObscuredInsetsChange)):

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



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

Reply via email to