Title: [243496] trunk/Tools
Revision
243496
Author
[email protected]
Date
2019-03-26 08:58:36 -0700 (Tue, 26 Mar 2019)

Log Message

Address NSWindow sometimes using WebKitTestRunnerEvent too early
https://bugs.webkit.org/show_bug.cgi?id=196211
rdar://problem/49110552

Reviewed by Tim Horton.

* WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize):
Make sure that EventSenderProxy always exists when running tests. We used to create
it when resetting before the first test, which is a bit too late.

* WebKitTestRunner/TestController.h:
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformCreateWebView):
(WTR::TestController::platformCreateOtherPage):
(WTR::TestController::finishCreatingPlatformWebView):
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Moved some code that made NSWindow use NSEvent during web view creation. We may
need to move more if some other case us found, but this is enough for now.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (243495 => 243496)


--- trunk/Tools/ChangeLog	2019-03-26 14:50:24 UTC (rev 243495)
+++ trunk/Tools/ChangeLog	2019-03-26 15:58:36 UTC (rev 243496)
@@ -1,3 +1,25 @@
+2019-03-25  Alexey Proskuryakov  <[email protected]>
+
+        Address NSWindow sometimes using WebKitTestRunnerEvent too early
+        https://bugs.webkit.org/show_bug.cgi?id=196211
+        rdar://problem/49110552
+
+        Reviewed by Tim Horton.
+
+        * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize):
+        Make sure that EventSenderProxy always exists when running tests. We used to create
+        it when resetting before the first test, which is a bit too late.
+
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+        (WTR::TestController::platformCreateWebView):
+        (WTR::TestController::platformCreateOtherPage):
+        (WTR::TestController::finishCreatingPlatformWebView):
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (WTR::PlatformWebView::PlatformWebView):
+        Moved some code that made NSWindow use NSEvent during web view creation. We may
+        need to move more if some other case us found, but this is enough for now.
+
 2019-03-26  Carlos Garcia Campos  <[email protected]>
 
         Unreviewed. Fix typo in GLib geolocation API after r243285.

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (243495 => 243496)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2019-03-26 14:50:24 UTC (rev 243495)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2019-03-26 15:58:36 UTC (rev 243496)
@@ -458,6 +458,8 @@
 
     WKRetainPtr<WKStringRef> pageGroupIdentifier(AdoptWK, WKStringCreateWithUTF8CString("WebKitTestRunnerPageGroup"));
     m_pageGroup.adopt(WKPageGroupCreateWithIdentifier(pageGroupIdentifier.get()));
+
+    m_eventSenderProxy = std::make_unique<EventSenderProxy>(this);
 }
 
 WKRetainPtr<WKContextConfigurationRef> TestController::generateContextConfiguration(const TestOptions::ContextOptions& options) const

Modified: trunk/Tools/WebKitTestRunner/TestController.h (243495 => 243496)


--- trunk/Tools/WebKitTestRunner/TestController.h	2019-03-26 14:50:24 UTC (rev 243495)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2019-03-26 15:58:36 UTC (rev 243496)
@@ -453,6 +453,10 @@
     static void runModal(WKPageRef, const void* clientInfo);
     static void runModal(PlatformWebView*);
 
+#if PLATFORM(COCOA)
+    static void finishCreatingPlatformWebView(PlatformWebView*, const TestOptions&);
+#endif
+
     static const char* libraryPathForTesting();
     static const char* platformLibraryPathForTesting();
 

Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (243495 => 243496)


--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2019-03-26 14:50:24 UTC (rev 243495)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2019-03-26 15:58:36 UTC (rev 243496)
@@ -166,6 +166,7 @@
     }
 
     m_mainWebView = std::make_unique<PlatformWebView>(copiedConfiguration.get(), options);
+    finishCreatingPlatformWebView(m_mainWebView.get(), options);
 
     if (options.punchOutWhiteBackgroundsInDarkMode)
         m_mainWebView->setDrawsBackground(false);
@@ -178,9 +179,22 @@
 {
     WKWebViewConfiguration *newConfiguration = [[globalWebViewConfiguration copy] autorelease];
     newConfiguration._relatedWebView = static_cast<WKWebView*>(parentView->platformView());
-    return new PlatformWebView(newConfiguration, options);
+    PlatformWebView* view = new PlatformWebView(newConfiguration, options);
+    finishCreatingPlatformWebView(view, options);
+    return view;
 }
 
+// Code that needs to run after TestController::m_mainWebView is initialized goes into this function.
+void TestController::finishCreatingPlatformWebView(PlatformWebView* view, const TestOptions& options)
+{
+#if PLATFORM(MAC)
+    if (options.shouldShowWebView)
+        [view->platformWindow() orderFront:nil];
+    else
+        [view->platformWindow() orderBack:nil];
+#endif
+}
+
 WKContextRef TestController::platformAdjustContext(WKContextRef context, WKContextConfigurationRef contextConfiguration)
 {
     initializeWebViewConfiguration(libraryPathForTesting(), injectedBundlePath(), context, contextConfiguration);

Modified: trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm (243495 => 243496)


--- trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm	2019-03-26 14:50:24 UTC (rev 243495)
+++ trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm	2019-03-26 15:58:36 UTC (rev 243496)
@@ -80,10 +80,6 @@
     [m_window setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameAqua]];
     [m_window setCollectionBehavior:NSWindowCollectionBehaviorStationary];
     [[m_window contentView] addSubview:m_view];
-    if (m_options.shouldShowWebView)
-        [m_window orderFront:nil];
-    else
-        [m_window orderBack:nil];
     [m_window setReleasedWhenClosed:NO];
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to