Unreviewed, rolling out r188807, r188813, and r188815.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Aug 2015 02:32:41 +0000 (02:32 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Aug 2015 02:32:41 +0000 (02:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148349

lots of 32-bit build problems, better to resolve separately
and try again (Requested by thorton on #webkit).

Reverted changesets:

"WebKitTestRunner should use WKWebView on OS X and iOS"
https://bugs.webkit.org/show_bug.cgi?id=143743
http://trac.webkit.org/changeset/188807

"Stop building WebKitTestRunner for 32-bit platforms"
https://bugs.webkit.org/show_bug.cgi?id=143743
http://trac.webkit.org/changeset/188813

"Stop building WebKitTestRunner for 32-bit platforms"
https://bugs.webkit.org/show_bug.cgi?id=143743
http://trac.webkit.org/changeset/188815

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188817 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Tools/ChangeLog
Tools/WebKitTestRunner/Configurations/DebugRelease.xcconfig
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/PlatformWebView.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestInvocation.cpp
Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm [deleted file]
Tools/WebKitTestRunner/efl/TestControllerEfl.cpp
Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp
Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm
Tools/WebKitTestRunner/ios/TestControllerIOS.mm
Tools/WebKitTestRunner/mac/EventSenderProxy.mm
Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm
Tools/WebKitTestRunner/mac/TestControllerMac.mm

index 7dc2f93..97e2e15 100644 (file)
@@ -1,3 +1,25 @@
+2015-08-21  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r188807, r188813, and r188815.
+        https://bugs.webkit.org/show_bug.cgi?id=148349
+
+        lots of 32-bit build problems, better to resolve separately
+        and try again (Requested by thorton on #webkit).
+
+        Reverted changesets:
+
+        "WebKitTestRunner should use WKWebView on OS X and iOS"
+        https://bugs.webkit.org/show_bug.cgi?id=143743
+        http://trac.webkit.org/changeset/188807
+
+        "Stop building WebKitTestRunner for 32-bit platforms"
+        https://bugs.webkit.org/show_bug.cgi?id=143743
+        http://trac.webkit.org/changeset/188813
+
+        "Stop building WebKitTestRunner for 32-bit platforms"
+        https://bugs.webkit.org/show_bug.cgi?id=143743
+        http://trac.webkit.org/changeset/188815
+
 2015-08-21  Timothy Horton  <timothy_horton@apple.com>
 
         WebKitTestRunner should use WKWebView on OS X and iOS
index 07095e3..16852af 100644 (file)
     macro(ThreadedScrollingEnabled, threadedScrollingEnabled, Bool, bool, true) \
     macro(SimpleLineLayoutEnabled, simpleLineLayoutEnabled, Bool, bool, true) \
     macro(SubpixelCSSOMElementMetricsEnabled, subpixelCSSOMElementMetricsEnabled, Bool, bool, false) \
+    macro(BackgroundShouldExtendBeyondPage, backgroundShouldExtendBeyondPage, Bool, bool, false) \
     macro(MediaStreamEnabled, mediaStreamEnabled, Bool, bool, false) \
     macro(UseLegacyTextAlignPositionedElementBehavior, useLegacyTextAlignPositionedElementBehavior, Bool, bool, false) \
     macro(SpatialNavigationEnabled, spatialNavigationEnabled, Bool, bool, false) \
index 0e01f85..141bf1d 100644 (file)
@@ -3083,16 +3083,6 @@ static inline WebKit::FindOptions toFindOptions(_WKFindOptions wkFindOptions)
     return [_wkView _topContentInset];
 }
 
-- (BOOL)_windowOcclusionDetectionEnabled
-{
-    return [_wkView windowOcclusionDetectionEnabled];
-}
-
-- (void)_setWindowOcclusionDetectionEnabled:(BOOL)flag
-{
-    [_wkView setWindowOcclusionDetectionEnabled:flag];
-}
-
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
 
 - (void)_setAutomaticallyAdjustsContentInsets:(BOOL)automaticallyAdjustsContentInsets
index a1edf8b..79e90e1 100644 (file)
@@ -173,9 +173,6 @@ WK_EXTERN NSString * const _WKShouldOpenExternalURLsKey WK_AVAILABLE(WK_MAC_TBA,
 
 // Default value is 0. A value of 0 means the window's backing scale factor will be used and automatically update when the window moves screens.
 @property (nonatomic, setter=_setOverrideDeviceScaleFactor:) CGFloat _overrideDeviceScaleFactor WK_AVAILABLE(WK_MAC_TBA, NA);
-
-@property (nonatomic, setter=_setWindowOcclusionDetectionEnabled:) BOOL _windowOcclusionDetectionEnabled;
-
 #endif
 
 - (void)_killWebContentProcessAndResetState;
index c52731e..50e08c7 100644 (file)
@@ -615,18 +615,3 @@ void WKBundlePagePostSynchronousMessageForTesting(WKBundlePageRef pageRef, WKStr
     if (returnDataRef)
         *returnDataRef = toAPI(returnData.release().leakRef());
 }
-
-void WKBundlePageAddUserScript(WKBundlePageRef pageRef, WKStringRef source, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames)
-{
-    toImpl(pageRef)->addUserScript(toWTFString(source), toUserContentInjectedFrames(injectedFrames), toUserScriptInjectionTime(injectionTime));
-}
-
-void WKBundlePageAddUserStyleSheet(WKBundlePageRef pageRef, WKStringRef source, WKUserContentInjectedFrames injectedFrames)
-{
-    toImpl(pageRef)->addUserStyleSheet(toWTFString(source), toUserContentInjectedFrames(injectedFrames));
-}
-
-void WKBundlePageRemoveAllUserContent(WKBundlePageRef pageRef)
-{
-    toImpl(pageRef)->removeAllUserContent();
-}
index cdcd155..c66e74c 100644 (file)
@@ -29,8 +29,6 @@
 #include <WebKit/WKBase.h>
 #include <WebKit/WKEvent.h>
 #include <WebKit/WKGeometry.h>
-#include <WebKit/WKUserContentInjectedFrames.h>
-#include <WebKit/WKUserScriptInjectionTime.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -95,11 +93,6 @@ typedef unsigned WKRenderingSuppressionToken;
 WK_EXPORT WKRenderingSuppressionToken WKBundlePageExtendIncrementalRenderingSuppression(WKBundlePageRef);
 WK_EXPORT void WKBundlePageStopExtendingIncrementalRenderingSuppression(WKBundlePageRef, WKRenderingSuppressionToken);
 
-// UserContent API (compatible with Modern API, for WKTR)
-WK_EXPORT void WKBundlePageAddUserScript(WKBundlePageRef page, WKStringRef source, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames);
-WK_EXPORT void WKBundlePageAddUserStyleSheet(WKBundlePageRef page, WKStringRef source, WKUserContentInjectedFrames injectedFrames);
-WK_EXPORT void WKBundlePageRemoveAllUserContent(WKBundlePageRef page);
-
 #if TARGET_OS_IPHONE
 WK_EXPORT void WKBundlePageSetUseTestingViewportConfiguration(WKBundlePageRef, bool);
 #endif
index 0d7b9df..8c661f9 100644 (file)
@@ -5006,30 +5006,4 @@ void WebPage::imageOrMediaDocumentSizeChanged(const IntSize& newSize)
     send(Messages::WebPageProxy::ImageOrMediaDocumentSizeChanged(newSize));
 }
 
-void WebPage::addUserScript(const String& source, WebCore::UserContentInjectedFrames injectedFrames, WebCore::UserScriptInjectionTime injectionTime)
-{
-    ASSERT(m_userContentController);
-
-    WebCore::UserScript userScript(source, WebCore::blankURL(), Vector<String>(), Vector<String>(), injectionTime, injectedFrames);
-
-    m_userContentController->userContentController().addUserScript(mainThreadNormalWorld(), std::make_unique<WebCore::UserScript>(userScript));
-}
-
-void WebPage::addUserStyleSheet(const String& source, WebCore::UserContentInjectedFrames injectedFrames)
-{
-    ASSERT(m_userContentController);
-
-    WebCore::UserStyleSheet userStyleSheet(source, WebCore::blankURL(), Vector<String>(), Vector<String>(), injectedFrames, UserStyleUserLevel);
-
-    m_userContentController->userContentController().addUserStyleSheet(mainThreadNormalWorld(), std::make_unique<WebCore::UserStyleSheet>(userStyleSheet), InjectInExistingDocuments);
-}
-
-void WebPage::removeAllUserContent()
-{
-    if (!m_userContentController)
-        return;
-
-    m_userContentController->userContentController().removeAllUserContent();
-}
-
 } // namespace WebKit
index 090792c..aed049a 100644 (file)
@@ -63,8 +63,6 @@
 #include <WebCore/TextChecking.h>
 #include <WebCore/TextIndicator.h>
 #include <WebCore/UserActivity.h>
-#include <WebCore/UserContentTypes.h>
-#include <WebCore/UserScriptTypes.h>
 #include <WebCore/ViewState.h>
 #include <WebCore/ViewportConfiguration.h>
 #include <WebCore/WebCoreKeyboardUIMode.h>
@@ -916,10 +914,6 @@ public:
 #endif
 #endif
 
-    void addUserScript(const String& source, WebCore::UserContentInjectedFrames, WebCore::UserScriptInjectionTime);
-    void addUserStyleSheet(const String& source, WebCore::UserContentInjectedFrames);
-    void removeAllUserContent();
-
 private:
     WebPage(uint64_t pageID, const WebPageCreationParameters&);
 
index e2ee0ff..b9da072 100644 (file)
@@ -1,3 +1,25 @@
+2015-08-21  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r188807, r188813, and r188815.
+        https://bugs.webkit.org/show_bug.cgi?id=148349
+
+        lots of 32-bit build problems, better to resolve separately
+        and try again (Requested by thorton on #webkit).
+
+        Reverted changesets:
+
+        "WebKitTestRunner should use WKWebView on OS X and iOS"
+        https://bugs.webkit.org/show_bug.cgi?id=143743
+        http://trac.webkit.org/changeset/188807
+
+        "Stop building WebKitTestRunner for 32-bit platforms"
+        https://bugs.webkit.org/show_bug.cgi?id=143743
+        http://trac.webkit.org/changeset/188813
+
+        "Stop building WebKitTestRunner for 32-bit platforms"
+        https://bugs.webkit.org/show_bug.cgi?id=143743
+        http://trac.webkit.org/changeset/188815
+
 2015-08-21  Tim Horton  <timothy_horton@apple.com>
 
         Stop building WebKitTestRunner for 32-bit platforms
index 37a3ce0..adac849 100644 (file)
@@ -24,7 +24,7 @@
 #include "../../../../Internal/Configurations/HaveInternalSDK.xcconfig"
 #include "Base.xcconfig"
 
-VALID_ARCHS[sdk=macosx*] = $(ARCHS_STANDARD_64_BIT);
+ARCHS = $(ARCHS_STANDARD_32_64_BIT);
 
 ONLY_ACTIVE_ARCH = YES;
 
index 0571a35..99c8645 100644 (file)
@@ -261,7 +261,7 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings)
     WKBundleSetPluginsEnabled(m_bundle, m_pageGroup, true);
     WKBundleSetPopupBlockingEnabled(m_bundle, m_pageGroup, false);
 
-    WKBundlePageRemoveAllUserContent(page()->page());
+    WKBundleRemoveAllUserContent(m_bundle, m_pageGroup);
 
     m_testRunner->setShouldDumpFrameLoadCallbacks(booleanForKey(settings, "DumpFrameLoadDelegates"));
     m_testRunner->setUserStyleSheetEnabled(false);
index 2085607..0100a3b 100644 (file)
@@ -172,8 +172,10 @@ void TestRunner::notifyDone()
 void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames)
 {
     WKRetainPtr<WKStringRef> sourceWK = toWK(source);
+    WKRetainPtr<WKBundleScriptWorldRef> scriptWorld(AdoptWK, WKBundleScriptWorldCreateWorld());
 
-    WKBundlePageAddUserScript(InjectedBundle::singleton().page()->page(), sourceWK.get(),
+    auto& injectedBundle = InjectedBundle::singleton();
+    WKBundleAddUserScript(injectedBundle.bundle(), injectedBundle.pageGroup(), scriptWorld.get(), sourceWK.get(), 0, 0, 0,
         (runAtStart ? kWKInjectAtDocumentStart : kWKInjectAtDocumentEnd),
         (allFrames ? kWKInjectInAllFrames : kWKInjectInTopFrameOnly));
 }
@@ -181,8 +183,10 @@ void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFram
 void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames)
 {
     WKRetainPtr<WKStringRef> sourceWK = toWK(source);
+    WKRetainPtr<WKBundleScriptWorldRef> scriptWorld(AdoptWK, WKBundleScriptWorldCreateWorld());
 
-    WKBundlePageAddUserStyleSheet(InjectedBundle::singleton().page()->page(), sourceWK.get(),
+    auto& injectedBundle = InjectedBundle::singleton();
+    WKBundleAddUserStyleSheet(injectedBundle.bundle(), injectedBundle.pageGroup(), scriptWorld.get(), sourceWK.get(), 0, 0, 0,
         (allFrames ? kWKInjectInAllFrames : kWKInjectInTopFrameOnly));
 }
 
index 36f7535..a13089b 100644 (file)
 #include "ViewOptions.h"
 #include <WebKit/WKRetainPtr.h>
 
-#if PLATFORM(COCOA)
-OBJC_CLASS NSView;
-OBJC_CLASS UIView;
-OBJC_CLASS WKWebView;
-OBJC_CLASS WKWebViewConfiguration;
-OBJC_CLASS WebKitTestRunnerWindow;
-
-typedef WKWebView* PlatformWKView;
+#if defined(__APPLE__) && __APPLE__
+#ifdef __OBJC__
+@class WKView;
+@class WebKitTestRunnerWindow;
+#else
+class WKView;
+class WebKitTestRunnerWindow;
+#endif
+typedef WKView* PlatformWKView;
 typedef WebKitTestRunnerWindow* PlatformWindow;
 #elif defined(BUILDING_GTK__)
 typedef struct _GtkWidget GtkWidget;
@@ -51,11 +52,7 @@ namespace WTR {
 
 class PlatformWebView {
 public:
-#if PLATFORM(COCOA)
-    PlatformWebView(WKWebViewConfiguration*, const ViewOptions&);
-#else
     PlatformWebView(WKPageConfigurationRef, const ViewOptions&);
-#endif
     ~PlatformWebView();
 
     WKPageRef page();
@@ -64,6 +61,9 @@ public:
     void resizeTo(unsigned width, unsigned height);
     void focus();
 
+    // Window snapshot is always enabled by default on all other platform.
+    static bool windowSnapshotEnabled() { return true; }
+
     WKRect windowFrame();
     void setWindowFrame(WKRect);
 
index 63228b0..b2f77fb 100644 (file)
@@ -197,11 +197,11 @@ static void decidePolicyForUserMediaPermissionRequest(WKPageRef, WKFrameRef, WKS
     TestController::singleton().handleUserMediaPermissionRequest(permissionRequest);
 }
 
-WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo)
+WKPageRef TestController::createOtherPage(WKPageRef oldPpage, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo)
 {
     PlatformWebView* parentView = static_cast<PlatformWebView*>(const_cast<void*>(clientInfo));
 
-    PlatformWebView* view = platformCreateOtherPage(parentView, configuration, parentView->options());
+    PlatformWebView* view = new PlatformWebView(configuration, parentView->options());
     WKPageRef newPage = view->page();
 
     view->resizeTo(800, 600);
@@ -310,6 +310,7 @@ const char* TestController::libraryPathForTesting()
     return platformLibraryPathForTesting();
 }
 
+
 void TestController::initialize(int argc, const char* argv[])
 {
     platformInitialize();
@@ -371,8 +372,8 @@ void TestController::initialize(int argc, const char* argv[])
         WKContextConfigurationSetWebSQLDatabaseDirectory(configuration.get(), toWK(temporaryFolder + separator + "Databases" + separator + "WebSQL").get());
         WKContextConfigurationSetMediaKeysStorageDirectory(configuration.get(), toWK(temporaryFolder + separator + "MediaKeys").get());
     }
-    m_context = platformAdjustContext(adoptWK(WKContextCreateWithConfiguration(configuration.get())).get(), configuration.get());
 
+    m_context = adoptWK(WKContextCreateWithConfiguration(configuration.get()));
     m_geolocationProvider = std::make_unique<GeolocationProviderMock>(m_context.get());
 
 #if PLATFORM(EFL)
@@ -434,7 +435,6 @@ void TestController::initialize(int argc, const char* argv[])
     m_configuration = adoptWK(WKPageConfigurationCreate());
     WKPageConfigurationSetContext(m_configuration.get(), m_context.get());
     WKPageConfigurationSetPageGroup(m_configuration.get(), m_pageGroup.get());
-    WKPageConfigurationSetUserContentController(m_configuration.get(), adoptWK(WKUserContentControllerCreate()).get());
 
     // Some preferences (notably mock scroll bars setting) currently cannot be re-applied to an existing view, so we need to set them now.
     resetPreferencesToConsistentValues();
@@ -442,7 +442,7 @@ void TestController::initialize(int argc, const char* argv[])
 
 void TestController::createWebViewWithOptions(const ViewOptions& options)
 {
-    platformCreateWebView(m_configuration.get(), options);
+    m_mainWebView = std::make_unique<PlatformWebView>(m_configuration.get(), options);
     WKPageUIClientV6 pageUIClient = {
         { 6, m_mainWebView.get() },
         0, // createNewPage_deprecatedForUseWithV0
@@ -568,7 +568,7 @@ void TestController::ensureViewSupportsOptionsForTest(const TestInvocation& test
 void TestController::resetPreferencesToConsistentValues()
 {
     // Reset preferences
-    WKPreferencesRef preferences = platformPreferences();
+    WKPreferencesRef preferences = WKPageGroupGetPreferences(m_pageGroup.get());
     WKPreferencesResetTestRunnerOverrides(preferences);
     WKPreferencesSetPageVisibilityBasedProcessSuppressionEnabled(preferences, false);
     WKPreferencesSetOfflineWebApplicationCacheEnabled(preferences, true);
@@ -622,8 +622,6 @@ void TestController::resetPreferencesToConsistentValues()
     WKPreferencesSetHiddenPageCSSAnimationSuspensionEnabled(preferences, false);
 
     WKPreferencesSetAcceleratedDrawingEnabled(preferences, m_shouldUseAcceleratedDrawing);
-    // FIXME: We should be testing the default.
-    WKPreferencesSetStorageBlockingPolicy(preferences, kWKAllowAllStorage);
 
     WKCookieManagerDeleteAllCookies(WKContextGetCookieManager(m_context.get()));
 
@@ -636,11 +634,6 @@ bool TestController::resetStateToConsistentValues()
 
     m_beforeUnloadReturnValue = true;
 
-    // This setting differs between the antique and modern Mac WebKit2 API.
-    // For now, maintain the antique behavior, because some tests depend on it!
-    // FIXME: We should be testing the default.
-    WKPageSetBackgroundExtendsBeyondPage(m_mainWebView->page(), false);
-
     WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("Reset"));
     WKRetainPtr<WKMutableDictionaryRef> resetMessageBody = adoptWK(WKMutableDictionaryCreate());
 
@@ -675,7 +668,7 @@ bool TestController::resetStateToConsistentValues()
     WKTextCheckerContinuousSpellCheckingEnabledStateChanged(true);
 #endif
 
-    // In the case that a test using the chrome input field failed, be sure to clean up for the next test.
+    // in the case that a test using the chrome input field failed, be sure to clean up for the next test
     m_mainWebView->removeChromeInputField();
     m_mainWebView->focus();
 
@@ -717,9 +710,9 @@ bool TestController::resetStateToConsistentValues()
 
     m_shouldLogHistoryClientCallbacks = false;
 
-    setHidden(false);
+    WKPageGroupRemoveAllUserContentFilters(WKPageGetPageGroup(m_mainWebView->page()));
 
-    platformResetStateToConsistentValues();
+    setHidden(false);
 
     // Reset main page back to about:blank
     m_doneResetting = false;
@@ -1600,36 +1593,4 @@ void TestController::didUpdateHistoryTitle(WKStringRef title, WKURLRef URL, WKFr
     m_currentInvocation->outputText(String::format("WebView updated the title for history URL \"%s\" to \"%s\".\n", toSTD(urlStringWK).c_str(), toSTD(title).c_str()));
 }
 
-#if !PLATFORM(COCOA)
-void TestController::platformWillRunTest(const TestInvocation&)
-{
-}
-
-WKPreferencesRef TestController::platformPreferences()
-{
-    WKRetainPtr<WKPageConfigurationRef> configuration = adoptWK(WKPageCopyPageConfiguration(m_mainWebView->page())); 
-    return WKPageConfigurationGetPreferences(configuration.get());
-}
-
-void TestController::platformCreateWebView(WKPageConfigurationRef configuration, const ViewOptions& options)
-{
-    m_mainWebView = std::make_unique<PlatformWebView>(configuration, options);
-}
-
-PlatformWebView* TestController::platformCreateOtherPage(PlatformWebView* parentView, WKPageConfigurationRef configuration, const ViewOptions& options)
-{
-    return new PlatformWebView(configuration, options);
-}
-
-WKContextRef TestController::platformAdjustContext(WKContextRef context, WKContextConfigurationRef contextConfiguration)
-{
-    return context;
-}
-
-void TestController::platformResetStateToConsistentValues()
-{
-
-}
-#endif
-
 } // namespace WTR
index dd7f808..152b78c 100644 (file)
@@ -34,8 +34,6 @@
 #include <vector>
 #include <wtf/Vector.h>
 
-OBJC_CLASS WKWebViewConfiguration;
-
 namespace WTR {
 
 class TestInvocation;
@@ -134,17 +132,12 @@ private:
 
     void platformInitialize();
     void platformDestroy();
-    WKContextRef platformAdjustContext(WKContextRef, WKContextConfigurationRef);
     void platformInitializeContext();
-    void platformCreateWebView(WKPageConfigurationRef, const ViewOptions&);
-    static PlatformWebView* platformCreateOtherPage(PlatformWebView* parentView, WKPageConfigurationRef, const ViewOptions&);
     void platformResetPreferencesToConsistentValues();
-    void platformResetStateToConsistentValues();
     void platformConfigureViewForTest(const TestInvocation&);
     void platformWillRunTest(const TestInvocation&);
     void platformRunUntil(bool& done, double timeout);
     void platformDidCommitLoadForFrame(WKPageRef, WKFrameRef);
-    WKPreferencesRef platformPreferences();
     void initializeInjectedBundlePath();
     void initializeTestPluginDirectory();
 
index f154c98..7a36d49 100644 (file)
@@ -268,13 +268,15 @@ void TestInvocation::dumpResults()
         dumpAudio(m_audioResult.get());
 
     if (m_dumpPixels && m_pixelResult) {
-        m_gotRepaint = false;
-        WKPageForceRepaint(TestController::singleton().mainWebView()->page(), this, TestInvocation::forceRepaintDoneCallback);
-        TestController::singleton().runUntil(m_gotRepaint, TestController::shortTimeout);
-        if (!m_gotRepaint) {
-            m_errorMessage = "Timed out waiting for pre-pixel dump repaint\n";
-            m_webProcessIsUnresponsive = true;
-            return;
+        if (PlatformWebView::windowSnapshotEnabled()) {
+            m_gotRepaint = false;
+            WKPageForceRepaint(TestController::singleton().mainWebView()->page(), this, TestInvocation::forceRepaintDoneCallback);
+            TestController::singleton().runUntil(m_gotRepaint, TestController::shortTimeout);
+            if (!m_gotRepaint) {
+                m_errorMessage = "Timed out waiting for pre-pixel dump repaint\n";
+                m_webProcessIsUnresponsive = true;
+                return;
+            }
         }
         dumpPixelsAndCompareWithExpected(m_pixelResult.get(), m_repaintRects.get());
     }
index f11c43d..0ed5a03 100644 (file)
@@ -40,8 +40,6 @@
                29A8FCDD145F0337009045A6 /* JSAccessibilityTextMarkerRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29A8FCE1345E7021006AA5A6 /* JSAccessibilityTextMarkerRange.cpp */; };
                29A8FCE2145F037B009045A6 /* AccessibilityTextMarkerRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29A8FCE1145F037B009045A6 /* AccessibilityTextMarkerRange.cpp */; };
                29A8FCE5145F0464009045A6 /* AccessibilityTextMarkerRangeMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29A8FCE4145F0464009045A6 /* AccessibilityTextMarkerRangeMac.mm */; };
-               2DCE2CD31B8452F800C7F832 /* TestControllerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */; };
-               2DCE2CD41B84530A00C7F832 /* TestControllerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */; };
                2E34C90018B68808000067BB /* WebKitTestRunnerInjectedBundle.bundle in Resources */ = {isa = PBXBuildFile; fileRef = BC25186211D15D54002EBC01 /* WebKitTestRunnerInjectedBundle.bundle */; };
                2E63ED8A1891AD7E002A7AFC /* AccessibilityControllerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E63ED751891ACE9002A7AFC /* AccessibilityControllerIOS.mm */; };
                2E63ED8B1891AD7E002A7AFC /* AccessibilityTextMarkerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E63ED771891ACE9002A7AFC /* AccessibilityTextMarkerIOS.mm */; };
                29A8FCE1345E7021006AA5A6 /* JSAccessibilityTextMarkerRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSAccessibilityTextMarkerRange.cpp; path = DerivedSources/WebKitTestRunner/JSAccessibilityTextMarkerRange.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
                29A8FCE1345E7021006AA5A7 /* JSAccessibilityTextMarkerRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSAccessibilityTextMarkerRange.h; path = DerivedSources/WebKitTestRunner/JSAccessibilityTextMarkerRange.h; sourceTree = BUILT_PRODUCTS_DIR; };
                29A8FCE4145F0464009045A6 /* AccessibilityTextMarkerRangeMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityTextMarkerRangeMac.mm; sourceTree = "<group>"; };
-               2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestControllerCocoa.mm; path = cocoa/TestControllerCocoa.mm; sourceTree = "<group>"; };
                2E63ED751891ACE9002A7AFC /* AccessibilityControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityControllerIOS.mm; sourceTree = "<group>"; };
                2E63ED761891ACE9002A7AFC /* AccessibilityNotificationHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityNotificationHandler.h; sourceTree = "<group>"; };
                2E63ED771891ACE9002A7AFC /* AccessibilityTextMarkerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityTextMarkerIOS.mm; sourceTree = "<group>"; };
                        children = (
                                0FEB90A21905BC6A000FDBF3 /* CrashReporterInfo.h */,
                                0FEB90A31905BC6A000FDBF3 /* CrashReporterInfo.mm */,
