Title: [280867] trunk/Tools
Revision
280867
Author
timothy_hor...@apple.com
Date
2021-08-10 15:17:32 -0700 (Tue, 10 Aug 2021)

Log Message

macCatalyst: Flexible viewport tests that dump the window size fail because it doesn't match iPad
https://bugs.webkit.org/show_bug.cgi?id=228964

Reviewed by Darin Adler.

* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformConfigureViewForTest):
For platforms where we control the size of the window/scene, resize it
to match the chosen default testing iPad size (768x1024), but with the
default testing iPad's status bar subtracted out, and the current platform's
added in, so that the end result is a WKWebView of identical size to
one on the default testing iPad.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (280866 => 280867)


--- trunk/Tools/ChangeLog	2021-08-10 21:53:12 UTC (rev 280866)
+++ trunk/Tools/ChangeLog	2021-08-10 22:17:32 UTC (rev 280867)
@@ -1,3 +1,18 @@
+2021-08-10  Tim Horton  <timothy_hor...@apple.com>
+
+        macCatalyst: Flexible viewport tests that dump the window size fail because it doesn't match iPad
+        https://bugs.webkit.org/show_bug.cgi?id=228964
+
+        Reviewed by Darin Adler.
+
+        * WebKitTestRunner/ios/TestControllerIOS.mm:
+        (WTR::TestController::platformConfigureViewForTest):
+        For platforms where we control the size of the window/scene, resize it
+        to match the chosen default testing iPad size (768x1024), but with the
+        default testing iPad's status bar subtracted out, and the current platform's
+        added in, so that the end result is a WKWebView of identical size to
+        one on the default testing iPad.
+
 2021-08-10  Jonathan Bedard  <jbed...@apple.com>
 
         [git-webkit] Color `log` output

Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (280866 => 280867)


--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2021-08-10 21:53:12 UTC (rev 280866)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2021-08-10 22:17:32 UTC (rev 280867)
@@ -281,9 +281,20 @@
     if (!test.options().useFlexibleViewport())
         return;
 
-    CGRect screenBounds = [UIScreen mainScreen].bounds;
+    UIWindowScene *scene = webView.window.windowScene;
+    CGRect sceneBounds = [UIScreen mainScreen].bounds;
+    if (scene.sizeRestrictions) {
+        // For platforms that support resizeable scenes, resize to match iPad 5th Generation,
+        // the default iPad device used for layout testing.
+        // We add the status bar in here because it is subtracted back out in viewRectForWindowRect.
+        static constexpr CGSize defaultTestingiPadViewSize = { 768, 1004 };
+        sceneBounds = CGRectMake(0, 0, defaultTestingiPadViewSize.width, defaultTestingiPadViewSize.height + CGRectGetHeight(UIApplication.sharedApplication.statusBarFrame));
+        scene.sizeRestrictions.minimumSize = sceneBounds.size;
+        scene.sizeRestrictions.maximumSize = sceneBounds.size;
+    }
+
     CGSize oldSize = webView.bounds.size;
-    mainWebView()->resizeTo(screenBounds.size.width, screenBounds.size.height, PlatformWebView::WebViewSizingMode::HeightRespectsStatusBar);
+    mainWebView()->resizeTo(sceneBounds.size.width, sceneBounds.size.height, PlatformWebView::WebViewSizingMode::HeightRespectsStatusBar);
     CGSize newSize = webView.bounds.size;
     
     if (!CGSizeEqualToSize(oldSize, newSize)) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to