Changeset 209972 in webkit


Ignore:
Timestamp:
Dec 18, 2016 12:11:48 AM (7 years ago)
Author:
Simon Fraser
Message:

Fix iOS test results after r209967.

Subtracting out the status bar height was erroneously happening for all tests,
not just for flexible viewport tests.

Fix by plumbing WebViewSizingMode through resizeTo() and setWindowFrame().

  • WebKitTestRunner/PlatformWebView.h:
  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::resetStateToConsistentValues):

  • WebKitTestRunner/efl/PlatformWebViewEfl.cpp:

(WTR::PlatformWebView::resizeTo):
(WTR::PlatformWebView::setWindowFrame):

  • WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:

(WTR::PlatformWebView::resizeTo):
(WTR::PlatformWebView::setWindowFrame):

  • WebKitTestRunner/ios/PlatformWebViewIOS.mm:

(WTR::PlatformWebView::resizeTo):
(WTR::PlatformWebView::setWindowFrame):

  • WebKitTestRunner/ios/TestControllerIOS.mm:

(WTR::TestController::platformConfigureViewForTest):

  • WebKitTestRunner/mac/PlatformWebViewMac.mm:

(WTR::PlatformWebView::resizeTo):
(WTR::PlatformWebView::setWindowFrame):

Location:
trunk/Tools
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r209970 r209972  
     12016-12-17  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Fix iOS test results after r209967.
     4       
     5        Subtracting out the status bar height was erroneously happening for all tests,
     6        not just for flexible viewport tests.
     7       
     8        Fix by plumbing WebViewSizingMode through resizeTo() and setWindowFrame().
     9
     10        * WebKitTestRunner/PlatformWebView.h:
     11        * WebKitTestRunner/TestController.cpp:
     12        (WTR::TestController::resetStateToConsistentValues):
     13        * WebKitTestRunner/efl/PlatformWebViewEfl.cpp:
     14        (WTR::PlatformWebView::resizeTo):
     15        (WTR::PlatformWebView::setWindowFrame):
     16        * WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:
     17        (WTR::PlatformWebView::resizeTo):
     18        (WTR::PlatformWebView::setWindowFrame):
     19        * WebKitTestRunner/ios/PlatformWebViewIOS.mm:
     20        (WTR::PlatformWebView::resizeTo):
     21        (WTR::PlatformWebView::setWindowFrame):
     22        * WebKitTestRunner/ios/TestControllerIOS.mm:
     23        (WTR::TestController::platformConfigureViewForTest):
     24        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
     25        (WTR::PlatformWebView::resizeTo):
     26        (WTR::PlatformWebView::setWindowFrame):
     27
    1282016-12-17  Joonghun Park  <jh718.park@samsung.com>
    229
  • trunk/Tools/WebKitTestRunner/PlatformWebView.h

    r204853 r209972  
    6868    PlatformWindow platformWindow() { return m_window; }
    6969    static PlatformWindow keyWindow();
    70     void resizeTo(unsigned width, unsigned height);
     70
     71    enum class WebViewSizingMode {
     72        Default,
     73        HeightRespectsStatusBar
     74    };
     75
     76    void resizeTo(unsigned width, unsigned height, WebViewSizingMode = WebViewSizingMode::Default);
    7177    void focus();
    7278
    7379    WKRect windowFrame();
    74     void setWindowFrame(WKRect);
     80    void setWindowFrame(WKRect, WebViewSizingMode = WebViewSizingMode::Default);
    7581
    7682    void didInitializeClients();
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r209798 r209972  
    763763
    764764#if PLATFORM(EFL)
    765     // EFL use a real window while other ports such as Qt don't.
     765    // EFL uses a real window while other ports such as Qt don't.
    766766    // In EFL, we need to resize the window to the original size after calls to window.resizeTo.
    767767    WKRect rect = m_mainWebView->windowFrame();
  • trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp

    r199336 r209972  
    8686}
    8787
    88 void PlatformWebView::resizeTo(unsigned width, unsigned height)
     88void PlatformWebView::resizeTo(unsigned width, unsigned height, WebViewSizingMode)
    8989{
    9090    // FIXME: Don't we need to resize the window too?
     
    116116}
    117117
    118 void PlatformWebView::setWindowFrame(WKRect frame)
     118void PlatformWebView::setWindowFrame(WKRect frame, WebViewSizingMode)
    119119{
    120120    ecore_evas_move_resize(m_window, frame.origin.x, frame.origin.y, frame.size.width, frame.size.height);
  • trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp

    r191783 r209972  
    6565}
    6666
    67 void PlatformWebView::resizeTo(unsigned width, unsigned height)
     67void PlatformWebView::resizeTo(unsigned width, unsigned height, WebViewSizingMode sizingMode)
    6868{
    6969    WKRect frame = windowFrame();
    7070    frame.size.width = width;
    7171    frame.size.height = height;
    72     setWindowFrame(frame);
     72    setWindowFrame(frame, sizingMode);
    7373}
    7474
     
    9898}
    9999
    100 void PlatformWebView::setWindowFrame(WKRect frame)
     100void PlatformWebView::setWindowFrame(WKRect frame, WebViewSizingMode)
    101101{
    102102    gdk_window_move_resize(gtk_widget_get_window(GTK_WIDGET(m_window)),
  • trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm

    r209967 r209972  
    115115};
    116116
    117 static CGRect viewRectForWindowRect(CGRect windowRect, WebViewSizingMode mode)
     117static CGRect viewRectForWindowRect(CGRect windowRect, PlatformWebView::WebViewSizingMode mode)
    118118{
    119119    CGFloat statusBarBottom = CGRectGetMaxY([[UIApplication sharedApplication] statusBarFrame]);
    120     return CGRectMake(windowRect.origin.x, windowRect.origin.y + statusBarBottom, windowRect.size.width, windowRect.size.height - (mode == WebViewSizingMode::HeightRespectsStatusBar ? statusBarBottom : 0));
     120    return CGRectMake(windowRect.origin.x, windowRect.origin.y + statusBarBottom, windowRect.size.width, windowRect.size.height - (mode == PlatformWebView::WebViewSizingMode::HeightRespectsStatusBar ? statusBarBottom : 0));
    121121}
    122122
     
    167167}
    168168
    169 void PlatformWebView::resizeTo(unsigned width, unsigned height)
     169void PlatformWebView::resizeTo(unsigned width, unsigned height, WebViewSizingMode viewSizingMode)
    170170{
    171171    WKRect frame = windowFrame();
    172172    frame.size.width = width;
    173173    frame.size.height = height;
    174     setWindowFrame(frame);
     174    setWindowFrame(frame, viewSizingMode);
    175175}
    176176
     
    198198}
    199199
    200 void PlatformWebView::setWindowFrame(WKRect frame)
     200void PlatformWebView::setWindowFrame(WKRect frame, WebViewSizingMode viewSizingMode)
    201201{
    202202    [m_window setFrame:CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height)];
    203     [platformView() setFrame:viewRectForWindowRect(CGRectMake(0, 0, frame.size.width, frame.size.height), WebViewSizingMode::HeightRespectsStatusBar)];
     203    [platformView() setFrame:viewRectForWindowRect(CGRectMake(0, 0, frame.size.width, frame.size.height), viewSizingMode)];
    204204}
    205205
  • trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm

    r208926 r209972  
    9898    if (test.options().useFlexibleViewport) {
    9999        CGRect screenBounds = [UIScreen mainScreen].bounds;
    100         mainWebView()->resizeTo(screenBounds.size.width, screenBounds.size.height);
     100        mainWebView()->resizeTo(screenBounds.size.width, screenBounds.size.height, PlatformWebView::WebViewSizingMode::HeightRespectsStatusBar);
    101101        // We also pass data to InjectedBundle::beginTesting() to have it call
    102102        // WKBundlePageSetUseTestingViewportConfiguration(false).
  • trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm

    r209364 r209972  
    165165}
    166166
    167 void PlatformWebView::resizeTo(unsigned width, unsigned height)
     167void PlatformWebView::resizeTo(unsigned width, unsigned height, WebViewSizingMode sizingMode)
    168168{
    169169    WKRect frame = windowFrame();
    170170    frame.size.width = width;
    171171    frame.size.height = height;
    172     setWindowFrame(frame);
     172    setWindowFrame(frame, sizingMode);
    173173}
    174174
     
    220220}
    221221
    222 void PlatformWebView::setWindowFrame(WKRect frame)
     222void PlatformWebView::setWindowFrame(WKRect frame, WebViewSizingMode)
    223223{
    224224    [m_window setFrame:NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height) display:YES];
Note: See TracChangeset for help on using the changeset viewer.