-                               2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */,
                        );
                        name = cocoa;
                        sourceTree = "<group>";
                                2E63ED971891ADC7002A7AFC /* PixelDumpSupport.cpp in Sources */,
                                2E63ED981891ADC7002A7AFC /* TestController.cpp in Sources */,
                                2E63ED921891ADAD002A7AFC /* TestControllerIOS.mm in Sources */,
-                               2DCE2CD31B8452F800C7F832 /* TestControllerCocoa.mm in Sources */,
                                0FEB90A81905C537000FDBF3 /* CrashReporterInfo.mm in Sources */,
                                2E63ED991891ADC7002A7AFC /* TestInvocation.cpp in Sources */,
                                2E63EDA51891BD8E002A7AFC /* TestInvocationCG.cpp in Sources */,
                                E1C642C317CBCC7300D66A3C /* PoseAsClass.mm in Sources */,
                                E132AA3D17CE776F00611DF0 /* WebKitTestRunnerEvent.mm in Sources */,
                                5670B8281386FCA5002EB355 /* EventSenderProxy.mm in Sources */,
-                               2DCE2CD41B84530A00C7F832 /* TestControllerCocoa.mm in Sources */,
                                26D758E7160BECDD00268472 /* GeolocationProviderMock.cpp in Sources */,
                                BC793400118F7C84005EA8E2 /* main.mm in Sources */,
                                5322FB4613FDA0EA0041ABCC /* PixelDumpSupport.cpp in Sources */,
