Skip to content
  • bdakin@apple.com's avatar
    https://bugs.webkit.org/show_bug.cgi?id=70050 · 758dc7c2
    bdakin@apple.com authored
    DRT and WRT should have HiDPI testing capabilities
    
    Reviewed by Darin Adler.
    
    Source/WebKit/mac: 
    
    New method _backingScaleFactor matches SPI of a similar name that I added 
    recently to WKPage in WebKit2. Equivalent functionality is needed for 
    DumpRenderTree's HiDPI support.
    * WebView/WebView.mm:
    (-[WebView _backingScaleFactor]):
    * WebView/WebViewPrivate.h:
    
    Tools: 
    
    New layoutTestController function setBackingScaleFactor takes a double for a scale 
    factor and a callback function to call once the backing scale factor has 
    successfully been set for the view.
    * DumpRenderTree/LayoutTestController.cpp:
    (setBackingScaleFactorCallback):
    (LayoutTestController::staticFunctions):
    
    On Mac, setBackingScaleFactor calls WebView _setCustomBackingScaleFactor. Other 
    platforms do nothing.
    * DumpRenderTree/LayoutTestController.h:
    * DumpRenderTree/mac/LayoutTestControllerMac.mm:
    (LayoutTestController::setBackingScaleFactor):
    * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
    (LayoutTestController::setBackingScaleFactor):
    * DumpRenderTree/win/LayoutTestControllerWin.cpp:
    (LayoutTestController::setBackingScaleFactor):
    
    Reset the backing scale factor by calling _setCutsomBackingScaleFactor with a 
    value of 0, which resets to the system default.
    * DumpRenderTree/mac/DumpRenderTree.mm:
    (resetWebViewToConsistentStateBeforeTesting):
    
    When generating the pixel dump, create a Bitmap of the appropriate size based on 
    the backing scale factor. If it is a HiDPI view, paint into the context using 
    displayRectIgnoringOpacity.
    * DumpRenderTree/mac/PixelDumpSupportMac.mm:
    (createBitmapContextFromWebView):
    
    And now the same stuff for WK2. Again, new layoutTestController function 
    setBackingScaleFactor takes a double for a scale factor and a callback function. 
    * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
    * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
    (WTR::LayoutTestController::setBackingScaleFactor):
    (WTR::LayoutTestController::callSetBackingScaleFactorCallback):
    * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
    
    The InjectedBundle sends a message to the UI process to set the backing scale 
    factor. It also processes a message the UI process will send back once it 
    completes this task, and at that time, the InjectedBundle calls the callback.
    * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
    (WTR::InjectedBundle::didReceiveMessage):
    (WTR::InjectedBundle::postSetBackingScaleFactor):
    * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
    
    Again, reset the backing scale factor by calling WKPageSetCustomBackingScaleFactor 
    with a value of 0, which resets to the system default.
    * WebKitTestRunner/TestController.cpp:
    (WTR::TestController::resetStateToConsistentValues):
    
    Upon receiving the SetBackingScaleFactor message, call 
    WKPageSetCustomBackingScaleFactor to the given scale factor, and post a message 
    back to InjectedBundle to say it has been done.
    * WebKitTestRunner/TestInvocation.cpp:
    (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
            
    Don't use window snapshotting for the HiDPI tests. We don't have a way to fake a 
    window's scale factor so we have to avoid that.
    * WebKitTestRunner/cg/TestInvocationCG.cpp:
    (WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
    
    LayoutTests: 
    
    New HiDPI tests and results. These should be skipped on all non-Lion platforms.
    * fast/hidpi: Added.
    * fast/hidpi/broken-image-icon-hidpi.html: Added.
    * fast/hidpi/broken-image-with-size-hidpi.html: Added.
    * fast/hidpi/clip-text-in-hidpi.html: Added.
    * fast/hidpi/resize-corner-hidpi.html: Added.
    * fast/hidpi/video-controls-in-hidpi.html: Added.
    * platform/gtk-wk2/Skipped:
    * platform/gtk/Skipped:
    * platform/mac-leopard/Skipped:
    * platform/mac-snowleopard/Skipped:
    * platform/mac/fast/hidpi: Added.
    * platform/mac/fast/hidpi/broken-image-icon-hidpi-expected.png: Added.
    * platform/mac/fast/hidpi/broken-image-icon-hidpi-expected.txt: Added.
    * platform/mac/fast/hidpi/broken-image-with-size-hidpi-expected.png: Added.
    * platform/mac/fast/hidpi/broken-image-with-size-hidpi-expected.txt: Added.
    * platform/mac/fast/hidpi/clip-text-in-hidpi-expected.png: Added.
    * platform/mac/fast/hidpi/clip-text-in-hidpi-expected.txt: Added.
    * platform/mac/fast/hidpi/resize-corner-hidpi-expected.png: Added.
    * platform/mac/fast/hidpi/resize-corner-hidpi-expected.txt: Added.
    * platform/mac/fast/hidpi/video-controls-in-hidpi-expected.png: Added.
    * platform/mac/fast/hidpi/video-controls-in-hidpi-expected.txt: Added.
    * platform/qt-mac/Skipped:
    * platform/qt-wk2/Skipped:
    * platform/qt/Skipped:
    * platform/win-wk2/Skipped:
    * platform/win/Skipped:
    * platform/wincairo/Skipped:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@97407 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    758dc7c2