Title: [202532] trunk
Revision
202532
Author
[email protected]
Date
2016-06-27 18:44:41 -0700 (Mon, 27 Jun 2016)

Log 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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (202531 => 202532)


--- trunk/LayoutTests/ChangeLog	2016-06-28 01:13:53 UTC (rev 202531)
+++ trunk/LayoutTests/ChangeLog	2016-06-28 01:44:41 UTC (rev 202532)
@@ -1,3 +1,14 @@
+2016-06-27  Simon Fraser  <[email protected]>
+
+        [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.
+
+        fast/harness/snapshot-captures-compositing.html passes now.
+
+        * platform/ios-simulator-wk2/TestExpectations:
+
 2016-06-27  Benjamin Poulain  <[email protected]>
 
         Adopt the iOS TouchEventHandler API for cases that must have synchronous dispatch

Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (202531 => 202532)


--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-06-28 01:13:53 UTC (rev 202531)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-06-28 01:44:41 UTC (rev 202532)
@@ -1899,5 +1899,3 @@
 webkit.org/b/157589 fast/text-autosizing/ios/text-autosizing-after-back.html [ Pass Timeout ]
 
 webkit.org/b/157990 [ Release ] mathml/wbr-in-mroot-crash.html [ Pass Timeout ]
-
-webkit.org/b/159077 fast/harness/snapshot-captures-compositing.html [ ImageOnlyFailure ]

Modified: trunk/Source/WebKit2/ChangeLog (202531 => 202532)


--- trunk/Source/WebKit2/ChangeLog	2016-06-28 01:13:53 UTC (rev 202531)
+++ trunk/Source/WebKit2/ChangeLog	2016-06-28 01:44:41 UTC (rev 202532)
@@ -1,3 +1,16 @@
+2016-06-27  Simon Fraser  <[email protected]>
+
+        [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.
+
+        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):
+
 2016-06-27  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: When modifying sessionStorage, localStorage gets updated

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (202531 => 202532)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-06-28 01:13:53 UTC (rev 202531)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-06-28 01:44:41 UTC (rev 202532)
@@ -2888,8 +2888,18 @@
         return;
     }
 
-    uint64_t callbackID = callback->callbackID();
-    m_callbacks.put(callback);
+    std::function<void (CallbackBase::Error)> didForceRepaintCallback = [this, callback](CallbackBase::Error error) {
+        callAfterNextPresentationUpdate([callback](CallbackBase::Error error) {
+            if (error != CallbackBase::Error::None) {
+                callback->invalidate(error);
+                return;
+            }
+
+            callback->performCallback();
+        });
+    };
+
+    uint64_t callbackID = m_callbacks.put(didForceRepaintCallback, m_process->throttler().backgroundActivityToken());
     m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
     m_process->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID); 
 }

Modified: trunk/Tools/ChangeLog (202531 => 202532)


--- trunk/Tools/ChangeLog	2016-06-28 01:13:53 UTC (rev 202531)
+++ trunk/Tools/ChangeLog	2016-06-28 01:44:41 UTC (rev 202532)
@@ -1,3 +1,29 @@
+2016-06-27  Simon Fraser  <[email protected]>
+
+        [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.
+
+        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):
+
 2016-06-27  Gyuyoung Kim  <[email protected]>
 
         [EFL] Support to build on Debian linux

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (202531 => 202532)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2016-06-28 01:13:53 UTC (rev 202531)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2016-06-28 01:44:41 UTC (rev 202532)
@@ -895,12 +895,7 @@
         injectedBundle.dumpBackForwardListsForAllPages(stringBuilder);
 
     if (injectedBundle.shouldDumpPixels() && injectedBundle.testRunner()->shouldDumpPixels()) {
-#if PLATFORM(IOS)
-        // PlatformWebView::windowSnapshotImage() has timing problems, so use WebProcess snapshots for now.
-        bool shouldCreateSnapshot = true;
-#else
         bool shouldCreateSnapshot = injectedBundle.testRunner()->isPrinting();
-#endif
         if (shouldCreateSnapshot) {
             WKSnapshotOptions options = kWKSnapshotOptionsShareable;
             WKRect snapshotRect = WKBundleFrameGetVisibleContentBounds(WKBundlePageGetMainFrame(m_page));

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (202531 => 202532)


--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2016-06-28 01:13:53 UTC (rev 202531)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2016-06-28 01:44:41 UTC (rev 202532)
@@ -248,8 +248,8 @@
                 m_webProcessIsUnresponsive = true;
                 return;
             }
+
             WKRetainPtr<WKImageRef> windowSnapshot = TestController::singleton().mainWebView()->windowSnapshotImage();
-            ASSERT(windowSnapshot);
             dumpPixelsAndCompareWithExpected(windowSnapshot.get(), m_repaintRects.get(), TestInvocation::SnapshotResultType::WebView);
         }
     }

Modified: trunk/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp (202531 => 202532)


--- trunk/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp	2016-06-28 01:13:53 UTC (rev 202531)
+++ trunk/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp	2016-06-28 01:44:41 UTC (rev 202532)
@@ -57,15 +57,19 @@
     // Creating this bitmap in the device color space should prevent any color conversion when the image of the web view is drawn into it.
     RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
     CGContextRef context = CGBitmapContextCreate(0, pixelsWide, pixelsHigh, 8, rowBytes, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host);
+    if (!context)
+        return nullptr;
 
-    
     CGContextDrawImage(context, CGRectMake(0, 0, pixelsWide, pixelsHigh), image.get());
-
     return context;
 }
 
 void computeMD5HashStringForContext(CGContextRef bitmapContext, char hashString[33])
 {
+    if (!bitmapContext) {
+        WTFLogAlways("computeMD5HashStringForContext: context is null\n");
+        return;
+    }
     ASSERT(CGBitmapContextGetBitsPerPixel(bitmapContext) == 32); // ImageDiff assumes 32 bit RGBA, we must as well.
     size_t pixelsHigh = CGBitmapContextGetHeight(bitmapContext);
     size_t pixelsWide = CGBitmapContextGetWidth(bitmapContext);
@@ -144,7 +148,16 @@
 
 void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef image, WKArrayRef repaintRects, SnapshotResultType snapshotType)
 {
+    if (!image) {
+        WTFLogAlways("dumpPixelsAndCompareWithExpected: image is null\n");
+        return;
+    }
+
     RetainPtr<CGContextRef> context = adoptCF(createCGContextFromImage(image));
+    if (!context) {
+        WTFLogAlways("dumpPixelsAndCompareWithExpected: context is null\n");
+        return;
+    }
 
     // A non-null repaintRects array means we're doing a repaint test.
     if (repaintRects)

Modified: trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm (202531 => 202532)


--- trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm	2016-06-28 01:13:53 UTC (rev 202531)
+++ trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm	2016-06-28 01:44:41 UTC (rev 202532)
@@ -212,6 +212,10 @@
     CGSize viewSize = m_view.bounds.size;
     int bufferWidth = ceil(viewSize.width * deviceScaleFactor);
     int bufferHeight = ceil(viewSize.height * deviceScaleFactor);
+    if (!bufferWidth || !bufferHeight) {
+        WTFLogAlways("Being asked for snapshot of view with width %d height %d\n", bufferWidth, bufferHeight);
+        return nullptr;
+    }
 
     CARenderServerBufferRef buffer = CARenderServerCreateBuffer(bufferWidth, bufferHeight);
     if (!buffer) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to