diff --git a/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm b/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
deleted file mode 100644 (file)
index ae2df50..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "TestController.h"
-
-#import "CrashReporterInfo.h"
-#import "PlatformWebView.h"
-#import "TestInvocation.h"
-#import <Foundation/Foundation.h>
-#import <WebKit/WKContextConfigurationRef.h>
-#import <WebKit/WKPreferencesRefPrivate.h>
-#import <WebKit/WKProcessPoolPrivate.h>
-#import <WebKit/WKStringCF.h>
-#import <WebKit/WKUserContentControllerPrivate.h>
-#import <WebKit/WKWebView.h>
-#import <WebKit/WKWebViewConfiguration.h>
-#import <WebKit/WKWebViewConfigurationPrivate.h>
-#import <WebKit/_WKProcessPoolConfiguration.h>
-#import <WebKit/_WKUserContentExtensionStore.h>
-#import <WebKit/_WKUserContentExtensionStorePrivate.h>
-#import <wtf/MainThread.h>
-
-namespace WTR {
-
-static WKWebViewConfiguration *globalWebViewConfiguration;
-
-void initializeWebViewConfiguration(const char* libraryPath, WKStringRef injectedBundlePath, WKContextRef context, WKContextConfigurationRef contextConfiguration)
-{
-    ASSERT(!globalWebViewConfiguration);
-    globalWebViewConfiguration = [[WKWebViewConfiguration alloc] init];
-
-    globalWebViewConfiguration.processPool = [[WKProcessPool alloc] _initWithConfiguration:(_WKProcessPoolConfiguration *)contextConfiguration];
-    globalWebViewConfiguration.websiteDataStore = (WKWebsiteDataStore *)WKContextGetWebsiteDataStore(context);
-}
-
-WKPreferencesRef TestController::platformPreferences()
-{
-    return (WKPreferencesRef)globalWebViewConfiguration.preferences;
-}
-
-void TestController::platformCreateWebView(WKPageConfigurationRef, const ViewOptions& options)
-{
-    m_mainWebView = std::make_unique<PlatformWebView>(globalWebViewConfiguration, options);
-}
-
-PlatformWebView* TestController::platformCreateOtherPage(PlatformWebView* parentView, WKPageConfigurationRef, const ViewOptions& options)
-{
-    WKWebViewConfiguration *newConfiguration = [[globalWebViewConfiguration copy] autorelease];
-    newConfiguration._relatedWebView = static_cast<WKWebView*>(parentView->platformView());
-    return new PlatformWebView(newConfiguration, options);
-}
-
-WKContextRef TestController::platformAdjustContext(WKContextRef context, WKContextConfigurationRef contextConfiguration)
-{
-    initializeWebViewConfiguration(libraryPathForTesting(), injectedBundlePath(), context, contextConfiguration);
-    return (WKContextRef)globalWebViewConfiguration.processPool;
-}
-
-void TestController::platformRunUntil(bool& done, double timeout)
-{
-    NSDate *endDate = (timeout > 0) ? [NSDate dateWithTimeIntervalSinceNow:timeout] : [NSDate distantFuture];
-
-    while (!done && [endDate compare:[NSDate date]] == NSOrderedDescending)
-        [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate];
-}
-
-void TestController::platformResetStateToConsistentValues()
-{
-#if WK_API_ENABLED
-    __block bool doneRemoving = false;
-    [[_WKUserContentExtensionStore defaultStore] removeContentExtensionForIdentifier:@"TestContentExtensions" completionHandler:^(NSError *error) {
-        doneRemoving = true;
-    }];
-    platformRunUntil(doneRemoving, 0);
-    [[_WKUserContentExtensionStore defaultStore] _removeAllContentExtensions];
-#endif
-
-    if (PlatformWebView* webView = mainWebView())
-        [webView->platformView().configuration.userContentController _removeAllUserContentFilters];
-}
-
-void TestController::platformWillRunTest(const TestInvocation& testInvocation)
-{
-    setCrashReportApplicationSpecificInformationToURL(testInvocation.url());
-}
-
-} // namespace WTR
index 693ea75..91c618a 100644 (file)
@@ -64,6 +64,10 @@ void TestController::platformDestroy()
 {
 }
 
