Title: [201904] trunk
Revision
201904
Author
[email protected]
Date
2016-06-09 20:31:00 -0700 (Thu, 09 Jun 2016)

Log Message

Add testing support for 3x device scale factor.
https://bugs.webkit.org/show_bug.cgi?id=158597

Reviewed by Simon Fraser.

Set 3x device scale factor on the test canvas when the test url is prefixed with hidpi-3x-.

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(changeWindowScaleIfNeeded):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::updateWindowScaleForTest):
* WebKitTestRunner/TestOptions.cpp:
(WTR::deviceScaleFactorForTest):
(WTR::TestOptions::TestOptions):
(WTR::isHiDPITestPath): Deleted.
* WebKitTestRunner/TestOptions.h:

LayoutTests:

* fast/hidpi/hidpi-3x-device-pixel-ratio-expected.txt: Added.
* fast/hidpi/hidpi-3x-device-pixel-ratio.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (201903 => 201904)


--- trunk/LayoutTests/ChangeLog	2016-06-10 03:20:01 UTC (rev 201903)
+++ trunk/LayoutTests/ChangeLog	2016-06-10 03:31:00 UTC (rev 201904)
@@ -1,3 +1,15 @@
+2016-06-09  Zalan Bujtas  <[email protected]>
+
+        Add testing support for 3x device scale factor.
+        https://bugs.webkit.org/show_bug.cgi?id=158597
+
+        Reviewed by Simon Fraser.
+
+        Set 3x device scale factor on the test canvas when the test url is prefixed with hidpi-3x-. 
+
+        * fast/hidpi/hidpi-3x-device-pixel-ratio-expected.txt: Added.
+        * fast/hidpi/hidpi-3x-device-pixel-ratio.html: Added.
+
 2016-06-09  Ryosuke Niwa  <[email protected]>
 
         REGRESSION(r201823) editing/selection/selection-in-iframe-removed-crash.html is flaky

Added: trunk/LayoutTests/fast/hidpi/hidpi-3x-device-pixel-ratio-expected.txt (0 => 201904)


--- trunk/LayoutTests/fast/hidpi/hidpi-3x-device-pixel-ratio-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/hidpi/hidpi-3x-device-pixel-ratio-expected.txt	2016-06-10 03:31:00 UTC (rev 201904)
@@ -0,0 +1 @@
+The user interface scale factor is 3.

Added: trunk/LayoutTests/fast/hidpi/hidpi-3x-device-pixel-ratio.html (0 => 201904)


--- trunk/LayoutTests/fast/hidpi/hidpi-3x-device-pixel-ratio.html	                        (rev 0)
+++ trunk/LayoutTests/fast/hidpi/hidpi-3x-device-pixel-ratio.html	2016-06-10 03:31:00 UTC (rev 201904)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that 3x device scale ratio is enabled.</title>
+</head>
+<body>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+    document.write("The user interface scale factor is " + window.devicePixelRatio + ".");
+</script>
+</body>
+</html>

Modified: trunk/Tools/ChangeLog (201903 => 201904)


