Changeset 202532 in webkit


Ignore:
Timestamp:
Jun 27, 2016 6:44:41 PM (8 years ago)
Author:
Simon Fraser
Message:

[iOS] Make DumpRenderTree and WebKitTestRunner in the simulator use render server snapshotting
https://bugs.webkit.org/show_bug.cgi?id=159077

Reviewed by Tim Horton.

Source/WebKit2:

Fix WebPageProxy::forceRepaint() to correctly wait for the next commit from the web process,
which is necessary for UI-side compositing.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::forceRepaint):

Tools:

Re-enable render server snapshotting for iOS WTR via the change in InjectedBundlePage.cpp.

Fix WebPageProxy::forceRepaint() to correctly wait for the next commit from the web process,
which is necessary for UI-side compositing.

Add some null checks to fix issues when the WKWebView gets resized to be empty, which
seems to happen for some tests that call window.resizeTo().

  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:

(WTR::InjectedBundlePage::dump): Deleted.

  • WebKitTestRunner/TestInvocation.cpp:

(WTR::TestInvocation::dumpResults):

  • WebKitTestRunner/cg/TestInvocationCG.cpp:

(WTR::createCGContextFromImage):
(WTR::computeMD5HashStringForContext):
(WTR::TestInvocation::dumpPixelsAndCompareWithExpected):

  • WebKitTestRunner/ios/PlatformWebViewIOS.mm:

(WTR::PlatformWebView::windowSnapshotImage):

LayoutTests:

