Changeset 204929 in webkit


Ignore:
Timestamp:
Aug 24, 2016 1:53:22 PM (8 years ago)
Author:
Simon Fraser
Message:

[iOS DRT] Make iOS DRT use the same window size as WebKitTestRunner for flexible viewport tests
https://bugs.webkit.org/show_bug.cgi?id=161124

Reviewed by Daniel Bates.

Use the main UIScreen's bounds for the size of the window in flexible viewport mode,
and remove the 'phoneBrowserAddressBarOffset' hack, so that it matches WTR.

Remove some unnecessary zero initializations of static variables.

Change _setVisibleSize to use the window size, which should not be a behavior change
because this it just used for text autosizing, which is disabled by default,
and only the width is consulted.

  • DumpRenderTree/mac/DumpRenderTree.mm:

(adjustWebDocumentForFlexibleViewport):
(adjustWebDocumentForStandardViewport):
(createWebViewAndOffscreenWindow):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r204918 r204929  
     12016-08-24  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS DRT] Make iOS DRT use the same window size as WebKitTestRunner for flexible viewport tests
     4        https://bugs.webkit.org/show_bug.cgi?id=161124
     5
     6        Reviewed by Daniel Bates.
     7       
     8        Use the main UIScreen's bounds for the size of the window in flexible viewport mode,
     9        and remove the 'phoneBrowserAddressBarOffset' hack, so that it matches WTR.
     10       
     11        Remove some unnecessary zero initializations of static variables.
     12       
     13        Change _setVisibleSize to use the window size, which should not be a behavior change
     14        because this it just used for text autosizing, which is disabled by default,
     15        and only the width is consulted.
     16
     17        * DumpRenderTree/mac/DumpRenderTree.mm:
     18        (adjustWebDocumentForFlexibleViewport):
     19        (adjustWebDocumentForStandardViewport):
     20        (createWebViewAndOffscreenWindow):
     21
    1222016-08-24  Jonathan Bedard  <jbedard@apple.com>
    223
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r204912 r204929  
    178178volatile bool done;
    179179
    180 NavigationController* gNavigationController = 0;
     180NavigationController* gNavigationController = nullptr;
    181181RefPtr<TestRunner> gTestRunner;
    182182
    183 WebFrame *mainFrame = 0;
     183WebFrame *mainFrame = nullptr;
    184184// This is the topmost frame that is loading, during a given load, or nil when no load is
    185185// in progress.  Usually this is the same as the main frame, but not always.  In the case
    186186// where a frameset is loaded, and then new content is loaded into one of the child frames,
    187187// that child frame is the "topmost frame that is loading".
    188 WebFrame *topLoadingFrame = nil;    // !nil iff a load is in progress
    189 
    190 
    191 CFMutableSetRef disallowedURLs = 0;
    192 static CFRunLoopTimerRef waitToDumpWatchdog = 0;
     188WebFrame *topLoadingFrame = nullptr; // !nil iff a load is in progress
     189
     190
     191CFMutableSetRef disallowedURLs= nullptr;
     192static CFRunLoopTimerRef waitToDumpWatchdog;
    193193
    194194// Delegates
     
    198198static ResourceLoadDelegate *resourceLoadDelegate;
    199199static HistoryDelegate *historyDelegate;
    200 PolicyDelegate *policyDelegate;
    201 DefaultPolicyDelegate *defaultPolicyDelegate;
     200PolicyDelegate *policyDelegate = nullptr;
     201DefaultPolicyDelegate *defaultPolicyDelegate = nullptr;
    202202#if PLATFORM(IOS)
    203203static ScrollViewResizerDelegate *scrollViewResizerDelegate;
    204204#endif
    205205
    206 static int dumpPixelsForAllTests = NO;
    207 static bool dumpPixelsForCurrentTest = false;
     206static int dumpPixelsForAllTests;
     207static bool dumpPixelsForCurrentTest;
    208208static int threaded;
    209209static int dumpTree = YES;
     
    212212static int useAcceleratedDrawing;
    213213static int gcBetweenTests;
    214 static int showWebView = NO;
    215 static int printTestCount = NO;
     214static int showWebView;
     215static int printTestCount;
    216216static BOOL printSeparators;
    217217static RetainPtr<CFStringRef> persistentUserStyleSheetLocation;
    218218static std::set<std::string> allowedHosts;
    219219
    220 static WebHistoryItem *prevTestBFItem = nil; // current b/f item at the end of the previous test
     220static WebHistoryItem *prevTestBFItem; // current b/f item at the end of the previous test
    221221
    222222#if PLATFORM(IOS)
    223 const unsigned phoneViewHeight = 480;
    224 const unsigned phoneViewWidth = 320;
    225 const unsigned phoneBrowserScrollViewHeight = 416;
    226 const unsigned phoneBrowserAddressBarOffset = 60;
    227223const CGRect layoutTestViewportRect = { {0, 0}, {static_cast<CGFloat>(TestRunner::viewWidth), static_cast<CGFloat>(TestRunner::viewHeight)} };
    228224UIWebBrowserView *gWebBrowserView = nil;
     
    647643
    648644#if PLATFORM(IOS)
    649 void adjustWebDocumentForFlexibleViewport(UIWebBrowserView *webBrowserView, UIWebScrollView *scrollView)
     645static void adjustWebDocumentForFlexibleViewport(UIWebBrowserView *webBrowserView, UIWebScrollView *scrollView)
    650646{
    651647    // These values match MobileSafari's, see -[TabDocument _createDocumentView].
     
    660656    [webBrowserView setDelegate:scrollViewResizerDelegate];
    661657
    662     CGRect viewportRect = CGRectMake(0, 0, phoneViewWidth, phoneBrowserScrollViewHeight);
     658    CGRect screenBounds = [UIScreen mainScreen].bounds;
     659    CGRect viewportRect = CGRectMake(0, 0, screenBounds.size.width, screenBounds.size.height);
     660
    663661    [scrollView setBounds:viewportRect];
    664662    [scrollView setFrame:viewportRect];
     
    666664    [webBrowserView setMinimumSize:viewportRect.size];
    667665    [webBrowserView setAutoresizes:YES];
    668     CGRect browserViewFrame = [webBrowserView frame];
    669     browserViewFrame.origin = CGPointMake(0, phoneBrowserAddressBarOffset);
    670     [webBrowserView setFrame:browserViewFrame];
    671 }
    672 
    673 void adjustWebDocumentForStandardViewport(UIWebBrowserView *webBrowserView, UIWebScrollView *scrollView)
     666    [webBrowserView setFrame:screenBounds];
     667
     668    // This just affects text autosizing.
     669    [mainFrame _setVisibleSize:CGSizeMake(screenBounds.size.width, screenBounds.size.height)];
     670}
     671
     672static void adjustWebDocumentForStandardViewport(UIWebBrowserView *webBrowserView, UIWebScrollView *scrollView)
    674673{
    675674    [webBrowserView setMinimumScale:1.0f forDocumentTypes:UIEveryDocumentMask];
     
    685684    [webBrowserView setMinimumSize:layoutTestViewportRect.size];
    686685    [webBrowserView setAutoresizes:NO];
    687     CGRect browserViewFrame = [webBrowserView frame];
    688     browserViewFrame.origin = CGPointZero;
    689     [webBrowserView setFrame:browserViewFrame];
     686    [webBrowserView setFrame:layoutTestViewportRect];
     687
     688    // This just affects text autosizing.
     689    [mainFrame _setVisibleSize:CGSizeMake(layoutTestViewportRect.size.width, layoutTestViewportRect.size.height)];
     690
    690691}
    691692#endif
     
    844845    [webView cacheDisplayInRect:[webView bounds] toBitmapImageRep:imageRep];
    845846#else
    846     [[webView mainFrame] _setVisibleSize:CGSizeMake(phoneViewWidth, phoneViewHeight)];
    847847    [[webView preferences] _setTelephoneNumberParsingEnabled:NO];
    848848
Note: See TracChangeset for help on using the changeset viewer.