+void TestController::platformWillRunTest(const TestInvocation&)
+{
+}
+
 void TestController::platformRunUntil(bool& condition, double timeout)
 {
     if (timeout <= 0) {
index aaf7801..665530e 100644 (file)
@@ -52,6 +52,10 @@ void TestController::platformDestroy()
 {
 }
 
+void TestController::platformWillRunTest(const TestInvocation&)
+{
+}
+
 void TestController::platformRunUntil(bool&, double timeout)
 {
     if (timeout > 0) {
index 32d3dec..608f9f4 100644 (file)
 #include "TestController.h"
 
 #import <WebKit/WKImageCG.h>
+#import <WebKit/WKViewPrivate.h>
 #import <WebKit/WKPreferencesPrivate.h>
-#import <WebKit/WKWebViewConfiguration.h>
-#import <WebKit/WKWebViewPrivate.h>
 #import <wtf/RetainPtr.h>
 
-@interface WKWebView (Details)
-- (WKPageRef)_pageForTesting;
-@end
-
 @interface WebKitTestRunnerWindow : UIWindow {
     WTR::PlatformWebView* _platformWebView;
     CGPoint _fakeOrigin;
 @property (nonatomic, assign) WTR::PlatformWebView* platformWebView;
 @end
 
+@interface TestRunnerWKView : WKView {
+    BOOL _useTiledDrawing;
+}
+
+@property (nonatomic, assign) BOOL useTiledDrawing;
+@end
+
+@implementation TestRunnerWKView
+
+@synthesize useTiledDrawing = _useTiledDrawing;
+
+- (id)initWithFrame:(CGRect)frame configurationRef:(WKPageConfigurationRef)configuration useTiledDrawing:(BOOL)useTiledDrawing
+{
+    if (!(self = [super initWithFrame:frame configurationRef:configuration]))
+        return nil;
+
+    _useTiledDrawing = useTiledDrawing;
+    return self;
+}
+
+- (BOOL)_shouldUseTiledDrawingArea
+{
+    return _useTiledDrawing;
+}
+
+@end
+
 @implementation WebKitTestRunnerWindow
 @synthesize platformWebView = _platformWebView;
 
 
 namespace WTR {
 
-PlatformWebView::PlatformWebView(WKWebViewConfiguration* configuration, const ViewOptions& options)
+PlatformWebView::PlatformWebView(WKPageConfigurationRef configuration, const ViewOptions& options)
     : m_windowIsKey(true)
     , m_options(options)
 {
     CGRect rect = CGRectMake(0, 0, TestController::viewWidth, TestController::viewHeight);
-    m_view = [[WKWebView alloc] initWithFrame:rect configuration:configuration];
+    m_view = [[TestRunnerWKView alloc] initWithFrame:rect configurationRef:configuration useTiledDrawing:m_options.useTiledDrawing];
+
+    WKPageGroupRef pageGroupRef = WKPageConfigurationGetPageGroup(configuration);
+
+    WKPreferencesSetCompositingBordersVisible(WKPageGroupGetPreferences(pageGroupRef), YES);
+    WKPreferencesSetCompositingRepaintCountersVisible(WKPageGroupGetPreferences(pageGroupRef), YES);
 
     CGRect windowRect = rect;
     m_window = [[WebKitTestRunnerWindow alloc] initWithFrame:windowRect];
@@ -126,18 +153,19 @@ void PlatformWebView::resizeTo(unsigned width, unsigned height)
 PlatformWebView::~PlatformWebView()
 {
     m_window.platformWebView = 0;
+//    [m_window close];
     [m_view release];
     [m_window release];
 }
 
 WKPageRef PlatformWebView::page()
 {
-    return [m_view _pageForTesting];
+    return [m_view pageRef];
 }
 
 void PlatformWebView::focus()
 {
-    makeWebViewFirstResponder();
+//    [m_window makeFirstResponder:m_view]; // FIXME: iOS equivalent?
     setWindowIsKey(true);
 }
 
@@ -156,7 +184,7 @@ WKRect PlatformWebView::windowFrame()
 void PlatformWebView::setWindowFrame(WKRect frame)
 {
     [m_window setFrame:CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height)];
-    [platformView() setFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
+    [m_view setFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
 }
 
 void PlatformWebView::didInitializeClients()
@@ -187,8 +215,7 @@ void PlatformWebView::removeChromeInputField()
 
 void PlatformWebView::makeWebViewFirstResponder()
 {
-    // FIXME: iOS equivalent?
-    // [m_window makeFirstResponder:m_view];
+//    [m_window makeFirstResponder:m_view];
 }
 
 void PlatformWebView::changeWindowScaleIfNeeded(float)
@@ -198,12 +225,14 @@ void PlatformWebView::changeWindowScaleIfNeeded(float)
 
 WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
 {
-    // FIXME: Need an implementation of this, or we're depending on software paints!
-    return nullptr;
+    return 0; // FIXME for iOS?
 }
 
 bool PlatformWebView::viewSupportsOptions(const ViewOptions& options) const
 {
+    if (m_options.useTiledDrawing != options.useTiledDrawing)
+        return false;
+
     return true;
 }
 
index 6453d42..2ac384c 100644 (file)
 #import "config.h"
 #import "TestController.h"
 
+#import "CrashReporterInfo.h"
+#import <Foundation/Foundation.h>
 #import "PlatformWebView.h"
 #import "TestInvocation.h"
-#import <Foundation/Foundation.h>
 #import <WebKit/WKPreferencesRefPrivate.h>
-#import <WebKit/WKProcessPoolPrivate.h>
 #import <WebKit/WKStringCF.h>
-#import <WebKit/WKUserContentControllerPrivate.h>
-#import <WebKit/WKWebView.h>
-#import <WebKit/WKWebViewConfiguration.h>
-#import <WebKit/WKWebViewConfigurationPrivate.h>
 #import <wtf/MainThread.h>
 
 namespace WTR {
@@ -74,6 +70,11 @@ void TestController::initializeTestPluginDirectory()
     m_testPluginDirectory.adopt(WKStringCreateWithCFString((CFStringRef)[[NSBundle mainBundle] bundlePath]));
 }
 
+void TestController::platformWillRunTest(const TestInvocation& testInvocation)
+{
+    setCrashReportApplicationSpecificInformationToURL(testInvocation.url());
+}
+
 static bool shouldMakeViewportFlexible(const TestInvocation& test)
 {
     return test.urlContains("viewport/");
@@ -81,7 +82,7 @@ static bool shouldMakeViewportFlexible(const TestInvocation& test)
 
 void TestController::platformResetPreferencesToConsistentValues()
 {
-    WKPreferencesRef preferences = platformPreferences();
+    WKPreferencesRef preferences = WKPageGroupGetPreferences(m_pageGroup.get());
     // Note that WKPreferencesSetTextAutosizingEnabled has no effect on iOS.
     WKPreferencesSetMinimumZoomFontSize(preferences, 0);
 }
@@ -101,6 +102,14 @@ void TestController::updatePlatformSpecificViewOptionsForTest(ViewOptions&, cons
 {
 }
 
+void TestController::platformRunUntil(bool& done, double timeout)
+{
+    NSDate *endDate = (timeout > 0) ? [NSDate dateWithTimeIntervalSinceNow:timeout] : [NSDate distantFuture];
+
+    while (!done && [endDate compare:[NSDate date]] == NSOrderedDescending)
+        [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate];
+}
+
 void TestController::platformInitializeContext()
 {
 }
index 6b1b77b..ab0df84 100644 (file)
@@ -33,7 +33,6 @@
 #import <Carbon/Carbon.h>
 #import <WebKit/WKString.h>
 #import <WebKit/WKPagePrivate.h>
-#import <WebKit/WKWebView.h>
 #import <wtf/RetainPtr.h>
 
 @interface NSApplication (Details)
@@ -269,17 +268,7 @@ void EventSenderProxy::mouseUp(unsigned buttonNumber, WKEventModifiers modifiers
     // FIXME: Silly hack to teach WKTR to respect capturing mouse events outside the WKView.
     // The right solution is just to use NSApplication's built-in event sending methods, 
     // instead of rolling our own algorithm for selecting an event target.
-    // FIXME: This is even worse now, because we need to hit the WKWebView's inner WKView
-    // when using the modern API, so the level of fakery and horror increases.
-    if (!targetView) {
-        targetView = m_testController->mainWebView()->platformView();
-        for (NSView *wkWebViewChild in targetView.subviews) {
-            if ([wkWebViewChild isKindOfClass:[WKView class]]) {
-                targetView = wkWebViewChild;
-                break;
-            }
-        }
-    }
+    targetView = targetView ? targetView : m_testController->mainWebView()->platformView();
     ASSERT(targetView);
     [NSApp _setCurrentEvent:event];
     [targetView mouseUp:event];
@@ -412,27 +401,28 @@ void EventSenderProxy::mouseForceChanged(float)
 void EventSenderProxy::mouseMoveTo(double x, double y)
 {
     NSView *view = m_testController->mainWebView()->platformView();
-    NSPoint position = [view convertPoint:NSMakePoint(x, view.frame.size.height - y) toView:nil];
+    NSPoint position = [view convertPoint:NSMakePoint(x, y) toView:nil];
     m_position.x = position.x;
     m_position.y = position.y;
     NSEvent *event = [NSEvent mouseEventWithType:(m_leftMouseButtonDown ? NSLeftMouseDragged : NSMouseMoved)
                                         location:position
                                    modifierFlags:0 
                                        timestamp:absoluteTimeForEventTime(currentEventTime())
-                                    windowNumber:view.window.windowNumber
+                                    windowNumber:[[view window] windowNumber] 
                                          context:[NSGraphicsContext currentContext] 
                                      eventNumber:++eventNumber 
                                       clickCount:(m_leftMouseButtonDown ? m_clickCount : 0) 
-                                        pressure:0];
+                                        pressure:0.0];
 
-    NSPoint windowLocation = event.locationInWindow;
-    NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:windowLocation];
+    NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:[event locationInWindow]];
     if (targetView) {
         [NSApp _setCurrentEvent:event];
         [targetView mouseMoved:event];
         [NSApp _setCurrentEvent:nil];
-    } else
+    } else {
+        NSPoint windowLocation = [event locationInWindow];
         WTFLogAlways("mouseMoveTo failed to find a target view at %f,%f\n", windowLocation.x, windowLocation.y);
+    }
 }
 
 void EventSenderProxy::leapForward(int milliseconds)
index 178a449..5815be9 100644 (file)
 #import "WebKitTestRunnerDraggingInfo.h"
 #import <WebKit/WKImageCG.h>
 #import <WebKit/WKPreferencesPrivate.h>
-#import <WebKit/WKWebViewConfiguration.h>
-#import <WebKit/WKWebViewPrivate.h>
+#import <WebKit/WKViewPrivate.h>
 #import <wtf/RetainPtr.h>
 
-@interface WKWebView (Details)
-- (WKPageRef)_pageForTesting;
-@end
-
 using namespace WTR;
 
 enum {
@@ -51,10 +46,25 @@ enum {
 @property (nonatomic, assign) PlatformWebView* platformWebView;
 @end
 
-@interface TestRunnerWKWebView : WKWebView
+@interface TestRunnerWKView : WKView {
+    BOOL _useThreadedScrolling;
+}
+
+@property (nonatomic, assign) BOOL useThreadedScrolling;
 @end
 
-@implementation TestRunnerWKWebView
+@implementation TestRunnerWKView
+
+@synthesize useThreadedScrolling = _useThreadedScrolling;
+
+- (id)initWithFrame:(NSRect)frame configurationRef:(WKPageConfigurationRef)configuration useThreadedScrolling:(BOOL)useThreadedScrolling
+{
+    if (!(self = [super initWithFrame:frame configurationRef:configuration]))
+        return nil;
+
+    _useThreadedScrolling = useThreadedScrolling;
+    return self;
+}
 
 - (void)dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag
 {
@@ -110,20 +120,23 @@ enum {
 
 namespace WTR {
 
-PlatformWebView::PlatformWebView(WKWebViewConfiguration* configuration, const ViewOptions& options)
+PlatformWebView::PlatformWebView(WKPageConfigurationRef configuration, const ViewOptions& options)
     : m_windowIsKey(true)
     , m_options(options)
 {
+    WKPageGroupRef pageGroupRef = WKPageConfigurationGetPageGroup(configuration);
+
+    // The tiled drawing specific tests also depend on threaded scrolling.
+    WKPreferencesRef preferences = WKPageGroupGetPreferences(pageGroupRef);
+    WKPreferencesSetThreadedScrollingEnabled(preferences, m_options.useThreadedScrolling);
+
     // FIXME: Not sure this is the best place for this; maybe we should have API to set this so we can do it from TestController?
     if (m_options.useRemoteLayerTree)
         [[NSUserDefaults standardUserDefaults] setValue:@YES forKey:@"WebKit2UseRemoteLayerTreeDrawingArea"];
 
-    RetainPtr<WKWebViewConfiguration> copiedConfiguration = adoptNS([configuration copy]);
-    WKPreferencesSetThreadedScrollingEnabled((WKPreferencesRef)[copiedConfiguration preferences], m_options.useThreadedScrolling);
-
     NSRect rect = NSMakeRect(0, 0, TestController::viewWidth, TestController::viewHeight);
-    m_view = [[TestRunnerWKWebView alloc] initWithFrame:rect configuration:copiedConfiguration.get()];
-    [m_view _setWindowOcclusionDetectionEnabled:NO];
+    m_view = [[TestRunnerWKView alloc] initWithFrame:rect configurationRef:configuration useThreadedScrolling:options.useThreadedScrolling];
+    [m_view setWindowOcclusionDetectionEnabled:NO];
 
     NSScreen *firstScreen = [[NSScreen screens] objectAtIndex:0];
     NSRect windowRect = m_options.shouldShowWebView ? NSOffsetRect(rect, 100, 100) : NSOffsetRect(rect, -10000, [firstScreen frame].size.height - rect.size.height + 10000);
@@ -157,12 +170,12 @@ PlatformWebView::~PlatformWebView()
 
 WKPageRef PlatformWebView::page()
 {
-    return [m_view _pageForTesting];
+    return [m_view pageRef];
 }
 
 void PlatformWebView::focus()
 {
-    [m_window makeFirstResponder:platformView()];
+    [m_window makeFirstResponder:m_view];
     setWindowIsKey(true);
 }
 
@@ -181,7 +194,7 @@ WKRect PlatformWebView::windowFrame()
 void PlatformWebView::setWindowFrame(WKRect frame)
 {
     [m_window setFrame:NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height) display:YES];
-    [platformView() setFrame:NSMakeRect(0, 0, frame.size.width, frame.size.height)];
+    [m_view setFrame:NSMakeRect(0, 0, frame.size.width, frame.size.height)];
 }
 
 void PlatformWebView::didInitializeClients()
@@ -192,19 +205,18 @@ void PlatformWebView::didInitializeClients()
 
 void PlatformWebView::addChromeInputField()
 {
-    NSTextField *textField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 100, 20)];
+    NSTextFieldtextField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 100, 20)];
     textField.tag = 1;
     [[m_window contentView] addSubview:textField];
     [textField release];
 
-    NSView *view = platformView();
-    [textField setNextKeyView:view];
-    [view setNextKeyView:textField];
+    [textField setNextKeyView:m_view];
+    [m_view setNextKeyView:textField];
 }
 
 void PlatformWebView::removeChromeInputField()
 {
-    NSView *textField = [[m_window contentView] viewWithTag:1];
+    NSViewtextField = [[m_window contentView] viewWithTag:1];
     if (textField) {
         [textField removeFromSuperview];
         makeWebViewFirstResponder();
@@ -213,12 +225,12 @@ void PlatformWebView::removeChromeInputField()
 
 void PlatformWebView::makeWebViewFirstResponder()
 {
-    [m_window makeFirstResponder:platformView()];
+    [m_window makeFirstResponder:m_view];
 }
 
 WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
 {
-    [platformView() display];
+    [m_view display];
     CGWindowImageOption options = kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque;
 
     if ([m_window backingScaleFactor] == 1)
index 71aaa6e..556a77c 100644 (file)
 #import "config.h"
 #import "TestController.h"
 
+#import "CrashReporterInfo.h"
 #import "PlatformWebView.h"
 #import "PoseAsClass.h"
 #import "TestInvocation.h"
 #import "WebKitTestRunnerPasteboard.h"
 #import <WebKit/WKContextPrivate.h>
 #import <WebKit/WKPageGroup.h>
-#import <WebKit/WKProcessPoolPrivate.h>
 #import <WebKit/WKStringCF.h>
 #import <WebKit/WKURLCF.h>
-#import <WebKit/WKUserContentControllerPrivate.h>
-#import <WebKit/WKWebView.h>
-#import <WebKit/WKWebViewConfiguration.h>
-#import <WebKit/WKWebViewConfigurationPrivate.h>
 #import <WebKit/_WKUserContentExtensionStore.h>
 #import <WebKit/_WKUserContentExtensionStorePrivate.h>
 #import <mach-o/dyld.h>
@@ -77,6 +73,11 @@ void TestController::initializeTestPluginDirectory()
     m_testPluginDirectory.adopt(WKStringCreateWithCFString((CFStringRef)[[NSBundle mainBundle] bundlePath]));
 }
 
+void TestController::platformWillRunTest(const TestInvocation& testInvocation)
+{
+    setCrashReportApplicationSpecificInformationToURL(testInvocation.url());
+}
+
 static bool shouldUseThreadedScrolling(const TestInvocation& test)
 {
     return test.urlContains("tiled-drawing/");
@@ -84,6 +85,15 @@ static bool shouldUseThreadedScrolling(const TestInvocation& test)
 
 void TestController::platformResetPreferencesToConsistentValues()
 {
+#if WK_API_ENABLED
+    __block bool doneRemoving = false;
+    [[_WKUserContentExtensionStore defaultStore] removeContentExtensionForIdentifier:@"TestContentExtensions" completionHandler:^(NSError *error)
+    {
+        doneRemoving = true;
+    }];
+    platformRunUntil(doneRemoving, 0);
+    [[_WKUserContentExtensionStore defaultStore] _removeAllContentExtensions];
+#endif
 }
 
 void TestController::updatePlatformSpecificViewOptionsForTest(ViewOptions& viewOptions, const TestInvocation& test) const
@@ -111,7 +121,7 @@ void TestController::platformConfigureViewForTest(const TestInvocation& test)
     [[_WKUserContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestContentExtensions" encodedContentExtension:contentExtensionString completionHandler:^(_WKUserContentFilter *filter, NSError *error)
     {
         if (!error)
-            [mainWebView()->platformView().configuration.userContentController _addUserContentFilter:filter];
+            WKPageGroupAddUserContentFilter(WKPageGetPageGroup(TestController::singleton().mainWebView()->page()), (__bridge WKUserContentFilterRef)filter);
         else
             NSLog(@"%@", [error helpAnchor]);
         doneCompiling = true;
@@ -120,6 +130,14 @@ void TestController::platformConfigureViewForTest(const TestInvocation& test)
 #endif
 }
 
+void TestController::platformRunUntil(bool& done, double timeout)
+{
+    NSDate *endDate = (timeout > 0) ? [NSDate dateWithTimeIntervalSinceNow:timeout] : [NSDate distantFuture];
+
+    while (!done && [endDate compare:[NSDate date]] == NSOrderedDescending)
+        [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate];
+}
+
 #if ENABLE(PLATFORM_FONT_LOOKUP)
 static NSSet *allowedFontFamilySet()
 {