Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c8c3aac34000d459e3d3a3408a891f934d8ed262
      
https://github.com/WebKit/WebKit/commit/c8c3aac34000d459e3d3a3408a891f934d8ed262
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2024-07-09 (Tue, 09 Jul 2024)

  Changed paths:
    M Source/WebCore/platform/ios/LocalCurrentTraitCollection.h
    M Source/WebCore/platform/ios/LocalCurrentTraitCollection.mm
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm

  Log Message:
  -----------
  REGRESSION (visionOS 2): Yahoo and AOL login pages flicker when adding a new 
Mail account
https://bugs.webkit.org/show_bug.cgi?id=276387
rdar://129308652

Reviewed by Aditya Keerthi.

On visionOS 2, after (what are probably) the changes in either rdar://117186193 
or rdar://117807846,
the following logic:

```
auto userInterfaceStyleTrait = [UITraitCollection 
traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleLight];
auto backgroundLevelTrait = [UITraitCollection 
traitCollectionWithUserInterfaceLevel:UIUserInterfaceLevelBase];
auto combinedTrait = [UITraitCollection 
traitCollectionWithTraitsFromCollections:@[ originalTrait.get(), 
userInterfaceStyleTrait, backgroundLevelTrait ]];
```

...no longer yields a `combinedTrait` that has a user interface idiom of 
`vision`, in the case
where `originalTrait` had a user interface of `vision`. Instead, the idiom 
reverts to `unspecified`,
which breaks downstream logic that attempts to override the user interface 
idiom in visionOS to be
equal to `pad`.

Subsequently, this causes `+[UIColor systemBackgroundColor]` to return 
transparent black instead of
white in `RenderThemeIOS::cssValueToSystemColorMap()`, which ultimately causes 
the page background
to be (incorrectly) transparent in `SLYahooAuthService`, leading to a flash as 
the page loads.

Interestingly...

(1) `+traitCollectionWithTraitsFromCollections:` is deprecated anyways, in 
favor of
    `-traitCollectionByModifyingTraits:` or `+traitCollectionWithTraits:`.

(2) `-traitCollectionByModifyingTraits:` doesn't have the same issue, and 
adopting it fixes the bug.

With that in mind, we can address the regression by moving from the deprecated 
API to one of the
replacements (`-traitCollectionByModifyingTraits:`).

* Source/WebCore/platform/ios/LocalCurrentTraitCollection.h:
* Source/WebCore/platform/ios/LocalCurrentTraitCollection.mm:

Adopt `-traitCollectionByModifyingTraits:`.

(WebCore::traitCollectionWithAdjustedIdiomForSystemColors):

Rename this from `adjustedTraitCollection` to 
`traitCollectionWithAdjustedIdiomForSystemColors` to
make the intent more obvious. Also, export it for use in the client layer.

(WebCore::LocalCurrentTraitCollection::LocalCurrentTraitCollection):
(WebCore::adjustedTraitCollection): Deleted.
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(scrollViewBackgroundColor):

Also add a missing idiom adjustment here, when determining the scroll view 
background color. This
ensures that `+systemBackgroundColor` is white to match the iPad idiom here as 
well.

Canonical link: https://commits.webkit.org/280802@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