Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1a16e315eb638ea271fb3ada1a8e8670ab622f9d
      
https://github.com/WebKit/WebKit/commit/1a16e315eb638ea271fb3ada1a8e8670ab622f9d
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2025-08-15 (Fri, 15 Aug 2025)

  Changed paths:
    M Source/WebKit/UIProcess/ios/WKScrollView.h
    M Source/WebKit/UIProcess/ios/WKScrollView.mm
    M Source/WebKit/UIProcess/ios/WKUIScrollEdgeEffect.h
    M Source/WebKit/UIProcess/ios/WKUIScrollEdgeEffect.mm
    M Tools/TestWebKitAPI/Tests/ios/WKScrollViewTests.mm

  Log Message:
  -----------
  [Liquid Glass] [iOS] Opening a cnn.com article in the background results in 
inverted toolbar colors
https://bugs.webkit.org/show_bug.cgi?id=297461
rdar://158367323

Reviewed by Timothy Hatcher and Abrar Rahman Protyasha.

When a top fixed-position header element is present, we currently sample the 
element's background
color and fill the top scroll pocket's background color with it, in addition to 
placing a solid
background color extension view inside the obscured inset area. On iPad, where 
Safari uses the hard
scroll edge effect style, we additionally:

1. Set the top scroll pocket to prefer solid (opaque) colors.
2. Set the top scroll pocket's capture color to the fixed position element's 
background color.

...only if the top scroll pocket uses the `.hard` pocket style. However, in the 
case where the
scroll pocket changes from `.soft` to `.hard` after the color has already been 
sampled, nothing
causes us to recompute and set the capture color. On websites like cnn.com 
where the top sampled
color differs from the page background color, this causes us to end up with a 
solid-color pocket
that matches the background of the page (white), but Safari expects a dark top 
pocket color (since
the top sampled color is black), and sets the interface style on the favorites 
bar and tab bar
accordingly; the end result is white text on a white background.

To fix this, we add plumbing to recompute and change the capture color as well 
as the "prefers solid
color hard pocket" flag when the style of the pocket changes.

* Source/WebKit/UIProcess/ios/WKScrollView.h:
* Source/WebKit/UIProcess/ios/WKScrollView.mm:
(-[WKScrollView _wk_topEdgeEffect]):
(-[WKScrollView _wk_leftEdgeEffect]):
(-[WKScrollView _wk_rightEdgeEffect]):
(-[WKScrollView _wk_bottomEdgeEffect]):
(-[WKScrollView _didChangeTopScrollEdgeEffectStyle]):
* Source/WebKit/UIProcess/ios/WKUIScrollEdgeEffect.h:
* Source/WebKit/UIProcess/ios/WKUIScrollEdgeEffect.mm:
(-[WKUIScrollEdgeEffect initWithScrollView:scrollEdgeEffect:boxSide:]):

Plumb the `WKScrollView` into the scroll edge effect wrapper.

(-[WKUIScrollEdgeEffect setStyle:]):

Call back to `WKScrollView` when the edge effect style changes.

(-[WKUIScrollEdgeEffect initWithScrollEdgeEffect:boxSide:]): Deleted.
* Tools/TestWebKitAPI/Tests/ios/WKScrollViewTests.mm:
(TestWebKitAPI::TEST(WKScrollViewTests, 
TopScrollPocketCaptureColorAfterSettingHardStyle)):

Add an API test that dynamically changes the top scroll edge effect style and 
verifies that:

1. The capture color of the top scroll edge effect matches the top fixed 
element.
2. The top scroll edge effect prefers solid colors.

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



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

Reply via email to