Remove obsolete NSRect/CGRect conversion functions
Minor
Commit Hash:
4b8fec20e731222552106323f6d07ab7d936772f
Commit Time: 2025-10-10 21:40:02+00:00
Impact Level: Minor
Generated By: webview2-upstream-sentry
Upstream Review:
View Upstream Review 🔗
📋 Summary
This submission removes conversion functions between NSRect, NSPoint, NSSize and CGRect, CGPoint, CGSize that are no longer needed in the macOS 64-bit environment. In macOS 64-bit systems, Apple directly defines NSRect/NSPoint/NSSize as typedefs of CGRect/CGPoint/CGSize, making these conversion functions (such as NSRectFromCGRect, NSPointFromCGPoint, etc.) redundant. This change affects multiple remote_cocoa related files, including immersive mode controller, renderer view, web content view bridge, and other modules, uniformly simplifying the code for geometric type conversions.
🎯 Impact Analysis
The impact of this change on WebView2Mac is minimal. The change is essentially a code simplification, removing redundant type conversion function calls without altering any functionality or logical behavior. Since NSRect and CGRect are completely identical types on 64-bit macOS, directly using bounds.ToCGRect() instead of NSRectFromCGRect(bounds.ToCGRect()) is functionally equivalent. This modification improves code conciseness and readability, but does not affect WebView2Mac’s window management, geometry calculations, drag-and-drop operations, or any user-visible features. The only point to note is that if there are similar redundant conversion calls in downstream WebView2Mac code, it is recommended to perform similar cleanups to maintain code consistency.
Impacted Classes:
ImmersiveModeControllerCocoa
RenderWidgetHostViewCocoa
WebContentsNSViewBridge