Changeset 201904 in webkit


Ignore:
Timestamp:
Jun 9, 2016 8:31:00 PM (8 years ago)
Author:
Alan Bujtas
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.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r201902 r201904  
     12016-06-09  Zalan Bujtas  <zalan@apple.com>
     2
     3        Add testing support for 3x device scale factor.
     4        https://bugs.webkit.org/show_bug.cgi?id=158597
     5
     6        Reviewed by Simon Fraser.
     7
     8        Set 3x device scale factor on the test canvas when the test url is prefixed with hidpi-3x-.
     9
     10        * fast/hidpi/hidpi-3x-device-pixel-ratio-expected.txt: Added.
     11        * fast/hidpi/hidpi-3x-device-pixel-ratio.html: Added.
     12
    1132016-06-09  Ryosuke Niwa  <rniwa@webkit.org>
    214
  • trunk/Tools/ChangeLog

    r201879 r201904  
     12016-06-09  Zalan Bujtas  <zalan@apple.com>
     2
     3        Add testing support for 3x device scale factor.
     4        https://bugs.webkit.org/show_bug.cgi?id=158597
     5
     6        Reviewed by Simon Fraser.
     7
     8        Set 3x device scale factor on the test canvas when the test url is prefixed with hidpi-3x-.
     9
     10        * DumpRenderTree/mac/DumpRenderTree.mm:
     11        (changeWindowScaleIfNeeded):
     12        * WebKitTestRunner/TestController.cpp:
     13        (WTR::TestController::updateWindowScaleForTest):
     14        * WebKitTestRunner/TestOptions.cpp:
     15        (WTR::deviceScaleFactorForTest):
     16        (WTR::TestOptions::TestOptions):
     17        (WTR::isHiDPITestPath): Deleted.
     18        * WebKitTestRunner/TestOptions.h:
     19
    1202016-06-09  Michael Catanzaro  <mcatanzaro@igalia.com>
    221
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r201863 r201904  
    16221622static void changeWindowScaleIfNeeded(const char* testPathOrUR)
    16231623{
    1624     bool hasHighDPIWindow = [[[mainFrame webView] window] backingScaleFactor] != 1;
    16251624    WTF::String localPathOrUrl = String(testPathOrUR);
    1626     bool needsHighDPIWindow = localPathOrUrl.findIgnoringCase("/hidpi-") != notFound;
    1627     if (hasHighDPIWindow == needsHighDPIWindow)
     1625    float currentScaleFactor = [[[mainFrame webView] window] backingScaleFactor];
     1626    float requiredScaleFactor = 1;
     1627    if (localPathOrUrl.findIgnoringCase("/hidpi-3x-") != notFound)
     1628        requiredScaleFactor = 3;
     1629    else if (localPathOrUrl.findIgnoringCase("/hidpi-") != notFound)
     1630        requiredScaleFactor = 2;
     1631    if (currentScaleFactor == requiredScaleFactor)
    16281632        return;
    1629 
    1630     CGFloat newScaleFactor = needsHighDPIWindow ? 2 : 1;
    16311633    // 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.
    1632     gTestRunner->setBackingScaleFactor(newScaleFactor);
    1633     [[[mainFrame webView] window] _setWindowResolution:newScaleFactor displayIfChanged:YES];
     1634    gTestRunner->setBackingScaleFactor(requiredScaleFactor);
     1635    [[[mainFrame webView] window] _setWindowResolution:requiredScaleFactor displayIfChanged:YES];
    16341636}
    16351637#endif
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r201464 r201904  
    991991void TestController::updateWindowScaleForTest(PlatformWebView* view, const TestInvocation& test)
    992992{
    993     view->changeWindowScaleIfNeeded(test.options().isHiDPITest ? 2 : 1);
     993    view->changeWindowScaleIfNeeded(test.options().deviceScaleFactor);
    994994}
    995995
  • trunk/Tools/WebKitTestRunner/TestOptions.cpp

    r190335 r201904  
    5757}
    5858
    59 static bool isHiDPITestPath(const std::string& pathOrURL)
     59static float deviceScaleFactorForTest(const std::string& pathOrURL)
    6060{
    61     return pathContains(pathOrURL, "/hidpi-");
     61    if (pathContains(pathOrURL, "/hidpi-3x-"))
     62        return 3;
     63    if (pathContains(pathOrURL, "/hidpi-"))
     64        return 2;
     65    return 1;
    6266}
    6367
     
    6670    , useFixedLayout(shouldUseFixedLayout(pathOrURL))
    6771    , isSVGTest(isSVGTestPath(pathOrURL))
    68     , isHiDPITest(isHiDPITestPath(pathOrURL))
     72    , deviceScaleFactor(deviceScaleFactorForTest(pathOrURL))
    6973{
    7074}
  • trunk/Tools/WebKitTestRunner/TestOptions.h

    r200423 r201904  
    3939    bool useFixedLayout { false };
    4040    bool isSVGTest { false };
    41     bool isHiDPITest { false };
    4241    bool useDataDetection { false };
    4342    bool useMockScrollbars { true };
    4443    bool needsSiteSpecificQuirks { false };
    4544
     45    float deviceScaleFactor { 1 };
    4646    Vector<String> overrideLanguages;
    4747   
Note: See TracChangeset for help on using the changeset viewer.