Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 710bef9faaee848ac98d26204b7c9406de8e6172
      
https://github.com/WebKit/WebKit/commit/710bef9faaee848ac98d26204b7c9406de8e6172
  Author: Chris Dumez <[email protected]>
  Date:   2026-02-04 (Wed, 04 Feb 2026)

  Changed paths:
    M Source/WTF/wtf/cocoa/TypeCastsCocoa.h
    M Source/WebKit/UIProcess/ios/WKScrollView.mm

  Log Message:
  -----------
  Address remaining Safer CPP casting warnings in WKScrollView.mm
https://bugs.webkit.org/show_bug.cgi?id=306930

Reviewed by Darin Adler.

* Source/WTF/wtf/cocoa/TypeCastsCocoa.h:
(WTF::checked_objc_cast):
(WTF::dynamic_objc_cast):
Drop `std::is_base_of_v<U, T>` static assertion in ObjC safe casting functions.
While this assertion stands in C++, it is actually too restrictive in ObjC.
For example, `WKUIScrollEdgeEffect` inherits `NSObject` can can be casted
safely to a `UIScrollEdgeEffect` still. This is because `WKUIScrollEdgeEffect`
acts as a proxy/wrapper around `UIScrollEdgeEffect`` using Objective-C's
message forwarding mechanism. `[wkWrapper isKindOfClass:[UIScrollEdgeEffect 
class]]`
will actually return YES.

* Source/WebKit/UIProcess/ios/WKScrollView.mm:
Add a include to attempt to fix an unsafe cast warning on this:
`static_cast<NSObject *>(_internalDelegate)`. This is a perfectly safe
upcast since `_internalDelegate` is a `WKWebView *` but my bet is that
the static analyzer did not know enough about the `WKWebView` type to
figure that out. I'm trying the include for now but if this doesn't work,
we may have to suppress the warning instead.

(-[WKScrollView topEdgeEffect]):
(-[WKScrollView leftEdgeEffect]):
(-[WKScrollView bottomEdgeEffect]):
(-[WKScrollView rightEdgeEffect]):
Adopt `checked_objc_cast()` for safety.

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



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

Reply via email to