[Mac] Update window scale API usage
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2019 02:01:21 +0000 (02:01 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2019 02:01:21 +0000 (02:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193991
rdar://problem/47614795

Reviewed by Tim Horton.

* DumpRenderTree/mac/DumpRenderTree.mm:
(changeWindowScaleIfNeeded):
* DumpRenderTree/mac/DumpRenderTreeWindow.h:
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::changeWindowScaleIfNeeded):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240700 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/mac/DumpRenderTreeWindow.h
Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm

index e5776ef..65698ba 100644 (file)
@@ -1,3 +1,17 @@
+2019-01-29  Alexey Proskuryakov  <ap@apple.com>
+
+        [Mac] Update window scale API usage
+        https://bugs.webkit.org/show_bug.cgi?id=193991
+        rdar://problem/47614795
+
+        Reviewed by Tim Horton.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (changeWindowScaleIfNeeded):
+        * DumpRenderTree/mac/DumpRenderTreeWindow.h:
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (WTR::PlatformWebView::changeWindowScaleIfNeeded):
+
 2019-01-29  Chris Dumez  <cdumez@apple.com>
 
         REGRESSION: ProcessSwap.DoSameSiteNavigationAfterCrossSiteProvisionalLoadStarted Failing on iOS
index d3f58c7..255be2d 100644 (file)
@@ -1619,7 +1619,11 @@ static void changeWindowScaleIfNeeded(const char* testPathOrUR)
         return;
     // When the new scale factor is set on the window first, WebView doesn't see it as a new scale and stops propagating the behavior change to WebCore::Page.
     gTestRunner->setBackingScaleFactor(requiredScaleFactor);
-    [[[mainFrame webView] window] _setWindowResolution:requiredScaleFactor displayIfChanged:YES];
+    NSWindow *window = [[mainFrame webView] window];
+    if ([window respondsToSelector:@selector(_setWindowResolution:)])
+        [window _setWindowResolution:requiredScaleFactor];
+    else
+        [window _setWindowResolution:requiredScaleFactor displayIfChanged:YES];
 }
 #endif
 
index baf273b..7650a50 100644 (file)
@@ -39,6 +39,9 @@
 
 @interface NSWindow (Details)
 
+- (void)_setWindowResolution:(CGFloat)resolution;
+
+// FIXME: Remove once the variant above exists on all platforms we need (cf. rdar://problem/47614795).
 - (void)_setWindowResolution:(CGFloat)resolution displayIfChanged:(BOOL)displayIfChanged;
 
 @end
index 45d1f9b..69436f2 100644 (file)
@@ -52,6 +52,8 @@ enum {
 
 // FIXME: Move to NSWindowSPI.h.
 @interface NSWindow ()
+- (void)_setWindowResolution:(CGFloat)resolution;
+// FIXME: Remove once the variant above exists on all platforms we need (cf. rdar://problem/47614795).
 - (void)_setWindowResolution:(CGFloat)resolution displayIfChanged:(BOOL)displayIfChanged;
 @end
 
@@ -238,7 +240,10 @@ void PlatformWebView::changeWindowScaleIfNeeded(float newScale)
     if (currentScale == newScale)
         return;
 
-    [m_window _setWindowResolution:newScale displayIfChanged:YES];
+    if ([m_window respondsToSelector:@selector(_setWindowResolution:)])
+        [m_window _setWindowResolution:newScale];
+    else
+        [m_window _setWindowResolution:newScale displayIfChanged:YES];
 #if WK_API_ENABLED
     [m_view _setOverrideDeviceScaleFactor:newScale];
 #endif