Remove obsolete NSRect/CGRect conversion functions

提交: 4b8fec20 | 2025-10-10 21:40:02+00:00

← 返回列表

Remove obsolete NSRect/CGRect conversion functions

Minor
提交哈希: 4b8fec20e731222552106323f6d07ab7d936772f
提交时间: 2025-10-10 21:40:02+00:00
影响等级: Minor
生成工具: webview2-upstream-sentry
上游审核链接: 查看上游审核 🔗

📋 摘要

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.

🎯 影响分析

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.

受影响的类:

ImmersiveModeControllerCocoa RenderWidgetHostViewCocoa WebContentsNSViewBridge