DumpRenderTree generates white snapshots on some platforms
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Apr 2014 22:44:51 +0000 (22:44 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Apr 2014 22:44:51 +0000 (22:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132026
<rdar://problem/16679363>

Reviewed by Simon Fraser.

* DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig:
Link DRT against QuartzCore.

* DumpRenderTree/mac/PixelDumpSupportMac.mm:
(createBitmapContextFromWebView):
Force CoreAnimation to synchronously update layers in a more explicit
way that doesn't depend on AppKit behavior. This is very similar to what
WebKitTestRunner does (indirectly) during its force repaint.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167687 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig
Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm

index 5aca8c9914aa362fe03f042cc32d9e5cfd216125..4293b336e3159cd466923d97dfa4369d049e419c 100644 (file)
@@ -1,3 +1,20 @@
+2014-04-22  Tim Horton  <timothy_horton@apple.com>
+
+        DumpRenderTree generates white snapshots on some platforms
+        https://bugs.webkit.org/show_bug.cgi?id=132026
+        <rdar://problem/16679363>
+
+        Reviewed by Simon Fraser.
+
+        * DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig:
+        Link DRT against QuartzCore.
+
+        * DumpRenderTree/mac/PixelDumpSupportMac.mm:
+        (createBitmapContextFromWebView):
+        Force CoreAnimation to synchronously update layers in a more explicit
+        way that doesn't depend on AppKit behavior. This is very similar to what
+        WebKitTestRunner does (indirectly) during its force repaint.
+
 2014-04-22  Brent Fulgham  <bfulgham@apple.com>
 
         [Win] Support Python 2.7 in Cygwin
index 867537584d8762c3fd8939de0e72636e074ee101..9ab17c48d7bbdaefefb392c323726e1445b8d0cb 100644 (file)
@@ -24,7 +24,7 @@
 #include "BaseTarget.xcconfig"
 
 OTHER_LDFLAGS = $(inherited) $(OTHER_LDFLAGS_$(PLATFORM_NAME));
-OTHER_LDFLAGS_macosx = -l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY) -lWebCoreTestSupport -force_load $(BUILT_PRODUCTS_DIR)/libDumpRenderTree.a -framework Carbon -framework Cocoa -framework JavaScriptCore -framework OpenGL -framework WebKit;
+OTHER_LDFLAGS_macosx = -l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY) -lWebCoreTestSupport -force_load $(BUILT_PRODUCTS_DIR)/libDumpRenderTree.a -framework Carbon -framework Cocoa -framework JavaScriptCore -framework OpenGL -framework QuartzCore -framework WebKit;
 LD_RUNPATH_SEARCH_PATHS = "@loader_path/.";
 PRODUCT_NAME = DumpRenderTree;
 EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_SOURCE_FILE_NAMES_$(PLATFORM_NAME));
index 5bb913c2a35365fa38ad02001cfc8f89021e2dd1..2addada24bbd68083c9250368802c420b5fda0d5 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
-#include "PixelDumpSupport.h"
-#include "PixelDumpSupportCG.h"
+#import "config.h"
+#import "PixelDumpSupport.h"
+#import "PixelDumpSupportCG.h"
 
-#include "DumpRenderTree.h" 
-#include "TestRunner.h"
-#include <CoreGraphics/CGBitmapContext.h>
-#include <wtf/Assertions.h>
-#include <wtf/RefPtr.h>
+#import "DumpRenderTree.h" 
+#import "TestRunner.h"
+#import <CoreGraphics/CGBitmapContext.h>
+#import <QuartzCore/QuartzCore.h>
+#import <wtf/Assertions.h>
+#import <wtf/RefPtr.h>
 
 #import <WebKit/WebCoreStatistics.h>
 #import <WebKit/WebDocumentPrivate.h>
 #import <WebKit/WebKit.h>
 #import <WebKit/WebViewPrivate.h>
 
+@interface CATransaction (Details)
++ (void)synchronize;
+@end
+
 static PassRefPtr<BitmapContext> createBitmapContext(size_t pixelsWide, size_t pixelsHigh, size_t& rowBytes, void*& buffer)
 {
     rowBytes = (4 * pixelsWide + 63) & ~63; // Use a multiple of 64 bytes to improve CG performance
@@ -129,12 +134,11 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool inc
         }
     } else {
       if (onscreen) {
-            // displayIfNeeded does not update the CA layers if the layer-hosting view was not marked as needing display, so
-            // we're at the mercy of CA's display-link callback to update layers in time. So we need to force a display of the view
-            // to get AppKit to update the CA layers synchronously.
-            // FIXME: this will break repaint testing if we have compositing in repaint tests
+            // FIXME: This will break repaint testing if we have compositing in repaint tests.
             // (displayWebView() painted gray over the webview, but we'll be making everything repaint again).
             [view display];
+            [CATransaction flush];
+            [CATransaction synchronize];
 
             // Ask the window server to provide us a composited version of the *real* window content including surfaces (i.e. OpenGL content)
             // Note that the returned image might differ very slightly from the window backing because of dithering artifacts in the window server compositor.