@@ -14390,10 +14390,10 @@ index 0000000000000000000000000000000000000000..00fb6b0006c743091a8bbf8edb18b211
14390
14390
+</Scheme>
14391
14391
diff --git a/Tools/Playwright/mac/AppDelegate.h b/Tools/Playwright/mac/AppDelegate.h
14392
14392
new file mode 100644
14393
- index 0000000000000000000000000000000000000000..ff88daf2035365d0f1d19c5adc47b467c7d4e980
14393
+ index 0000000000000000000000000000000000000000..ccc73af47f7bdb4813a9a1e6fb8d55d5d837c8d7
14394
14394
--- /dev/null
14395
14395
+++ b/Tools/Playwright/mac/AppDelegate.h
14396
- @@ -0,0 +1,54 @@
14396
+ @@ -0,0 +1,51 @@
14397
14397
+/*
14398
14398
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
14399
14399
+ *
@@ -14428,7 +14428,6 @@ index 0000000000000000000000000000000000000000..ff88daf2035365d0f1d19c5adc47b467
14428
14428
+@end
14429
14429
+
14430
14430
+@interface BrowserAppDelegate : NSObject <NSApplicationDelegate, WKNavigationDelegate, WKUIDelegate, _WKBrowserInspectorDelegate, _WKDownloadDelegate> {
14431
- + NSMutableSet *_browserWindowControllers;
14432
14431
+ NSMutableSet *_headlessWindows;
14433
14432
+ NSMutableSet *_browserContexts;
14434
14433
+ bool _headless;
@@ -14439,8 +14438,6 @@ index 0000000000000000000000000000000000000000..ff88daf2035365d0f1d19c5adc47b467
14439
14438
+ IBOutlet NSMenuItem *_newWebKit2WindowItem;
14440
14439
+}
14441
14440
+
14442
- +- (void)browserWindowWillClose:(NSWindow *)window;
14443
- +
14444
14441
+@end
14445
14442
+
14446
14443
+@interface NSApplication (PlaywrightApplicationExtensions)
@@ -14450,10 +14447,10 @@ index 0000000000000000000000000000000000000000..ff88daf2035365d0f1d19c5adc47b467
14450
14447
+@end
14451
14448
diff --git a/Tools/Playwright/mac/AppDelegate.m b/Tools/Playwright/mac/AppDelegate.m
14452
14449
new file mode 100644
14453
- index 0000000000000000000000000000000000000000..6eb18b8f492fe3937d2c38b36b4daebbe2199586
14450
+ index 0000000000000000000000000000000000000000..d46e0dbe9677760b63de22b837a08404a8042dd2
14454
14451
--- /dev/null
14455
14452
+++ b/Tools/Playwright/mac/AppDelegate.m
14456
- @@ -0,0 +1,440 @@
14453
+ @@ -0,0 +1,405 @@
14457
14454
+/*
14458
14455
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
14459
14456
+ *
@@ -14539,6 +14536,7 @@ index 0000000000000000000000000000000000000000..6eb18b8f492fe3937d2c38b36b4daebb
14539
14536
+- (id)init
14540
14537
+{
14541
14538
+ self = [super init];
14539
+ +
14542
14540
+ if (!self)
14543
14541
+ return nil;
14544
14542
+
@@ -14569,7 +14567,6 @@ index 0000000000000000000000000000000000000000..6eb18b8f492fe3937d2c38b36b4daebb
14569
14567
+ _dialogs = [[NSMutableSet alloc] init];
14570
14568
+ } else {
14571
14569
+ [NSApp activateIgnoringOtherApps:YES];
14572
- + _browserWindowControllers = [[NSMutableSet alloc] init];
14573
14570
+ }
14574
14571
+ if ([arguments containsObject: @"--inspector-pipe"])
14575
14572
+ [_WKBrowserInspector initializeRemoteInspectorPipe:self headless:_headless];
@@ -14651,23 +14648,6 @@ index 0000000000000000000000000000000000000000..6eb18b8f492fe3937d2c38b36b4daebb
14651
14648
+ return configuration;
14652
14649
+}
14653
14650
+
14654
- +- (BrowserWindowController *)createBrowserWindowController:(id)sender
14655
- +{
14656
- + if (_headless)
14657
- + return nil;
14658
- +
14659
- + BrowserWindowController *controller = [[[BrowserWindowController alloc] initWithConfiguration:[self defaultConfiguration]] autorelease];
14660
- + if (!controller)
14661
- + return nil;
14662
- + [_browserWindowControllers addObject:controller];
14663
- + return controller;
14664
- +}
14665
- +
14666
- +- (void)browserWindowWillClose:(NSWindow *)window
14667
- +{
14668
- + [_browserWindowControllers removeObject:window.windowController];
14669
- +}
14670
- +
14671
14651
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
14672
14652
+{
14673
14653
+ if (!_headless)
@@ -14680,22 +14660,6 @@ index 0000000000000000000000000000000000000000..6eb18b8f492fe3937d2c38b36b4daebb
14680
14660
+ _initialURL = nil;
14681
14661
+}
14682
14662
+
14683
- +- (BrowserWindowController *)frontmostBrowserWindowController
14684
- +{
14685
- + for (NSWindow* window in [NSApp windows]) {
14686
- + id delegate = [window delegate];
14687
- +
14688
- + if (![delegate isKindOfClass:[BrowserWindowController class]])
14689
- + continue;
14690
- +
14691
- + BrowserWindowController *controller = (BrowserWindowController *)delegate;
14692
- + assert([_browserWindowControllers containsObject:controller]);
14693
- + return controller;
14694
- + }
14695
- +
14696
- + return nil;
14697
- +}
14698
- +
14699
14663
+- (void)_updateNewWindowKeyEquivalents
14700
14664
+{
14701
14665
+ NSString *normalWindowEquivalent = @"n";
@@ -14729,19 +14693,17 @@ index 0000000000000000000000000000000000000000..6eb18b8f492fe3937d2c38b36b4daebb
14729
14693
+
14730
14694
+- (WKWebView *)createHeadfulPage:(WKWebViewConfiguration *)configuration withURL:(NSString*)urlString
14731
14695
+{
14732
- +
14733
- + BrowserWindowController *controller = [[[ BrowserWindowController alloc] initWithConfiguration:configuration] autorelease ];
14696
+ + // WebView lifecycle will control the BrowserWindowController life times.
14697
+ + BrowserWindowController *controller = [[BrowserWindowController alloc] initWithConfiguration:configuration];
14734
14698
+ if (!controller)
14735
14699
+ return nil;
14736
- + [[controller window] makeKeyAndOrderFront:nil];
14737
- + [_browserWindowControllers addObject:controller];
14738
14700
+ [controller loadURLString:urlString];
14739
14701
+ return [controller webView];
14740
14702
+}
14741
14703
+
14742
14704
+- (WKWebView *)createHeadlessPage:(WKWebViewConfiguration *)configuration withURL:(NSString*)urlString
14743
14705
+{
14744
- + NSRect rect = NSMakeRect(0, 0, 1024, 768 );
14706
+ + NSRect rect = NSMakeRect(0, 0, 1280, 720 );
14745
14707
+ NSScreen *firstScreen = [[NSScreen screens] objectAtIndex:0];
14746
14708
+ NSRect windowRect = NSOffsetRect(rect, -10000, [firstScreen frame].size.height - rect.size.height + 10000);
14747
14709
+ NSWindow* window = [[NSWindow alloc] initWithContentRect:windowRect styleMask:NSWindowStyleMaskBorderless backing:(NSBackingStoreType)_NSBackingStoreUnbuffered defer:YES];
@@ -15107,10 +15069,10 @@ index 0000000000000000000000000000000000000000..4dbf13c8fb31a745ae8e1965a457d4fb
15107
15069
+@end
15108
15070
diff --git a/Tools/Playwright/mac/BrowserWindowController.m b/Tools/Playwright/mac/BrowserWindowController.m
15109
15071
new file mode 100644
15110
- index 0000000000000000000000000000000000000000..8d4cf055b4e93f2990801cfbddc20182534ce594
15072
+ index 0000000000000000000000000000000000000000..c48697f7cfd699e3da720be6d9e4d0db90726984
15111
15073
--- /dev/null
15112
15074
+++ b/Tools/Playwright/mac/BrowserWindowController.m
15113
- @@ -0,0 +1,838 @@
15075
+ @@ -0,0 +1,839 @@
15114
15076
+/*
15115
15077
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
15116
15078
+ *
@@ -15308,6 +15270,7 @@ index 0000000000000000000000000000000000000000..8d4cf055b4e93f2990801cfbddc20182
15308
15270
+ _configuration = [configuration copy];
15309
15271
+ _isPrivateBrowsingWindow = !_configuration.websiteDataStore.isPersistent;
15310
15272
+ self.window.styleMask &= ~NSWindowStyleMaskFullSizeContentView;
15273
+ + [self.window makeKeyAndOrderFront:nil];
15311
15274
+ return self;
15312
15275
+}
15313
15276
+
@@ -15495,10 +15458,11 @@ index 0000000000000000000000000000000000000000..8d4cf055b4e93f2990801cfbddc20182
15495
15458
+
15496
15459
+- (void)windowWillClose:(NSNotification *)notification
15497
15460
+{
15498
- + [[[NSApplication sharedApplication] browserAppDelegate] browserWindowWillClose:self.window];
15499
15461
+ [_webView removeObserver:self forKeyPath:@"title"];
15500
15462
+ [_webView removeObserver:self forKeyPath:@"URL"];
15501
- + [self autorelease];
15463
+ + [_webView removeFromSuperview];
15464
+ + _textFinder.hideInterfaceCallback = nil;
15465
+ + [self release];
15502
15466
+}
15503
15467
+
15504
15468
+- (void)webViewDidClose:(WKWebView *)webView {
@@ -15571,9 +15535,8 @@ index 0000000000000000000000000000000000000000..8d4cf055b4e93f2990801cfbddc20182
15571
15535
+
15572
15536
+- (nullable WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
15573
15537
+{
15538
+ + // WebView lifecycle will control the BrowserWindowController life times.
15574
15539
+ BrowserWindowController *controller = [[BrowserWindowController alloc] initWithConfiguration:configuration];
15575
- + [controller.window makeKeyAndOrderFront:self];
15576
- +
15577
15540
+ return controller->_webView;
15578
15541
+}
15579
15542
+
0 commit comments