--- trunk/Tools/ChangeLog	2016-06-10 03:20:01 UTC (rev 201903)
+++ trunk/Tools/ChangeLog	2016-06-10 03:31:00 UTC (rev 201904)
@@ -1,3 +1,22 @@
+2016-06-09  Zalan Bujtas  <[email protected]>
+
+        Add testing support for 3x device scale factor.
+        https://bugs.webkit.org/show_bug.cgi?id=158597
+
+        Reviewed by Simon Fraser.
+
+        Set 3x device scale factor on the test canvas when the test url is prefixed with hidpi-3x-. 
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (changeWindowScaleIfNeeded):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::updateWindowScaleForTest):
+        * WebKitTestRunner/TestOptions.cpp:
+        (WTR::deviceScaleFactorForTest):
+        (WTR::TestOptions::TestOptions):
+        (WTR::isHiDPITestPath): Deleted.
+        * WebKitTestRunner/TestOptions.h:
+
 2016-06-09  Michael Catanzaro  <[email protected]>
 
         Add comments to clarify feature enablement

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (201903 => 201904)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2016-06-10 03:20:01 UTC (rev 201903)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2016-06-10 03:31:00 UTC (rev 201904)
@@ -1621,16 +1621,18 @@
 #if !PLATFORM(IOS)
 static void changeWindowScaleIfNeeded(const char* testPathOrUR)
 {
-    bool hasHighDPIWindow = [[[mainFrame webView] window] backingScaleFactor] != 1;
     WTF::String localPathOrUrl = String(testPathOrUR);
-    bool needsHighDPIWindow = localPathOrUrl.findIgnoringCase("/hidpi-") != notFound;
-    if (hasHighDPIWindow == needsHighDPIWindow)
+    float currentScaleFactor = [[[mainFrame webView] window] backingScaleFactor];
+    float requiredScaleFactor = 1;
+    if (localPathOrUrl.findIgnoringCase("/hidpi-3x-") != notFound)
+        requiredScaleFactor = 3;
+    else if (localPathOrUrl.findIgnoringCase("/hidpi-") != notFound)
+        requiredScaleFactor = 2;
+    if (currentScaleFactor == requiredScaleFactor)
         return;
-
-    CGFloat newScaleFactor = needsHighDPIWindow ? 2 : 1;
     // 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(newScaleFactor);
-    [[[mainFrame webView] window] _setWindowResolution:newScaleFactor displayIfChanged:YES];
+    gTestRunner->setBackingScaleFactor(requiredScaleFactor);
+    [[[mainFrame webView] window] _setWindowResolution:requiredScaleFactor displayIfChanged:YES];
 }
 #endif
 

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (201903 => 201904)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2016-06-10 03:20:01 UTC (rev 201903)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2016-06-10 03:31:00 UTC (rev 201904)
@@ -990,7 +990,7 @@
 
 void TestController::updateWindowScaleForTest(PlatformWebView* view, const TestInvocation& test)
 {
-    view->changeWindowScaleIfNeeded(test.options().isHiDPITest ? 2 : 1);
+    view->changeWindowScaleIfNeeded(test.options().deviceScaleFactor);
 }
 
 void TestController::configureViewForTest(const TestInvocation& test)

Modified: trunk/Tools/WebKitTestRunner/TestOptions.cpp (201903 => 201904)


--- trunk/Tools/WebKitTestRunner/TestOptions.cpp	2016-06-10 03:20:01 UTC (rev 201903)
+++ trunk/Tools/WebKitTestRunner/TestOptions.cpp	2016-06-10 03:31:00 UTC (rev 201904)
@@ -56,16 +56,20 @@
     return pathContains(pathOrURL, "svg/W3C-SVG-1.1") || pathContains(pathOrURL, "svg\\W3C-SVG-1.1");
 }
 
-static bool isHiDPITestPath(const std::string& pathOrURL)
+static float deviceScaleFactorForTest(const std::string& pathOrURL)
 {
-    return pathContains(pathOrURL, "/hidpi-");
+    if (pathContains(pathOrURL, "/hidpi-3x-"))
+        return 3;
+    if (pathContains(pathOrURL, "/hidpi-"))
+        return 2;
+    return 1;
 }
 
 TestOptions::TestOptions(const std::string& pathOrURL)
     : useFlexibleViewport(shouldMakeViewportFlexible(pathOrURL))
     , useFixedLayout(shouldUseFixedLayout(pathOrURL))
     , isSVGTest(isSVGTestPath(pathOrURL))
-    , isHiDPITest(isHiDPITestPath(pathOrURL))
+    , deviceScaleFactor(deviceScaleFactorForTest(pathOrURL))
 {
 }
 

Modified: trunk/Tools/WebKitTestRunner/TestOptions.h (201903 => 201904)


--- trunk/Tools/WebKitTestRunner/TestOptions.h	2016-06-10 03:20:01 UTC (rev 201903)
+++ trunk/Tools/WebKitTestRunner/TestOptions.h	2016-06-10 03:31:00 UTC (rev 201904)
@@ -38,11 +38,11 @@
     bool useFlexibleViewport { false };
     bool useFixedLayout { false };
     bool isSVGTest { false };
-    bool isHiDPITest { false };
     bool useDataDetection { false };
     bool useMockScrollbars { true };
     bool needsSiteSpecificQuirks { false };
 
+    float deviceScaleFactor { 1 };
     Vector<String> overrideLanguages;
     
     TestOptions(const std::string& pathOrURL);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to