fast/harness/snapshot-captures-compositing.html passes now.

  • platform/ios-simulator-wk2/TestExpectations:
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202531 r202532  
     12016-06-27  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS] Make DumpRenderTree and WebKitTestRunner in the simulator use render server snapshotting
     4        https://bugs.webkit.org/show_bug.cgi?id=159077
     5
     6        Reviewed by Tim Horton.
     7
     8        fast/harness/snapshot-captures-compositing.html passes now.
     9
     10        * platform/ios-simulator-wk2/TestExpectations:
     11
    1122016-06-27  Benjamin Poulain  <benjamin@webkit.org>
    213
  • trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations

    r202525 r202532  
    19001900
    19011901webkit.org/b/157990 [ Release ] mathml/wbr-in-mroot-crash.html [ Pass Timeout ]
    1902 
    1903 webkit.org/b/159077 fast/harness/snapshot-captures-compositing.html [ ImageOnlyFailure ]
  • trunk/Source/WebKit2/ChangeLog

    r202529 r202532  
     12016-06-27  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS] Make DumpRenderTree and WebKitTestRunner in the simulator use render server snapshotting
     4        https://bugs.webkit.org/show_bug.cgi?id=159077
     5
     6        Reviewed by Tim Horton.
     7
     8        Fix WebPageProxy::forceRepaint() to correctly wait for the next commit from the web process,
     9        which is necessary for UI-side compositing.
     10
     11        * UIProcess/WebPageProxy.cpp:
     12        (WebKit::WebPageProxy::forceRepaint):
     13
    1142016-06-27  Joseph Pecoraro  <pecoraro@apple.com>
    215
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r202511 r202532  
    28892889    }
    28902890
    2891     uint64_t callbackID = callback->callbackID();
    2892     m_callbacks.put(callback);
     2891    std::function<void (CallbackBase::Error)> didForceRepaintCallback = [this, callback](CallbackBase::Error error) {
     2892        callAfterNextPresentationUpdate([callback](CallbackBase::Error error) {
     2893            if (error != CallbackBase::Error::None) {
     2894                callback->invalidate(error);
     2895                return;
     2896            }
     2897
     2898            callback->performCallback();
     2899        });
     2900    };
     2901
     2902    uint64_t callbackID = m_callbacks.put(didForceRepaintCallback, m_process->throttler().backgroundActivityToken());
    28932903    m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
    28942904    m_process->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID);
  • trunk/Tools/ChangeLog

    r202523 r202532  
     12016-06-27  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS] Make DumpRenderTree and WebKitTestRunner in the simulator use render server snapshotting
     4        https://bugs.webkit.org/show_bug.cgi?id=159077
     5
     6        Reviewed by Tim Horton.
     7
     8        Re-enable render server snapshotting for iOS WTR via the change in InjectedBundlePage.cpp.
     9
     10        Fix WebPageProxy::forceRepaint() to correctly wait for the next commit from the web process,
     11        which is necessary for UI-side compositing.
     12
     13        Add some null checks to fix issues when the WKWebView gets resized to be empty, which
     14        seems to happen for some tests that call window.resizeTo().
     15
     16        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     17        (WTR::InjectedBundlePage::dump): Deleted.
     18        * WebKitTestRunner/TestInvocation.cpp:
     19        (WTR::TestInvocation::dumpResults):
     20        * WebKitTestRunner/cg/TestInvocationCG.cpp:
     21        (WTR::createCGContextFromImage):
     22        (WTR::computeMD5HashStringForContext):
     23        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
     24        * WebKitTestRunner/ios/PlatformWebViewIOS.mm:
     25        (WTR::PlatformWebView::windowSnapshotImage):
     26
    1272016-06-27  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
    228
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r202412 r202532  
    896896
    897897    if (injectedBundle.shouldDumpPixels() && injectedBundle.testRunner()->shouldDumpPixels()) {
    898 #if PLATFORM(IOS)
    899         // PlatformWebView::windowSnapshotImage() has timing problems, so use WebProcess snapshots for now.
    900         bool shouldCreateSnapshot = true;
    901 #else
    902898        bool shouldCreateSnapshot = injectedBundle.testRunner()->isPrinting();
    903 #endif
    904899        if (shouldCreateSnapshot) {
    905900            WKSnapshotOptions options = kWKSnapshotOptionsShareable;
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r202511 r202532  
    249249                return;
    250250            }
     251
    251252            WKRetainPtr<WKImageRef> windowSnapshot = TestController::singleton().mainWebView()->windowSnapshotImage();
    252             ASSERT(windowSnapshot);
    253253            dumpPixelsAndCompareWithExpected(windowSnapshot.get(), m_repaintRects.get(), TestInvocation::SnapshotResultType::WebView);
    254254        }
  • trunk/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp

    r198242 r202532  
    5858    RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
    5959    CGContextRef context = CGBitmapContextCreate(0, pixelsWide, pixelsHigh, 8, rowBytes, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host);
     60    if (!context)
     61        return nullptr;
    6062
    61    
    6263    CGContextDrawImage(context, CGRectMake(0, 0, pixelsWide, pixelsHigh), image.get());
    63 
    6464    return context;
    6565}
     
    6767void computeMD5HashStringForContext(CGContextRef bitmapContext, char hashString[33])
    6868{
     69    if (!bitmapContext) {
     70        WTFLogAlways("computeMD5HashStringForContext: context is null\n");
     71        return;
     72    }
    6973    ASSERT(CGBitmapContextGetBitsPerPixel(bitmapContext) == 32); // ImageDiff assumes 32 bit RGBA, we must as well.
    7074    size_t pixelsHigh = CGBitmapContextGetHeight(bitmapContext);
     
    145149void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef image, WKArrayRef repaintRects, SnapshotResultType snapshotType)
    146150{
     151    if (!image) {
     152        WTFLogAlways("dumpPixelsAndCompareWithExpected: image is null\n");
     153        return;
     154    }
     155
    147156    RetainPtr<CGContextRef> context = adoptCF(createCGContextFromImage(image));
     157    if (!context) {
     158        WTFLogAlways("dumpPixelsAndCompareWithExpected: context is null\n");
     159        return;
     160    }
    148161
    149162    // A non-null repaintRects array means we're doing a repaint test.
  • trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm

    r202411 r202532  
    213213    int bufferWidth = ceil(viewSize.width * deviceScaleFactor);
    214214    int bufferHeight = ceil(viewSize.height * deviceScaleFactor);
     215    if (!bufferWidth || !bufferHeight) {
     216        WTFLogAlways("Being asked for snapshot of view with width %d height %d\n", bufferWidth, bufferHeight);
     217        return nullptr;
     218    }
    215219
    216220    CARenderServerBufferRef buffer = CARenderServerCreateBuffer(bufferWidth, bufferHeight);
Note: See TracChangeset for help on using the changeset viewer.