Changeset 188548 in webkit
- Timestamp:
- Aug 17, 2015 3:49:42 PM (9 years ago)
- Location:
- trunk/Tools
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r188543 r188548 1 2015-08-17 Anders Carlsson <andersca@apple.com> 2 3 Simplify how PlatformWebViews are created when view options change 4 https://bugs.webkit.org/show_bug.cgi?id=148093 5 6 Reviewed by Sam Weinig. 7 8 Instead of letting each port dictate when the PlatformWebView should be recreated we now do the following: 9 10 TestController::ensureViewSupportsOptionsForTest gets the view options for a test by calling 11 TestController::viewOptionsForTest, which returns a filled in ViewOptions struct for a given test. It also allows 12 ports to add/override settings by calling TestController::updatePlatformSpecificViewOptionsForTest. 13 14 If the current PlatformWebView doesn't support the given view options, delete the web view and create a new one. 15 16 Also, get rid of the first call to TestController::createWebViewWithOptions in TestController::initialize and 17 always rely on TestController::ensureViewSupportsOptionsForTest creating a PlatformWebView for us. 18 19 * WebKitTestRunner/TestController.cpp: 20 (WTR::TestController::ensureViewSupportsOptionsForTest): 21 (WTR::shouldUseFixedLayout): 22 (WTR::TestController::viewOptionsForTest): 23 (WTR::TestController::updateWebViewSizeForTest): 24 (WTR::TestController::updateWindowScaleForTest): 25 (WTR::TestController::configureViewForTest): 26 (WTR::TestController::initialize): Deleted. 27 (WTR::TestController::ensureViewSupportsOptions): Deleted. 28 (WTR::TestController::updateLayoutTypeForTest): Deleted. 29 (WTR::TestController::platformConfigureViewForTest): Deleted. 30 (WTR::TestController::platformResetPreferencesToConsistentValues): Deleted. 31 (WTR::TestController::run): Deleted. 32 * WebKitTestRunner/TestController.h: 33 * WebKitTestRunner/efl/TestControllerEfl.cpp: 34 (WTR::shouldUseFixedLayout): 35 (WTR::TestController::updatePlatformSpecificViewOptionsForTest): 36 (WTR::TestController::platformConfigureViewForTest): 37 (WTR::TestController::platformResetPreferencesToConsistentValues): 38 * WebKitTestRunner/ios/TestControllerIOS.mm: 39 (WTR::TestController::updatePlatformSpecificViewOptionsForTest): 40 * WebKitTestRunner/mac/TestControllerMac.mm: 41 (WTR::TestController::updatePlatformSpecificViewOptionsForTest): 42 (WTR::TestController::platformConfigureViewForTest): 43 1 44 2015-08-17 Sam Weinig <sam@webkit.org> 2 45 -
trunk/Tools/WebKitTestRunner/TestController.cpp
r188385 r188548 433 433 // Some preferences (notably mock scroll bars setting) currently cannot be re-applied to an existing view, so we need to set them now. 434 434 resetPreferencesToConsistentValues(); 435 436 ViewOptions viewOptions;437 viewOptions.useRemoteLayerTree = m_shouldUseRemoteLayerTree;438 viewOptions.shouldShowWebView = m_shouldShowWebView;439 440 createWebViewWithOptions(viewOptions);441 435 } 442 436 … … 544 538 } 545 539 546 void TestController::ensureViewSupportsOptions(const ViewOptions& options) 547 { 548 if (m_mainWebView && !m_mainWebView->viewSupportsOptions(options)) { 549 WKPageSetPageUIClient(m_mainWebView->page(), 0); 550 WKPageSetPageNavigationClient(m_mainWebView->page(), 0); 540 void TestController::ensureViewSupportsOptionsForTest(const TestInvocation& test) 541 { 542 auto viewOptions = viewOptionsForTest(test); 543 544 if (m_mainWebView) { 545 if (m_mainWebView->viewSupportsOptions(viewOptions)) 546 return; 547 548 WKPageSetPageUIClient(m_mainWebView->page(), nullptr); 549 WKPageSetPageNavigationClient(m_mainWebView->page(), nullptr); 551 550 WKPageClose(m_mainWebView->page()); 552 551 553 552 m_mainWebView = nullptr; 554 555 createWebViewWithOptions(options); 556 resetStateToConsistentValues(); 557 } 553 } 554 555 createWebViewWithOptions(viewOptions); 556 557 if (!resetStateToConsistentValues()) 558 TestInvocation::dumpWebProcessUnresponsiveness("<unknown> - TestController::run - Failed to reset state to consistent values\n"); 558 559 } 559 560 … … 748 749 } 749 750 751 static bool shouldUseFixedLayout(const TestInvocation& test) 752 { 753 #if ENABLE(CSS_DEVICE_ADAPTATION) 754 if (test.urlContains("device-adapt/") || test.urlContains("device-adapt\\")) 755 return true; 756 #endif 757 758 return false; 759 } 760 761 ViewOptions TestController::viewOptionsForTest(const TestInvocation& test) const 762 { 763 ViewOptions viewOptions; 764 765 viewOptions.useRemoteLayerTree = m_shouldUseRemoteLayerTree; 766 viewOptions.shouldShowWebView = m_shouldShowWebView; 767 viewOptions.useFixedLayout = shouldUseFixedLayout(test); 768 769 updatePlatformSpecificViewOptionsForTest(viewOptions, test); 770 771 return viewOptions; 772 } 773 750 774 void TestController::updateWebViewSizeForTest(const TestInvocation& test) 751 775 { … … 768 792 } 769 793 770 // FIXME: move into relevant platformConfigureViewForTest()?771 static bool shouldUseFixedLayout(const TestInvocation& test)772 {773 #if ENABLE(CSS_DEVICE_ADAPTATION)774 if (test.urlContains("device-adapt/") || test.urlContains("device-adapt\\"))775 return true;776 #endif777 778 #if USE(COORDINATED_GRAPHICS) && PLATFORM(EFL)779 if (test.urlContains("sticky/") || test.urlContains("sticky\\"))780 return true;781 #endif782 return false;783 784 UNUSED_PARAM(test);785 }786 787 void TestController::updateLayoutTypeForTest(const TestInvocation& test)788 {789 ViewOptions viewOptions;790 791 viewOptions.useFixedLayout = shouldUseFixedLayout(test);792 793 ensureViewSupportsOptions(viewOptions);794 }795 796 #if !PLATFORM(COCOA) && !PLATFORM(GTK)797 void TestController::platformConfigureViewForTest(const TestInvocation&)798 {799 }800 801 void TestController::platformResetPreferencesToConsistentValues()802 {803 }804 #endif805 806 794 void TestController::configureViewForTest(const TestInvocation& test) 807 795 { 796 ensureViewSupportsOptionsForTest(test); 808 797 updateWebViewSizeForTest(test); 809 798 updateWindowScaleForTest(mainWebView(), test); 810 updateLayoutTypeForTest(test);811 799 812 800 platformConfigureViewForTest(test); … … 936 924 void TestController::run() 937 925 { 938 if (!resetStateToConsistentValues()) {939 TestInvocation::dumpWebProcessUnresponsiveness("<unknown> - TestController::run - Failed to reset state to consistent values\n");940 return;941 }942 943 926 if (m_usingServerMode) 944 927 runTestingServerLoop(); -
trunk/Tools/WebKitTestRunner/TestController.h
r188157 r188548 69 69 EventSenderProxy* eventSenderProxy() { return m_eventSenderProxy.get(); } 70 70 71 void ensureViewSupportsOptions(const ViewOptions&);72 71 bool shouldUseRemoteLayerTree() const { return m_shouldUseRemoteLayerTree; } 73 72 … … 143 142 void initializeTestPluginDirectory(); 144 143 144 void ensureViewSupportsOptionsForTest(const TestInvocation&); 145 ViewOptions viewOptionsForTest(const TestInvocation&) const; 146 void updatePlatformSpecificViewOptionsForTest(ViewOptions&, const TestInvocation&) const; 147 145 148 void updateWebViewSizeForTest(const TestInvocation&); 146 149 void updateWindowScaleForTest(PlatformWebView*, const TestInvocation&); 147 void updateLayoutTypeForTest(const TestInvocation&);148 150 149 151 void decidePolicyForGeolocationPermissionRequestIfPossible(); -
trunk/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp
r177870 r188548 22 22 23 23 #include "PlatformWebView.h" 24 #include "TestInvocation.h" 24 25 #include <Ecore.h> 25 26 #include <Evas.h> … … 133 134 } 134 135 136 static bool shouldUseFixedLayout(const TestInvocation& test) 137 { 138 #if USE(COORDINATED_GRAPHICS) 139 if (test.urlContains("sticky/") || test.urlContains("sticky\\")) 140 return true; 141 #endif 142 return false; 143 } 144 145 void TestController::updatePlatformSpecificViewOptionsForTest(ViewOptions& viewOptions, const TestInvocation& test) const 146 { 147 viewOptions.useFixedLayout = shouldUseFixedLayout(test); 148 } 149 150 void TestController::platformConfigureViewForTest(const TestInvocation&) 151 { 152 } 153 154 void TestController::platformResetPreferencesToConsistentValues() 155 { 156 } 157 135 158 } // namespace WTR -
trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm
r180636 r188548 99 99 } 100 100 101 void TestController::updatePlatformSpecificViewOptionsForTest(ViewOptions&, const TestInvocation&) const 102 { 103 } 104 101 105 void TestController::platformRunUntil(bool& done, double timeout) 102 106 { -
trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm
r188157 r188548 97 97 } 98 98 99 void TestController::platformConfigureViewForTest(const TestInvocation& test) 100 { 101 ViewOptions viewOptions; 102 99 void TestController::updatePlatformSpecificViewOptionsForTest(ViewOptions& viewOptions, const TestInvocation& test) const 100 { 103 101 viewOptions.useThreadedScrolling = shouldUseThreadedScrolling(test); 104 102 viewOptions.useRemoteLayerTree = shouldUseRemoteLayerTree(); 105 103 viewOptions.shouldShowWebView = shouldShowWebView(); 106 107 ensureViewSupportsOptions(viewOptions); 108 104 } 105 106 void TestController::platformConfigureViewForTest(const TestInvocation& test) 107 { 109 108 #if WK_API_ENABLED 110 109 if (!test.urlContains("contentextensions/"))
Note: See TracChangeset
for help on using the changeset viewer.