Repository: electron/electron
Pull request: fix: MacOS 26 Tahoe - stop overriding private cornerMask API to fix WindowServer GPU load

#### Description of Change

fixes: #48311 

- stop overriding the private `_cornerMask` selector in `ElectronNSWindow`
- remove the `cornerMask` plumbing that applied a custom mask image to vibrant views
- rely on AppKit’s default shadow rendering, which fixes the WindowServer GPU spike on macOS 26 Tahoe when shadows are enabled


Rationale:

> If AppKit uses method implementation identity to decide whether the window mask is static, then a subclass override (even if it calls super) will change that identity and force the compositor to treat the mask as dynamic.
>> ### Method-IMP sentinel check 
>>
>> AppKit asks: “is _cornerMask implemented by the standard theme frame?” via `class_getMethodImplementation` / `method_getImplementation.` 
>> If yes → treat masks as canonical and use a shared cache keyed by class/selector; 
>>if no → mark mask as custom and re-render per-window. → persistent high GPU load


Backwards-compat concerns:

I see no reason to override `_cornerMask` as the corner radius masking is already covered by `NSVisualEffectView` `setMaskImage`, rendering NO visual difference without `_cornerMask` override + vibrancy

#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] PR description included and stakeholders cc'd
- [x] `npm test` passes
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)
- [ ] relevant API documentation, tutorials, and examples are updated and follow the [documentation style guide](https://github.com/electron/electron/blob/main/docs/development/style-guide.md)
- [ ] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).

#### Release Notes

Notes: Fixed excessive WindowServer GPU usage on macOS Tahoe 26.

Changed files:
filename: shell/browser/native_window_mac.mm
patch: @@ -1333,7 +1333,6 @@ static bool FromV8(v8::Isolate* isolate,
       maskImage.capInsets = NSEdgeInsetsMake(radius, radius, radius, radius);
       maskImage.resizingMode = NSImageResizingModeStretch;
       [vibrantView setMaskImage:maskImage];
-      [window_ setCornerMask:maskImage];
     }
   }
 }

filename: shell/browser/ui/cocoa/electron_ns_window.h
patch: @@ -40,15 +40,13 @@ class ElectronNativeWindowObserver;
 @property BOOL disableAutoHideCursor;
 @property BOOL disableKeyOrMainWindow;
 @property(nonatomic, retain) NSVisualEffectView* vibrantView;
-@property(nonatomic, retain) NSImage* cornerMask;
 - (id)initWithShell:(electron::NativeWindowMac*)shell
           styleMask:(NSUInteger)styleMask;
 - (void)cleanup;
 - (electron::NativeWindowMac*)shell;
 - (id)accessibilityFocusedUIElement;
 - (NSRect)originalContentRectForFrameRect:(NSRect)frameRect;
 - (BOOL)toggleFullScreenMode:(id)sender;
-- (NSImage*)_cornerMask;
 - (void)disableHeadlessMode;
 @end
 

filename: shell/browser/ui/cocoa/electron_ns_window.mm
patch: @@ -25,7 +25,6 @@
 }  // namespace electron
 
 @interface NSWindow (PrivateAPI)
-- (NSImage*)_cornerMask;
 - (int64_t)_resizeDirectionForMouseLocation:(CGPoint)location;
 @end
 
@@ -123,7 +122,6 @@ @implementation ElectronNSWindow
 @synthesize disableAutoHideCursor;
 @synthesize disableKeyOrMainWindow;
 @synthesize vibrantView;
-@synthesize cornerMask;
 
 - (id)initWithShell:(electron::NativeWindowMac*)shell
           styleMask:(NSUInteger)styleMask {
@@ -308,16 +306,6 @@ - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item {
   return [super validateUserInterfaceItem:item];
 }
 
-// By overriding this built-in method the corners of the vibrant view (if set)
-// will be smooth.
-- (NSImage*)_cornerMask {
-  if (self.vibrantView != nil) {
-    return [self cornerMask];
-  } else {
-    return [super _cornerMask];
-  }
-}
-
 - (void)disableHeadlessMode {
   if (shell_) {
     // We initialize the window in headless mode to allow painting before it is