Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8b5cfad939f76e35a20fbc885759fb82914843d0
      
https://github.com/WebKit/WebKit/commit/8b5cfad939f76e35a20fbc885759fb82914843d0
  Author: Lily Spiniolas <[email protected]>
  Date:   2026-07-29 (Wed, 29 Jul 2026)

  Changed paths:
    M Source/WTF/wtf/PlatformEnableCocoa.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ObscuredContentInsets.mm

  Log Message:
  -----------
  [iOS] Don't extend page colors under sidebar or top inset
https://bugs.webkit.org/show_bug.cgi?id=317336
rdar://177747987

Reviewed by Wenson Hsieh and Abrar Rahman Protyasha.

In iOS 27, page colors or content should not be visible in the leading obscured
content inset areas when the page is at the scroll origin. This behavior matches
macOS 27, and is also achieved with installing system background color extension
views. There are a few key differences from the macOS implementation that are 
noted
below (along with a general summary).

To prevent page content from being visible in the leading obscured content inset
areas on iOS, we create a left and/or right system background color extension 
view
equal to the left and/or right obscured content inset width, and position the 
views
in the inset areas so that they scroll with the web content. This matches macOS
behavior. As for the top obscured content area, we cannot directly control the
scroll edge effect view size like we do on macOS, so we instead draw the color
extensions directly over the scroll view so that the top extension can still
start with a width equal to the web view's unobscured width and then grow as the
user scrolls horizontally or zooms. We handle the positioning of the refresh
control so that it continues to display appropriately over sampled color 
extensions,
and we pin the height of top system background color extensions when scrolling 
past
the top extent of the scroll view so that it does not obscure refresh controls.

The 8 macOS tests for this behavior have been updated to support iOS as well.

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ObscuredContentInsets.mm

* Source/WTF/wtf/PlatformEnableCocoa.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _updateFixedColorExtensionViews]):
(-[WKWebView _updateFixedColorExtensionViewFrames]):
(-[WKWebView _webContentDistanceFromLeftEdge]):
(-[WKWebView _webContentDistanceFromRightEdge]):
(-[WKWebView _updateAppearanceForSystemBackgroundColorExtensionViews]):
(-[WKWebView _shouldAdjustColorExtensionsForHorizontalBannerViewOverlays]):
(-[WKWebView _hasDetectedHorizontalBannerViewOverlays]): Deleted.
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _cancelFixedColorExtensionFadeAnimationsForTesting]):
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _registerForNotifications]):
(-[WKWebView _reinsertTopFixedColorExtensionViewIfNeeded]):
(-[WKWebView scrollViewDidZoom:]):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ObscuredContentInsets.mm:
(TestWebKitAPI::HorizontalBannerOverlays::setUpWebView):
(TestWebKitAPI::HorizontalBannerOverlays::capturePageState):
(TestWebKitAPI::HorizontalBannerOverlays::scrollTo):
(TestWebKitAPI::HorizontalBannerOverlays::zoomTo):
(TestWebKitAPI::HorizontalBannerOverlays::computeGeometry):
(TestWebKitAPI::HorizontalBannerOverlays::expectFrameEqualWithTolerance):
(TestWebKitAPI::HorizontalBannerOverlays::leftSystemBackgroundFrame):
(TestWebKitAPI::HorizontalBannerOverlays::rightSystemBackgroundFrame):
(TestWebKitAPI::HorizontalBannerOverlays::assertLeftColorExtension):
(TestWebKitAPI::HorizontalBannerOverlays::assertRightColorExtension):
(TestWebKitAPI::HorizontalBannerOverlays::assertTopPocket):
(TestWebKitAPI::HorizontalBannerOverlays::assertTopColorExtension):
(TestWebKitAPI::HorizontalBannerOverlays::verifyColorExtensions):
(TestWebKitAPI::HorizontalBannerOverlays::runSubcases):
(TestWebKitAPI::TEST(ObscuredContentInsets, 
HorizontalBannerOverlaysNoOverflow)):
(TestWebKitAPI::TEST(ObscuredContentInsets, 
HorizontalBannerOverlaysLeftToRightOverflow)):
(TestWebKitAPI::TEST(ObscuredContentInsets, 
HorizontalBannerOverlaysLeftToRightOverflowWithFixedHeader)):
(TestWebKitAPI::TEST(ObscuredContentInsets, 
HorizontalBannerOverlaysLeftToRightOverflowWithFixedHeaderAndSidebar)):
(TestWebKitAPI::TEST(ObscuredContentInsets, 
HorizontalBannerOverlaysRightToLeftOverflow)):
(TestWebKitAPI::TEST(ObscuredContentInsets, 
HorizontalBannerOverlaysRightToLeftOverflowWithFixedHeader)):
(TestWebKitAPI::TEST(ObscuredContentInsets, 
HorizontalBannerOverlaysRightToLeftOverflowWithFixedHeaderAndSidebar)):
(TestWebKitAPI::TEST(ObscuredContentInsets, 
HorizontalBannerOverlaysSystemBackgroundColorTracksAppearance)):
(TestWebKitAPI::HorizontalBannerOverlays::computeExpectedFrames): Deleted.
(TestWebKitAPI::HorizontalBannerOverlays::verifyFrames): Deleted.

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



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

Reply via email to