Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d2a0e0d9747a65754559c90e7cf7e096fb5b9b77
      
https://github.com/WebKit/WebKit/commit/d2a0e0d9747a65754559c90e7cf7e096fb5b9b77
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-07-19 (Sat, 19 Jul 2025)

  Changed paths:
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Tools/TestWebKitAPI/Tests/ios/WKScrollViewTests.mm

  Log Message:
  -----------
  [Liquid Glass] [iOS] Fixed color extensions are sometimes obscured by web 
content after rubber-banding and zooming
https://bugs.webkit.org/show_bug.cgi?id=296235
rdar://156144657

Reviewed by Richard Robinson.

It's possible for the top fixed color extension view to get stuck underneath 
`WKContentView` (and
thus, become obscured by web content) in the following scenario:

1.  There's a top fixed-position header on the page, with a corresponding top 
color extension view.
    The top scroll pocket is suppressed in this case, such that only the color 
extension is visible.

2.  The web view's scroll view rubber-bands past the top content offset while 
the `UIScrollView`
    has a refresh control, causing us to shuffle the color extension view 
*behind* the refresh
    control so that the refresh control won't get obscured by the solid color.

3.  The refresh control is removed from the scroll view, such that we end up 
returning early in
    `-_reinsertTopFixedColorExtensionViewIfNeeded` due to the refresh control 
subview index being
    `NSNotFound`.

4.  The web view then ends rubber-banding, and scrolls past the top content 
offset.

Because `-_reinsertTopFixedColorExtensionViewIfNeeded` requires all three 
subviews (refresh control,
content view and top color extension view) to be present, we skip restoring the 
color extension view
and it ends up being obscured. With the scroll edge effect hidden and the top 
fixed color extension
view obscured, the page content becomes fully visible behind the top obscured 
inset area.

In Safari, this happens when pinch-zooming in immediately after rubber-banding 
against the top of
the page. Only while the view is in unstable state (i.e. the user is still in 
the middle of a pinch
gesture), Safari removes `WKScrollView`'s refresh control, causing the color 
extension view to be
temporarily obscured.

To fix this, we handle the case where the refresh control was previously in the 
scroll view, but had
since been removed. Instead of returning early if any of the three views are 
absent, only bail if
there is no top color extension; handle the case where the refresh control is 
absent below, only
when checking whether we should reinsert the top color extension view behind 
the refresh control.

* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _reinsertTopFixedColorExtensionViewIfNeeded]):

See above for more details.

* Tools/TestWebKitAPI/Tests/ios/WKScrollViewTests.mm:
(TestWebKitAPI::TEST(WKScrollViewTests, 
TopColorExtensionViewAfterRemovingRefreshControl)):

Add an API test to exercise this fix.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to