Changeset 188828 in webkit
- Timestamp:
- Aug 22, 2015 3:20:46 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r188826 r188828 1 2015-08-22 Timothy Horton <timothy_horton@apple.com> 2 3 WebKitTestRunner should use WKWebView on OS X and iOS 4 https://bugs.webkit.org/show_bug.cgi?id=143743 5 <rdar://problem/16947123> 6 7 Reviewed by Anders Carlsson. 8 Patch by Enrica Casucci and myself. 9 10 * UIProcess/API/Cocoa/WKWebView.mm: 11 (-[WKWebView _windowOcclusionDetectionEnabled]): 12 (-[WKWebView _setWindowOcclusionDetectionEnabled:]): 13 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 14 Add SPI to disable window occlusion detection, for WebKitTestRunner's use. 15 16 * Shared/WebPreferencesDefinitions.h: 17 Remove a completely unused WebPreference. It is a WebCore Setting, 18 but in the API it's exposed as a WKPage setter and WKView and WKWebView property 19 instead of as a WKPreference, so there's no need for the WebPreference. 20 21 * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: 22 (WKBundlePageAddUserScript): 23 (WKBundlePageAddUserStyleSheet): 24 (WKBundlePageRemoveAllUserContent): 25 * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: 26 * WebProcess/WebPage/WebPage.cpp: 27 (WebKit::WebPage::addUserScript): 28 (WebKit::WebPage::addUserStyleSheet): 29 (WebKit::WebPage::removeAllUserContent): 30 * WebProcess/WebPage/WebPage.h: 31 Add WKBundlePage functions for user script and style sheet manipulation. 32 These use the WebPage's WebUserContentController instead of the WebPageGroupProxy's 33 (used by the WKBundle functions), so they work correctly with the modern API. 34 1 35 2015-08-22 Michael Catanzaro <mcatanzaro@igalia.com> 2 36 -
trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h
r188817 r188828 181 181 macro(SimpleLineLayoutEnabled, simpleLineLayoutEnabled, Bool, bool, true) \ 182 182 macro(SubpixelCSSOMElementMetricsEnabled, subpixelCSSOMElementMetricsEnabled, Bool, bool, false) \ 183 macro(BackgroundShouldExtendBeyondPage, backgroundShouldExtendBeyondPage, Bool, bool, false) \184 183 macro(MediaStreamEnabled, mediaStreamEnabled, Bool, bool, false) \ 185 184 macro(UseLegacyTextAlignPositionedElementBehavior, useLegacyTextAlignPositionedElementBehavior, Bool, bool, false) \ -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r188817 r188828 3084 3084 } 3085 3085 3086 - (BOOL)_windowOcclusionDetectionEnabled 3087 { 3088 return [_wkView windowOcclusionDetectionEnabled]; 3089 } 3090 3091 - (void)_setWindowOcclusionDetectionEnabled:(BOOL)flag 3092 { 3093 [_wkView setWindowOcclusionDetectionEnabled:flag]; 3094 } 3095 3086 3096 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 3087 3097 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
r188817 r188828 174 174 // 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. 175 175 @property (nonatomic, setter=_setOverrideDeviceScaleFactor:) CGFloat _overrideDeviceScaleFactor WK_AVAILABLE(WK_MAC_TBA, NA); 176 177 @property (nonatomic, setter=_setWindowOcclusionDetectionEnabled:) BOOL _windowOcclusionDetectionEnabled; 178 176 179 #endif 177 180 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
r188817 r188828 616 616 *returnDataRef = toAPI(returnData.release().leakRef()); 617 617 } 618 619 void WKBundlePageAddUserScript(WKBundlePageRef pageRef, WKStringRef source, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames) 620 { 621 toImpl(pageRef)->addUserScript(toWTFString(source), toUserContentInjectedFrames(injectedFrames), toUserScriptInjectionTime(injectionTime)); 622 } 623 624 void WKBundlePageAddUserStyleSheet(WKBundlePageRef pageRef, WKStringRef source, WKUserContentInjectedFrames injectedFrames) 625 { 626 toImpl(pageRef)->addUserStyleSheet(toWTFString(source), toUserContentInjectedFrames(injectedFrames)); 627 } 628 629 void WKBundlePageRemoveAllUserContent(WKBundlePageRef pageRef) 630 { 631 toImpl(pageRef)->removeAllUserContent(); 632 } -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h
r188817 r188828 30 30 #include <WebKit/WKEvent.h> 31 31 #include <WebKit/WKGeometry.h> 32 #include <WebKit/WKUserContentInjectedFrames.h> 33 #include <WebKit/WKUserScriptInjectionTime.h> 32 34 33 35 #ifdef __cplusplus … … 94 96 WK_EXPORT void WKBundlePageStopExtendingIncrementalRenderingSuppression(WKBundlePageRef, WKRenderingSuppressionToken); 95 97 98 // UserContent API (compatible with Modern API, for WKTR) 99 WK_EXPORT void WKBundlePageAddUserScript(WKBundlePageRef page, WKStringRef source, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames); 100 WK_EXPORT void WKBundlePageAddUserStyleSheet(WKBundlePageRef page, WKStringRef source, WKUserContentInjectedFrames injectedFrames); 101 WK_EXPORT void WKBundlePageRemoveAllUserContent(WKBundlePageRef page); 102 96 103 #if TARGET_OS_IPHONE 97 104 WK_EXPORT void WKBundlePageSetUseTestingViewportConfiguration(WKBundlePageRef, bool); -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r188817 r188828 5007 5007 } 5008 5008 5009 void WebPage::addUserScript(const String& source, WebCore::UserContentInjectedFrames injectedFrames, WebCore::UserScriptInjectionTime injectionTime) 5010 { 5011 ASSERT(m_userContentController); 5012 5013 WebCore::UserScript userScript(source, WebCore::blankURL(), Vector<String>(), Vector<String>(), injectionTime, injectedFrames); 5014 5015 m_userContentController->userContentController().addUserScript(mainThreadNormalWorld(), std::make_unique<WebCore::UserScript>(userScript)); 5016 } 5017 5018 void WebPage::addUserStyleSheet(const String& source, WebCore::UserContentInjectedFrames injectedFrames) 5019 { 5020 ASSERT(m_userContentController); 5021 5022 WebCore::UserStyleSheet userStyleSheet(source, WebCore::blankURL(), Vector<String>(), Vector<String>(), injectedFrames, UserStyleUserLevel); 5023 5024 m_userContentController->userContentController().addUserStyleSheet(mainThreadNormalWorld(), std::make_unique<WebCore::UserStyleSheet>(userStyleSheet), InjectInExistingDocuments); 5025 } 5026 5027 void WebPage::removeAllUserContent() 5028 { 5029 if (!m_userContentController) 5030 return; 5031 5032 m_userContentController->userContentController().removeAllUserContent(); 5033 } 5034 5009 5035 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r188817 r188828 64 64 #include <WebCore/TextIndicator.h> 65 65 #include <WebCore/UserActivity.h> 66 #include <WebCore/UserContentTypes.h> 67 #include <WebCore/UserScriptTypes.h> 66 68 #include <WebCore/ViewState.h> 67 69 #include <WebCore/ViewportConfiguration.h> … … 915 917 #endif 916 918 919 void addUserScript(const String& source, WebCore::UserContentInjectedFrames, WebCore::UserScriptInjectionTime); 920 void addUserStyleSheet(const String& source, WebCore::UserContentInjectedFrames); 921 void removeAllUserContent(); 922 917 923 private: 918 924 WebPage(uint64_t pageID, const WebPageCreationParameters&); -
trunk/Tools/ChangeLog
r188826 r188828 1 2015-08-22 Timothy Horton <timothy_horton@apple.com> 2 3 WebKitTestRunner should use WKWebView on OS X and iOS 4 https://bugs.webkit.org/show_bug.cgi?id=143743 5 <rdar://problem/16947123> 6 7 Reviewed by Anders Carlsson. 8 Patch by Enrica Casucci and myself. 9 10 * WebKitTestRunner/PlatformWebView.h: 11 (WTR::PlatformWebView::windowSnapshotEnabled): Deleted. 12 Add a PlatformWebView constructor that takes a WKWebViewConfiguration 13 instead of WKContext and WKPageGroup. 14 15 Remove the unused, always-true windowSnapshotEnabled(). 16 While technically some platforms don't have window snapshotting, 17 they just return null instead of implementing windowSnapshotEnabled(). 18 19 * WebKitTestRunner/TestController.h: 20 * WebKitTestRunner/TestController.cpp: 21 (WTR::TestController::createOtherPage): 22 (WTR::TestController::initialize): 23 (WTR::TestController::createWebViewWithOptions): 24 Delegate to the various platforms for creating PlatformWebView instances, 25 for creating WKContexts, and for accessing WKPreferences, 26 so that they can do special things (like, use WKWebView instead!). 27 28 (WTR::TestController::resetPreferencesToConsistentValues): 29 Make explicit WebKitTestRunner's desired default for two preferences 30 which have differing defaults between the antique and modern API, 31 for consistency's sake. 32 33 (WTR::TestController::resetStateToConsistentValues): 34 Add platformResetStateToConsistentValues. 35 36 * WebKitTestRunner/TestInvocation.cpp: 37 (WTR::TestInvocation::dumpResults): 38 Adjust to the aforementioned removal of windowSnapshotEnabled(). 39 40 * WebKitTestRunner/ios/TestControllerCocoa.mm: 41 (WTR::TestController::platformResetStateToConsistentValues): 42 (WTR::TestController::platformPreferences): 43 (WTR::TestController::platformCreateWebView): 44 (WTR::TestController::platformCreateOtherPage): 45 (WTR::TestController::platformInitializeConfiguration): 46 Implement the new platform functions for the Modern WebKit2 API, 47 in a new TestControllerCocoa file that is shared between iOS and Mac. 48 49 For platformMaybeCreateContext, use the trick that we know we can cast 50 the WKProcessPool to a WKContextRef to retrieve a WKContextRef from 51 WKWebView's configuration. 52 53 Ditto for WKPreferencesRef and WKPreferences. 54 55 Remove user content filters on the WKWebView's userContentController. 56 57 * WebKitTestRunner/mac/TestControllerMac.mm: 58 * WebKitTestRunner/ios/TestControllerIOS.mm: 59 Move code into TestControllerCocoa. 60 61 * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: 62 (WTR::InjectedBundle::beginTesting): 63 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 64 (WTR::TestRunner::addUserScript): 65 (WTR::TestRunner::addUserStyleSheet): 66 Adopt WKBundlePage API for user scripts/sheets. 67 68 * WebKitTestRunner/ios/PlatformWebViewIOS.mm: 69 * WebKitTestRunner/mac/PlatformWebViewMac.mm: 70 Make and keep a WKWebView instead of a WKView. 71 72 * WebKitTestRunner/mac/EventSenderProxy.mm: 73 (WTR::EventSenderProxy::mouseUp): 74 (WTR::EventSenderProxy::mouseMoveTo): 75 Reach inside the WKWebView to the WKView when dispatching events. 76 This is fairly ugly and we should come up with a better solution. 77 Also, fix some flipping and style errors. 78 1 79 2015-08-22 Michael Catanzaro <mcatanzaro@igalia.com> 2 80 -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
r188817 r188828 262 262 WKBundleSetPopupBlockingEnabled(m_bundle, m_pageGroup, false); 263 263 264 WKBundle RemoveAllUserContent(m_bundle, m_pageGroup);264 WKBundlePageRemoveAllUserContent(page()->page()); 265 265 266 266 m_testRunner->setShouldDumpFrameLoadCallbacks(booleanForKey(settings, "DumpFrameLoadDelegates")); -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r188817 r188828 173 173 { 174 174 WKRetainPtr<WKStringRef> sourceWK = toWK(source); 175 WKRetainPtr<WKBundleScriptWorldRef> scriptWorld(AdoptWK, WKBundleScriptWorldCreateWorld()); 176 177 auto& injectedBundle = InjectedBundle::singleton(); 178 WKBundleAddUserScript(injectedBundle.bundle(), injectedBundle.pageGroup(), scriptWorld.get(), sourceWK.get(), 0, 0, 0, 175 176 WKBundlePageAddUserScript(InjectedBundle::singleton().page()->page(), sourceWK.get(), 179 177 (runAtStart ? kWKInjectAtDocumentStart : kWKInjectAtDocumentEnd), 180 178 (allFrames ? kWKInjectInAllFrames : kWKInjectInTopFrameOnly)); … … 184 182 { 185 183 WKRetainPtr<WKStringRef> sourceWK = toWK(source); 186 WKRetainPtr<WKBundleScriptWorldRef> scriptWorld(AdoptWK, WKBundleScriptWorldCreateWorld()); 187 188 auto& injectedBundle = InjectedBundle::singleton(); 189 WKBundleAddUserStyleSheet(injectedBundle.bundle(), injectedBundle.pageGroup(), scriptWorld.get(), sourceWK.get(), 0, 0, 0, 184 185 WKBundlePageAddUserStyleSheet(InjectedBundle::singleton().page()->page(), sourceWK.get(), 190 186 (allFrames ? kWKInjectInAllFrames : kWKInjectInTopFrameOnly)); 191 187 } -
trunk/Tools/WebKitTestRunner/PlatformWebView.h
r188817 r188828 28 28 29 29 #include "ViewOptions.h" 30 #include <WebKit/WKFoundation.h> 30 31 #include <WebKit/WKRetainPtr.h> 31 32 32 #if defined(__APPLE__) && __APPLE__ 33 #ifdef __OBJC__ 34 @class WKView; 35 @class WebKitTestRunnerWindow; 33 #if PLATFORM(COCOA) 34 OBJC_CLASS NSView; 35 OBJC_CLASS UIView; 36 OBJC_CLASS WKWebView; 37 OBJC_CLASS WKWebViewConfiguration; 38 OBJC_CLASS WebKitTestRunnerWindow; 39 40 #if WK_API_ENABLED 41 typedef WKWebView *PlatformWKView; 36 42 #else 37 class WKView; 38 class WebKitTestRunnerWindow; 43 typedef NSView *PlatformWKView; 39 44 #endif 40 typedef WKView* PlatformWKView; 41 typedef WebKitTestRunnerWindow* PlatformWindow; 45 typedef WebKitTestRunnerWindow *PlatformWindow; 42 46 #elif defined(BUILDING_GTK__) 43 47 typedef struct _GtkWidget GtkWidget; … … 53 57 class PlatformWebView { 54 58 public: 59 #if PLATFORM(COCOA) 60 PlatformWebView(WKWebViewConfiguration*, const ViewOptions&); 61 #else 55 62 PlatformWebView(WKPageConfigurationRef, const ViewOptions&); 63 #endif 56 64 ~PlatformWebView(); 57 65 … … 61 69 void resizeTo(unsigned width, unsigned height); 62 70 void focus(); 63 64 // Window snapshot is always enabled by default on all other platform.65 static bool windowSnapshotEnabled() { return true; }66 71 67 72 WKRect windowFrame(); -
trunk/Tools/WebKitTestRunner/TestController.cpp
r188817 r188828 198 198 } 199 199 200 WKPageRef TestController::createOtherPage(WKPageRef oldP page, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo)200 WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo) 201 201 { 202 202 PlatformWebView* parentView = static_cast<PlatformWebView*>(const_cast<void*>(clientInfo)); 203 203 204 PlatformWebView* view = new PlatformWebView(configuration, parentView->options());204 PlatformWebView* view = platformCreateOtherPage(parentView, configuration, parentView->options()); 205 205 WKPageRef newPage = view->page(); 206 206 … … 311 311 } 312 312 313 314 313 void TestController::initialize(int argc, const char* argv[]) 315 314 { … … 373 372 WKContextConfigurationSetMediaKeysStorageDirectory(configuration.get(), toWK(temporaryFolder + separator + "MediaKeys").get()); 374 373 } 375 376 m_context = adoptWK(WKContextCreateWithConfiguration(configuration.get())); 374 m_context = platformAdjustContext(adoptWK(WKContextCreateWithConfiguration(configuration.get())).get(), configuration.get()); 375 377 376 m_geolocationProvider = std::make_unique<GeolocationProviderMock>(m_context.get()); 378 377 … … 436 435 WKPageConfigurationSetContext(m_configuration.get(), m_context.get()); 437 436 WKPageConfigurationSetPageGroup(m_configuration.get(), m_pageGroup.get()); 437 WKPageConfigurationSetUserContentController(m_configuration.get(), adoptWK(WKUserContentControllerCreate()).get()); 438 438 439 439 // Some preferences (notably mock scroll bars setting) currently cannot be re-applied to an existing view, so we need to set them now. … … 443 443 void TestController::createWebViewWithOptions(const ViewOptions& options) 444 444 { 445 m_mainWebView = std::make_unique<PlatformWebView>(m_configuration.get(), options);445 platformCreateWebView(m_configuration.get(), options); 446 446 WKPageUIClientV6 pageUIClient = { 447 447 { 6, m_mainWebView.get() }, … … 569 569 { 570 570 // Reset preferences 571 WKPreferencesRef preferences = WKPageGroupGetPreferences(m_pageGroup.get());571 WKPreferencesRef preferences = platformPreferences(); 572 572 WKPreferencesResetTestRunnerOverrides(preferences); 573 573 WKPreferencesSetPageVisibilityBasedProcessSuppressionEnabled(preferences, false); … … 623 623 624 624 WKPreferencesSetAcceleratedDrawingEnabled(preferences, m_shouldUseAcceleratedDrawing); 625 // FIXME: We should be testing the default. 626 WKPreferencesSetStorageBlockingPolicy(preferences, kWKAllowAllStorage); 625 627 626 628 WKCookieManagerDeleteAllCookies(WKContextGetCookieManager(m_context.get())); … … 634 636 635 637 m_beforeUnloadReturnValue = true; 638 639 // This setting differs between the antique and modern Mac WebKit2 API. 640 // For now, maintain the antique behavior, because some tests depend on it! 641 // FIXME: We should be testing the default. 642 WKPageSetBackgroundExtendsBeyondPage(m_mainWebView->page(), false); 636 643 637 644 WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("Reset")); … … 669 676 #endif 670 677 671 // in the case that a test using the chrome input field failed, be sure to clean up for the next test678 // In the case that a test using the chrome input field failed, be sure to clean up for the next test. 672 679 m_mainWebView->removeChromeInputField(); 673 680 m_mainWebView->focus(); … … 711 718 m_shouldLogHistoryClientCallbacks = false; 712 719 713 WKPageGroupRemoveAllUserContentFilters(WKPageGetPageGroup(m_mainWebView->page()));714 715 720 setHidden(false); 721 722 platformResetStateToConsistentValues(); 716 723 717 724 // Reset main page back to about:blank … … 1594 1601 } 1595 1602 1603 #if !PLATFORM(COCOA) 1604 void TestController::platformWillRunTest(const TestInvocation&) 1605 { 1606 } 1607 1608 WKPreferencesRef TestController::platformPreferences() 1609 { 1610 WKRetainPtr<WKPageConfigurationRef> configuration = adoptWK(WKPageCopyPageConfiguration(m_mainWebView->page())); 1611 return WKPageConfigurationGetPreferences(configuration.get()); 1612 } 1613 1614 void TestController::platformCreateWebView(WKPageConfigurationRef configuration, const ViewOptions& options) 1615 { 1616 m_mainWebView = std::make_unique<PlatformWebView>(configuration, options); 1617 } 1618 1619 PlatformWebView* TestController::platformCreateOtherPage(PlatformWebView* parentView, WKPageConfigurationRef configuration, const ViewOptions& options) 1620 { 1621 return new PlatformWebView(configuration, options); 1622 } 1623 1624 WKContextRef TestController::platformAdjustContext(WKContextRef context, WKContextConfigurationRef contextConfiguration) 1625 { 1626 return context; 1627 } 1628 1629 void TestController::platformResetStateToConsistentValues() 1630 { 1631 1632 } 1633 #endif 1634 1596 1635 } // namespace WTR -
trunk/Tools/WebKitTestRunner/TestController.h
r188817 r188828 35 35 #include <wtf/Vector.h> 36 36 37 OBJC_CLASS WKWebViewConfiguration; 38 37 39 namespace WTR { 38 40 … … 133 135 void platformInitialize(); 134 136 void platformDestroy(); 137 WKContextRef platformAdjustContext(WKContextRef, WKContextConfigurationRef); 135 138 void platformInitializeContext(); 139 void platformCreateWebView(WKPageConfigurationRef, const ViewOptions&); 140 static PlatformWebView* platformCreateOtherPage(PlatformWebView* parentView, WKPageConfigurationRef, const ViewOptions&); 136 141 void platformResetPreferencesToConsistentValues(); 142 void platformResetStateToConsistentValues(); 137 143 void platformConfigureViewForTest(const TestInvocation&); 138 144 void platformWillRunTest(const TestInvocation&); 139 145 void platformRunUntil(bool& done, double timeout); 140 146 void platformDidCommitLoadForFrame(WKPageRef, WKFrameRef); 147 WKPreferencesRef platformPreferences(); 141 148 void initializeInjectedBundlePath(); 142 149 void initializeTestPluginDirectory(); -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r188817 r188828 269 269 270 270 if (m_dumpPixels && m_pixelResult) { 271 if (PlatformWebView::windowSnapshotEnabled()) { 272 m_gotRepaint = false; 273 WKPageForceRepaint(TestController::singleton().mainWebView()->page(), this, TestInvocation::forceRepaintDoneCallback); 274 TestController::singleton().runUntil(m_gotRepaint, TestController::shortTimeout); 275 if (!m_gotRepaint) { 276 m_errorMessage = "Timed out waiting for pre-pixel dump repaint\n"; 277 m_webProcessIsUnresponsive = true; 278 return; 279 } 271 m_gotRepaint = false; 272 WKPageForceRepaint(TestController::singleton().mainWebView()->page(), this, TestInvocation::forceRepaintDoneCallback); 273 TestController::singleton().runUntil(m_gotRepaint, TestController::shortTimeout); 274 if (!m_gotRepaint) { 275 m_errorMessage = "Timed out waiting for pre-pixel dump repaint\n"; 276 m_webProcessIsUnresponsive = true; 277 return; 280 278 } 281 279 dumpPixelsAndCompareWithExpected(m_pixelResult.get(), m_repaintRects.get()); -
trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
r188817 r188828 41 41 29A8FCE2145F037B009045A6 /* AccessibilityTextMarkerRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29A8FCE1145F037B009045A6 /* AccessibilityTextMarkerRange.cpp */; }; 42 42 29A8FCE5145F0464009045A6 /* AccessibilityTextMarkerRangeMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29A8FCE4145F0464009045A6 /* AccessibilityTextMarkerRangeMac.mm */; }; 43 2DCE2CD31B8452F800C7F832 /* TestControllerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */; }; 44 2DCE2CD41B84530A00C7F832 /* TestControllerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */; }; 43 45 2E34C90018B68808000067BB /* WebKitTestRunnerInjectedBundle.bundle in Resources */ = {isa = PBXBuildFile; fileRef = BC25186211D15D54002EBC01 /* WebKitTestRunnerInjectedBundle.bundle */; }; 44 46 2E63ED8A1891AD7E002A7AFC /* AccessibilityControllerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E63ED751891ACE9002A7AFC /* AccessibilityControllerIOS.mm */; }; … … 172 174 29A8FCE1345E7021006AA5A7 /* JSAccessibilityTextMarkerRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSAccessibilityTextMarkerRange.h; path = DerivedSources/WebKitTestRunner/JSAccessibilityTextMarkerRange.h; sourceTree = BUILT_PRODUCTS_DIR; }; 173 175 29A8FCE4145F0464009045A6 /* AccessibilityTextMarkerRangeMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityTextMarkerRangeMac.mm; sourceTree = "<group>"; }; 176 2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestControllerCocoa.mm; path = cocoa/TestControllerCocoa.mm; sourceTree = "<group>"; }; 174 177 2E63ED751891ACE9002A7AFC /* AccessibilityControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityControllerIOS.mm; sourceTree = "<group>"; }; 175 178 2E63ED761891ACE9002A7AFC /* AccessibilityNotificationHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityNotificationHandler.h; sourceTree = "<group>"; }; … … 398 401 0FEB90A21905BC6A000FDBF3 /* CrashReporterInfo.h */, 399 402 0FEB90A31905BC6A000FDBF3 /* CrashReporterInfo.mm */, 403 2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */, 400 404 ); 401 405 name = cocoa; … … 787 791 2E63ED981891ADC7002A7AFC /* TestController.cpp in Sources */, 788 792 2E63ED921891ADAD002A7AFC /* TestControllerIOS.mm in Sources */, 793 2DCE2CD31B8452F800C7F832 /* TestControllerCocoa.mm in Sources */, 789 794 0FEB90A81905C537000FDBF3 /* CrashReporterInfo.mm in Sources */, 790 795 2E63ED991891ADC7002A7AFC /* TestInvocation.cpp in Sources */, … … 806 811 E132AA3D17CE776F00611DF0 /* WebKitTestRunnerEvent.mm in Sources */, 807 812 5670B8281386FCA5002EB355 /* EventSenderProxy.mm in Sources */, 813 2DCE2CD41B84530A00C7F832 /* TestControllerCocoa.mm in Sources */, 808 814 26D758E7160BECDD00268472 /* GeolocationProviderMock.cpp in Sources */, 809 815 BC793400118F7C84005EA8E2 /* main.mm in Sources */, -
trunk/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp
r188817 r188828 62 62 63 63 void TestController::platformDestroy() 64 {65 }66 67 void TestController::platformWillRunTest(const TestInvocation&)68 64 { 69 65 } -
trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp
r188817 r188828 50 50 51 51 void TestController::platformDestroy() 52 {53 }54 55 void TestController::platformWillRunTest(const TestInvocation&)56 52 { 57 53 } -
trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm
r188817 r188828 29 29 30 30 #import <WebKit/WKImageCG.h> 31 #import <WebKit/WKViewPrivate.h>32 31 #import <WebKit/WKPreferencesPrivate.h> 32 #import <WebKit/WKWebViewConfiguration.h> 33 #import <WebKit/WKWebViewPrivate.h> 33 34 #import <wtf/RetainPtr.h> 35 36 @interface WKWebView (Details) 37 - (WKPageRef)_pageForTesting; 38 @end 34 39 35 40 @interface WebKitTestRunnerWindow : UIWindow { … … 41 46 @end 42 47 43 @interface TestRunnerWKView : WKView {44 BOOL _useTiledDrawing;45 }46 47 @property (nonatomic, assign) BOOL useTiledDrawing;48 @end49 50 @implementation TestRunnerWKView51 52 @synthesize useTiledDrawing = _useTiledDrawing;53 54 - (id)initWithFrame:(CGRect)frame configurationRef:(WKPageConfigurationRef)configuration useTiledDrawing:(BOOL)useTiledDrawing55 {56 if (!(self = [super initWithFrame:frame configurationRef:configuration]))57 return nil;58 59 _useTiledDrawing = useTiledDrawing;60 return self;61 }62 63 - (BOOL)_shouldUseTiledDrawingArea64 {65 return _useTiledDrawing;66 }67 68 @end69 70 48 @implementation WebKitTestRunnerWindow 71 49 @synthesize platformWebView = _platformWebView; … … 123 101 namespace WTR { 124 102 125 PlatformWebView::PlatformWebView(WK PageConfigurationRefconfiguration, const ViewOptions& options)103 PlatformWebView::PlatformWebView(WKWebViewConfiguration* configuration, const ViewOptions& options) 126 104 : m_windowIsKey(true) 127 105 , m_options(options) 128 106 { 129 107 CGRect rect = CGRectMake(0, 0, TestController::viewWidth, TestController::viewHeight); 130 m_view = [[TestRunnerWKView alloc] initWithFrame:rect configurationRef:configuration useTiledDrawing:m_options.useTiledDrawing]; 131 132 WKPageGroupRef pageGroupRef = WKPageConfigurationGetPageGroup(configuration); 133 134 WKPreferencesSetCompositingBordersVisible(WKPageGroupGetPreferences(pageGroupRef), YES); 135 WKPreferencesSetCompositingRepaintCountersVisible(WKPageGroupGetPreferences(pageGroupRef), YES); 108 m_view = [[WKWebView alloc] initWithFrame:rect configuration:configuration]; 136 109 137 110 CGRect windowRect = rect; … … 154 127 { 155 128 m_window.platformWebView = 0; 156 // [m_window close];157 129 [m_view release]; 158 130 [m_window release]; … … 161 133 WKPageRef PlatformWebView::page() 162 134 { 163 return [m_view pageRef];135 return [m_view _pageForTesting]; 164 136 } 165 137 166 138 void PlatformWebView::focus() 167 139 { 168 // [m_window makeFirstResponder:m_view]; // FIXME: iOS equivalent? 140 makeWebViewFirstResponder(); 169 141 setWindowIsKey(true); 170 142 } … … 185 157 { 186 158 [m_window setFrame:CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height)]; 187 [ m_viewsetFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];159 [platformView() setFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)]; 188 160 } 189 161 … … 216 188 void PlatformWebView::makeWebViewFirstResponder() 217 189 { 218 // [m_window makeFirstResponder:m_view]; 190 // FIXME: iOS equivalent? 191 // [m_window makeFirstResponder:m_view]; 219 192 } 220 193 … … 226 199 WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage() 227 200 { 228 return 0; // FIXME for iOS? 201 // FIXME: Need an implementation of this, or we're depending on software paints! 202 return nullptr; 229 203 } 230 204 231 205 bool PlatformWebView::viewSupportsOptions(const ViewOptions& options) const 232 206 { 233 if (m_options.useTiledDrawing != options.useTiledDrawing)234 return false;235 236 207 return true; 237 208 } -
trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm
r188817 r188828 27 27 #import "TestController.h" 28 28 29 #import "CrashReporterInfo.h"30 #import <Foundation/Foundation.h>31 29 #import "PlatformWebView.h" 32 30 #import "TestInvocation.h" 31 #import <Foundation/Foundation.h> 33 32 #import <WebKit/WKPreferencesRefPrivate.h> 33 #import <WebKit/WKProcessPoolPrivate.h> 34 34 #import <WebKit/WKStringCF.h> 35 #import <WebKit/WKUserContentControllerPrivate.h> 36 #import <WebKit/WKWebView.h> 37 #import <WebKit/WKWebViewConfiguration.h> 38 #import <WebKit/WKWebViewConfigurationPrivate.h> 35 39 #import <wtf/MainThread.h> 36 40 … … 71 75 } 72 76 73 void TestController::platformWillRunTest(const TestInvocation& testInvocation)74 {75 setCrashReportApplicationSpecificInformationToURL(testInvocation.url());76 }77 78 77 static bool shouldMakeViewportFlexible(const TestInvocation& test) 79 78 { … … 83 82 void TestController::platformResetPreferencesToConsistentValues() 84 83 { 85 WKPreferencesRef preferences = WKPageGroupGetPreferences(m_pageGroup.get());84 WKPreferencesRef preferences = platformPreferences(); 86 85 // Note that WKPreferencesSetTextAutosizingEnabled has no effect on iOS. 87 86 WKPreferencesSetMinimumZoomFontSize(preferences, 0); … … 101 100 void TestController::updatePlatformSpecificViewOptionsForTest(ViewOptions&, const TestInvocation&) const 102 101 { 103 }104 105 void TestController::platformRunUntil(bool& done, double timeout)106 {107 NSDate *endDate = (timeout > 0) ? [NSDate dateWithTimeIntervalSinceNow:timeout] : [NSDate distantFuture];108 109 while (!done && [endDate compare:[NSDate date]] == NSOrderedDescending)110 [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate];111 102 } 112 103 -
trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm
r188817 r188828 34 34 #import <WebKit/WKString.h> 35 35 #import <WebKit/WKPagePrivate.h> 36 #import <WebKit/WKWebView.h> 36 37 #import <wtf/RetainPtr.h> 37 38 … … 269 270 // The right solution is just to use NSApplication's built-in event sending methods, 270 271 // instead of rolling our own algorithm for selecting an event target. 271 targetView = targetView ? targetView : m_testController->mainWebView()->platformView(); 272 // FIXME: This is even worse now, because we need to hit the WKWebView's inner WKView 273 // when using the modern API, so the level of fakery and horror increases. 274 if (!targetView) { 275 targetView = m_testController->mainWebView()->platformView(); 276 for (NSView *wkWebViewChild in targetView.subviews) { 277 if ([wkWebViewChild isKindOfClass:[WKView class]]) { 278 targetView = wkWebViewChild; 279 break; 280 } 281 } 282 } 272 283 ASSERT(targetView); 273 284 [NSApp _setCurrentEvent:event]; … … 402 413 { 403 414 NSView *view = m_testController->mainWebView()->platformView(); 404 NSPoint position = [view convertPoint:NSMakePoint(x, y) toView:nil];415 NSPoint position = [view convertPoint:NSMakePoint(x, view.frame.size.height - y) toView:nil]; 405 416 m_position.x = position.x; 406 417 m_position.y = position.y; … … 409 420 modifierFlags:0 410 421 timestamp:absoluteTimeForEventTime(currentEventTime()) 411 windowNumber: [[view window] windowNumber]422 windowNumber:view.window.windowNumber 412 423 context:[NSGraphicsContext currentContext] 413 424 eventNumber:++eventNumber 414 425 clickCount:(m_leftMouseButtonDown ? m_clickCount : 0) 415 pressure:0.0]; 416 417 NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:[event locationInWindow]]; 426 pressure:0]; 427 428 NSPoint windowLocation = event.locationInWindow; 429 NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:windowLocation]; 418 430 if (targetView) { 419 431 [NSApp _setCurrentEvent:event]; 420 432 [targetView mouseMoved:event]; 421 433 [NSApp _setCurrentEvent:nil]; 422 } else { 423 NSPoint windowLocation = [event locationInWindow]; 434 } else 424 435 WTFLogAlways("mouseMoveTo failed to find a target view at %f,%f\n", windowLocation.x, windowLocation.y); 425 }426 436 } 427 437 -
trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm
r188817 r188828 31 31 #import <WebKit/WKImageCG.h> 32 32 #import <WebKit/WKPreferencesPrivate.h> 33 #import <WebKit/WKViewPrivate.h> 33 #import <WebKit/WKWebViewConfiguration.h> 34 #import <WebKit/WKWebViewPrivate.h> 34 35 #import <wtf/RetainPtr.h> 36 37 #if WK_API_ENABLED 38 @interface WKWebView (Details) 39 - (WKPageRef)_pageForTesting; 40 @end 41 #endif 35 42 36 43 using namespace WTR; … … 47 54 @end 48 55 49 @interface TestRunnerWKView : WKView { 50 BOOL _useThreadedScrolling; 51 } 52 53 @property (nonatomic, assign) BOOL useThreadedScrolling; 54 @end 55 56 @implementation TestRunnerWKView 57 58 @synthesize useThreadedScrolling = _useThreadedScrolling; 59 60 - (id)initWithFrame:(NSRect)frame configurationRef:(WKPageConfigurationRef)configuration useThreadedScrolling:(BOOL)useThreadedScrolling 61 { 62 if (!(self = [super initWithFrame:frame configurationRef:configuration])) 63 return nil; 64 65 _useThreadedScrolling = useThreadedScrolling; 66 return self; 67 } 56 #if WK_API_ENABLED 57 @interface TestRunnerWKWebView : WKWebView 58 @end 59 60 @implementation TestRunnerWKWebView 68 61 69 62 - (void)dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag … … 74 67 75 68 @end 69 #endif 76 70 77 71 @implementation WebKitTestRunnerWindow … … 121 115 namespace WTR { 122 116 123 PlatformWebView::PlatformWebView(WK PageConfigurationRefconfiguration, const ViewOptions& options)117 PlatformWebView::PlatformWebView(WKWebViewConfiguration* configuration, const ViewOptions& options) 124 118 : m_windowIsKey(true) 125 119 , m_options(options) 126 120 { 127 WKPageGroupRef pageGroupRef = WKPageConfigurationGetPageGroup(configuration); 128 129 // The tiled drawing specific tests also depend on threaded scrolling. 130 WKPreferencesRef preferences = WKPageGroupGetPreferences(pageGroupRef); 131 WKPreferencesSetThreadedScrollingEnabled(preferences, m_options.useThreadedScrolling); 132 121 #if WK_API_ENABLED 133 122 // 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? 134 123 if (m_options.useRemoteLayerTree) 135 124 [[NSUserDefaults standardUserDefaults] setValue:@YES forKey:@"WebKit2UseRemoteLayerTreeDrawingArea"]; 136 125 126 RetainPtr<WKWebViewConfiguration> copiedConfiguration = adoptNS([configuration copy]); 127 WKPreferencesSetThreadedScrollingEnabled((WKPreferencesRef)[copiedConfiguration preferences], m_options.useThreadedScrolling); 128 137 129 NSRect rect = NSMakeRect(0, 0, TestController::viewWidth, TestController::viewHeight); 138 m_view = [[TestRunnerWK View alloc] initWithFrame:rect configurationRef:configuration useThreadedScrolling:options.useThreadedScrolling];139 [m_view setWindowOcclusionDetectionEnabled:NO];130 m_view = [[TestRunnerWKWebView alloc] initWithFrame:rect configuration:copiedConfiguration.get()]; 131 [m_view _setWindowOcclusionDetectionEnabled:NO]; 140 132 141 133 NSScreen *firstScreen = [[NSScreen screens] objectAtIndex:0]; … … 151 143 [m_window orderBack:nil]; 152 144 [m_window setReleasedWhenClosed:NO]; 145 #endif 153 146 } 154 147 … … 171 164 WKPageRef PlatformWebView::page() 172 165 { 173 return [m_view pageRef]; 166 #if WK_API_ENABLED 167 return [m_view _pageForTesting]; 168 #else 169 return nullptr; 170 #endif 174 171 } 175 172 176 173 void PlatformWebView::focus() 177 174 { 178 [m_window makeFirstResponder: m_view];175 [m_window makeFirstResponder:platformView()]; 179 176 setWindowIsKey(true); 180 177 } … … 195 192 { 196 193 [m_window setFrame:NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height) display:YES]; 197 [ m_viewsetFrame:NSMakeRect(0, 0, frame.size.width, frame.size.height)];194 [platformView() setFrame:NSMakeRect(0, 0, frame.size.width, frame.size.height)]; 198 195 } 199 196 … … 206 203 void PlatformWebView::addChromeInputField() 207 204 { 208 NSTextField *textField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 100, 20)];205 NSTextField *textField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 100, 20)]; 209 206 textField.tag = 1; 210 207 [[m_window contentView] addSubview:textField]; 211 208 [textField release]; 212 209 213 [textField setNextKeyView:m_view]; 214 [m_view setNextKeyView:textField]; 210 NSView *view = platformView(); 211 [textField setNextKeyView:view]; 212 [view setNextKeyView:textField]; 215 213 } 216 214 217 215 void PlatformWebView::removeChromeInputField() 218 216 { 219 NSView *textField = [[m_window contentView] viewWithTag:1];217 NSView *textField = [[m_window contentView] viewWithTag:1]; 220 218 if (textField) { 221 219 [textField removeFromSuperview]; … … 226 224 void PlatformWebView::makeWebViewFirstResponder() 227 225 { 228 [m_window makeFirstResponder: m_view];226 [m_window makeFirstResponder:platformView()]; 229 227 } 230 228 231 229 WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage() 232 230 { 233 [ m_viewdisplay];231 [platformView() display]; 234 232 CGWindowImageOption options = kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque; 235 233 -
trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm
r188817 r188828 27 27 #import "TestController.h" 28 28 29 #import "CrashReporterInfo.h"30 29 #import "PlatformWebView.h" 31 30 #import "PoseAsClass.h" … … 34 33 #import <WebKit/WKContextPrivate.h> 35 34 #import <WebKit/WKPageGroup.h> 35 #import <WebKit/WKProcessPoolPrivate.h> 36 36 #import <WebKit/WKStringCF.h> 37 37 #import <WebKit/WKURLCF.h> 38 #import <WebKit/WKUserContentControllerPrivate.h> 39 #import <WebKit/WKWebView.h> 40 #import <WebKit/WKWebViewConfiguration.h> 41 #import <WebKit/WKWebViewConfigurationPrivate.h> 38 42 #import <WebKit/_WKUserContentExtensionStore.h> 39 43 #import <WebKit/_WKUserContentExtensionStorePrivate.h> … … 74 78 } 75 79 76 void TestController::platformWillRunTest(const TestInvocation& testInvocation)77 {78 setCrashReportApplicationSpecificInformationToURL(testInvocation.url());79 }80 81 80 static bool shouldUseThreadedScrolling(const TestInvocation& test) 82 81 { … … 86 85 void TestController::platformResetPreferencesToConsistentValues() 87 86 { 88 #if WK_API_ENABLED89 __block bool doneRemoving = false;90 [[_WKUserContentExtensionStore defaultStore] removeContentExtensionForIdentifier:@"TestContentExtensions" completionHandler:^(NSError *error)91 {92 doneRemoving = true;93 }];94 platformRunUntil(doneRemoving, 0);95 [[_WKUserContentExtensionStore defaultStore] _removeAllContentExtensions];96 #endif97 87 } 98 88 … … 122 112 { 123 113 if (!error) 124 WKPageGroupAddUserContentFilter(WKPageGetPageGroup(TestController::singleton().mainWebView()->page()), (__bridge WKUserContentFilterRef)filter);114 [mainWebView()->platformView().configuration.userContentController _addUserContentFilter:filter]; 125 115 else 126 116 NSLog(@"%@", [error helpAnchor]); … … 129 119 platformRunUntil(doneCompiling, 0); 130 120 #endif 131 }132 133 void TestController::platformRunUntil(bool& done, double timeout)134 {135 NSDate *endDate = (timeout > 0) ? [NSDate dateWithTimeIntervalSinceNow:timeout] : [NSDate distantFuture];136 137 while (!done && [endDate compare:[NSDate date]] == NSOrderedDescending)138 [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate];139 121 } 140 122
Note: See TracChangeset
for help on using the changeset viewer.