Modified: trunk/Tools/ChangeLog (204928 => 204929)
--- trunk/Tools/ChangeLog 2016-08-24 20:32:41 UTC (rev 204928)
+++ trunk/Tools/ChangeLog 2016-08-24 20:53:22 UTC (rev 204929)
@@ -1,3 +1,24 @@
+2016-08-24 Simon Fraser <[email protected]>
+
+ [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):
+
2016-08-24 Jonathan Bedard <[email protected]>
WebKit2 needs layoutTestController.setDeferMainResourceDataLoad
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (204928 => 204929)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2016-08-24 20:32:41 UTC (rev 204928)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2016-08-24 20:53:22 UTC (rev 204929)
@@ -177,19 +177,19 @@
volatile bool done;
-NavigationController* gNavigationController = 0;
+NavigationController* gNavigationController = nullptr;
RefPtr<TestRunner> gTestRunner;
-WebFrame *mainFrame = 0;
+WebFrame *mainFrame = nullptr;
// This is the topmost frame that is loading, during a given load, or nil when no load is
// in progress. Usually this is the same as the main frame, but not always. In the case
// where a frameset is loaded, and then new content is loaded into one of the child frames,
// that child frame is the "topmost frame that is loading".
-WebFrame *topLoadingFrame = nil; // !nil iff a load is in progress
+WebFrame *topLoadingFrame = nullptr; // !nil iff a load is in progress
-CFMutableSetRef disallowedURLs = 0;
-static CFRunLoopTimerRef waitToDumpWatchdog = 0;
+CFMutableSetRef disallowedURLs= nullptr;
+static CFRunLoopTimerRef waitToDumpWatchdog;
// Delegates
static FrameLoadDelegate *frameLoadDelegate;
@@ -197,14 +197,14 @@
static EditingDelegate *editingDelegate;
static ResourceLoadDelegate *resourceLoadDelegate;
static HistoryDelegate *historyDelegate;
-PolicyDelegate *policyDelegate;
-DefaultPolicyDelegate *defaultPolicyDelegate;
+PolicyDelegate *policyDelegate = nullptr;
+DefaultPolicyDelegate *defaultPolicyDelegate = nullptr;
#if PLATFORM(IOS)
static ScrollViewResizerDelegate *scrollViewResizerDelegate;
#endif
-static int dumpPixelsForAllTests = NO;
-static bool dumpPixelsForCurrentTest = false;
+static int dumpPixelsForAllTests;
+static bool dumpPixelsForCurrentTest;
static int threaded;
static int dumpTree = YES;
static int useTimeoutWatchdog = YES;
@@ -211,19 +211,15 @@
static int forceComplexText;
static int useAcceleratedDrawing;
static int gcBetweenTests;
-static int showWebView = NO;
-static int printTestCount = NO;
+static int showWebView;
+static int printTestCount;
static BOOL printSeparators;
static RetainPtr<CFStringRef> persistentUserStyleSheetLocation;
static std::set<std::string> allowedHosts;
-static WebHistoryItem *prevTestBFItem = nil; // current b/f item at the end of the previous test
+static WebHistoryItem *prevTestBFItem; // current b/f item at the end of the previous test
#if PLATFORM(IOS)
-const unsigned phoneViewHeight = 480;
-const unsigned phoneViewWidth = 320;
-const unsigned phoneBrowserScrollViewHeight = 416;
-const unsigned phoneBrowserAddressBarOffset = 60;
const CGRect layoutTestViewportRect = { {0, 0}, {static_cast<CGFloat>(TestRunner::viewWidth), static_cast<CGFloat>(TestRunner::viewHeight)} };
UIWebBrowserView *gWebBrowserView = nil;
UIWebScrollView *gWebScrollView = nil;
@@ -646,7 +642,7 @@
#if PLATFORM(IOS)
-void adjustWebDocumentForFlexibleViewport(UIWebBrowserView *webBrowserView, UIWebScrollView *scrollView)
+static void adjustWebDocumentForFlexibleViewport(UIWebBrowserView *webBrowserView, UIWebScrollView *scrollView)
{
// These values match MobileSafari's, see -[TabDocument _createDocumentView].
[webBrowserView setMinimumScale:0.25f forDocumentTypes:UIEveryDocumentMask];
@@ -659,18 +655,21 @@
[(DumpRenderTreeBrowserView *)webBrowserView setScrollingUsesUIWebScrollView:YES];
[webBrowserView setDelegate:scrollViewResizerDelegate];
- CGRect viewportRect = CGRectMake(0, 0, phoneViewWidth, phoneBrowserScrollViewHeight);
+ CGRect screenBounds = [UIScreen mainScreen].bounds;
+ CGRect viewportRect = CGRectMake(0, 0, screenBounds.size.width, screenBounds.size.height);
+
[scrollView setBounds:viewportRect];
[scrollView setFrame:viewportRect];
[webBrowserView setMinimumSize:viewportRect.size];
[webBrowserView setAutoresizes:YES];
- CGRect browserViewFrame = [webBrowserView frame];
- browserViewFrame.origin = CGPointMake(0, phoneBrowserAddressBarOffset);
- [webBrowserView setFrame:browserViewFrame];
+ [webBrowserView setFrame:screenBounds];
+
+ // This just affects text autosizing.
+ [mainFrame _setVisibleSize:CGSizeMake(screenBounds.size.width, screenBounds.size.height)];
}
-void adjustWebDocumentForStandardViewport(UIWebBrowserView *webBrowserView, UIWebScrollView *scrollView)
+static void adjustWebDocumentForStandardViewport(UIWebBrowserView *webBrowserView, UIWebScrollView *scrollView)
{
[webBrowserView setMinimumScale:1.0f forDocumentTypes:UIEveryDocumentMask];
[webBrowserView setMaximumScale:5.0f forDocumentTypes:UIEveryDocumentMask];
@@ -684,9 +683,11 @@
[webBrowserView setMinimumSize:layoutTestViewportRect.size];
[webBrowserView setAutoresizes:NO];
- CGRect browserViewFrame = [webBrowserView frame];
- browserViewFrame.origin = CGPointZero;
- [webBrowserView setFrame:browserViewFrame];
+ [webBrowserView setFrame:layoutTestViewportRect];
+
+ // This just affects text autosizing.
+ [mainFrame _setVisibleSize:CGSizeMake(layoutTestViewportRect.size.width, layoutTestViewportRect.size.height)];
+
}
#endif
@@ -843,7 +844,6 @@
NSBitmapImageRep *imageRep = [webView bitmapImageRepForCachingDisplayInRect:[webView bounds]];
[webView cacheDisplayInRect:[webView bounds] toBitmapImageRep:imageRep];
#else
- [[webView mainFrame] _setVisibleSize:CGSizeMake(phoneViewWidth, phoneViewHeight)];
[[webView preferences] _setTelephoneNumberParsingEnabled:NO];
// Initialize the global UIViews, and set the key UIWindow to be painted.