Changeset 188548 in webkit


Ignore:
Timestamp:
Aug 17, 2015 3:49:42 PM (9 years ago)
Author:
andersca@apple.com
Message:

Simplify how PlatformWebViews are created when view options change
https://bugs.webkit.org/show_bug.cgi?id=148093

Reviewed by Sam Weinig.

Instead of letting each port dictate when the PlatformWebView should be recreated we now do the following:

TestController::ensureViewSupportsOptionsForTest gets the view options for a test by calling
TestController::viewOptionsForTest, which returns a filled in ViewOptions struct for a given test. It also allows
ports to add/override settings by calling TestController::updatePlatformSpecificViewOptionsForTest.

If the current PlatformWebView doesn't support the given view options, delete the web view and create a new one.

Also, get rid of the first call to TestController::createWebViewWithOptions in TestController::initialize and
always rely on TestController::ensureViewSupportsOptionsForTest creating a PlatformWebView for us.

  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::shouldUseFixedLayout):
(WTR::TestController::viewOptionsForTest):
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
(WTR::TestController::configureViewForTest):
(WTR::TestController::initialize): Deleted.
(WTR::TestController::ensureViewSupportsOptions): Deleted.
(WTR::TestController::updateLayoutTypeForTest): Deleted.
(WTR::TestController::platformConfigureViewForTest): Deleted.
(WTR::TestController::platformResetPreferencesToConsistentValues): Deleted.
(WTR::TestController::run): Deleted.

  • WebKitTestRunner/TestController.h:
  • WebKitTestRunner/efl/TestControllerEfl.cpp:

(WTR::shouldUseFixedLayout):
(WTR::TestController::updatePlatformSpecificViewOptionsForTest):
(WTR::TestController::platformConfigureViewForTest):
(WTR::TestController::platformResetPreferencesToConsistentValues):

  • WebKitTestRunner/ios/TestControllerIOS.mm:

(WTR::TestController::updatePlatformSpecificViewOptionsForTest):

  • WebKitTestRunner/mac/TestControllerMac.mm:

(WTR::TestController::updatePlatformSpecificViewOptionsForTest):
(WTR::TestController::platformConfigureViewForTest):

Location:
trunk/Tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r188543 r188548  
     12015-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
    1442015-08-17  Sam Weinig  <sam@webkit.org>
    245
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r188385 r188548  
    433433    // Some preferences (notably mock scroll bars setting) currently cannot be re-applied to an existing view, so we need to set them now.
    434434    resetPreferencesToConsistentValues();
    435 
    436     ViewOptions viewOptions;
    437     viewOptions.useRemoteLayerTree = m_shouldUseRemoteLayerTree;
    438     viewOptions.shouldShowWebView = m_shouldShowWebView;
    439 
    440     createWebViewWithOptions(viewOptions);
    441435}
    442436
     
    544538}
    545539
    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);
     540void 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);
    551550        WKPageClose(m_mainWebView->page());
    552        
     551
    553552        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");
    558559}
    559560
     
    748749}
    749750
     751static 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
     761ViewOptions 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
    750774void TestController::updateWebViewSizeForTest(const TestInvocation& test)
    751775{
     
    768792}
    769793
    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 #endif
    777 
    778 #if USE(COORDINATED_GRAPHICS) && PLATFORM(EFL)
    779     if (test.urlContains("sticky/") || test.urlContains("sticky\\"))
    780         return true;
    781 #endif
    782     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 #endif
    805 
    806794void TestController::configureViewForTest(const TestInvocation& test)
    807795{
     796    ensureViewSupportsOptionsForTest(test);
    808797    updateWebViewSizeForTest(test);
    809798    updateWindowScaleForTest(mainWebView(), test);
    810     updateLayoutTypeForTest(test);
    811799
    812800    platformConfigureViewForTest(test);
     
    936924void TestController::run()
    937925{
    938     if (!resetStateToConsistentValues()) {
    939         TestInvocation::dumpWebProcessUnresponsiveness("<unknown> - TestController::run - Failed to reset state to consistent values\n");
    940         return;
    941     }
    942 
    943926    if (m_usingServerMode)
    944927        runTestingServerLoop();
  • trunk/Tools/WebKitTestRunner/TestController.h

    r188157 r188548  
    6969    EventSenderProxy* eventSenderProxy() { return m_eventSenderProxy.get(); }
    7070
    71     void ensureViewSupportsOptions(const ViewOptions&);
    7271    bool shouldUseRemoteLayerTree() const { return m_shouldUseRemoteLayerTree; }
    7372   
     
    143142    void initializeTestPluginDirectory();
    144143
     144    void ensureViewSupportsOptionsForTest(const TestInvocation&);
     145    ViewOptions viewOptionsForTest(const TestInvocation&) const;
     146    void updatePlatformSpecificViewOptionsForTest(ViewOptions&, const TestInvocation&) const;
     147
    145148    void updateWebViewSizeForTest(const TestInvocation&);
    146149    void updateWindowScaleForTest(PlatformWebView*, const TestInvocation&);
    147     void updateLayoutTypeForTest(const TestInvocation&);
    148150
    149151    void decidePolicyForGeolocationPermissionRequestIfPossible();
  • trunk/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp

    r177870 r188548  
    2222
    2323#include "PlatformWebView.h"
     24#include "TestInvocation.h"
    2425#include <Ecore.h>
    2526#include <Evas.h>
     
    133134}
    134135
     136static 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
     145void TestController::updatePlatformSpecificViewOptionsForTest(ViewOptions& viewOptions, const TestInvocation& test) const
     146{
     147    viewOptions.useFixedLayout = shouldUseFixedLayout(test);
     148}
     149
     150void TestController::platformConfigureViewForTest(const TestInvocation&)
     151{
     152}
     153
     154void TestController::platformResetPreferencesToConsistentValues()
     155{
     156}
     157
    135158} // namespace WTR
  • trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm

    r180636 r188548  
    9999}
    100100
     101void TestController::updatePlatformSpecificViewOptionsForTest(ViewOptions&, const TestInvocation&) const
     102{
     103}
     104
    101105void TestController::platformRunUntil(bool& done, double timeout)
    102106{
  • trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm

    r188157 r188548  
    9797}
    9898
    99 void TestController::platformConfigureViewForTest(const TestInvocation& test)
    100 {
    101     ViewOptions viewOptions;
    102 
     99void TestController::updatePlatformSpecificViewOptionsForTest(ViewOptions& viewOptions, const TestInvocation& test) const
     100{
    103101    viewOptions.useThreadedScrolling = shouldUseThreadedScrolling(test);
    104102    viewOptions.useRemoteLayerTree = shouldUseRemoteLayerTree();
    105103    viewOptions.shouldShowWebView = shouldShowWebView();
    106 
    107     ensureViewSupportsOptions(viewOptions);
    108 
     104}
     105
     106void TestController::platformConfigureViewForTest(const TestInvocation& test)
     107{
    109108#if WK_API_ENABLED
    110109    if (!test.urlContains("contentextensions/"))
Note: See TracChangeset for help on using the changeset viewer.