diff options
author | Ben Murdoch <benm@google.com> | 2009-08-11 17:01:47 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2009-08-11 18:21:02 +0100 |
commit | 0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 (patch) | |
tree | 2943df35f62d885c89d01063cc528dd73b480fea /WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm | |
parent | 7e7a70bfa49a1122b2597a1e6367d89eb4035eca (diff) | |
download | external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.zip external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.gz external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.bz2 |
Merge in WebKit r47029.
Diffstat (limited to 'WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm')
-rw-r--r-- | WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm b/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm index d17c111..0059b69 100644 --- a/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm +++ b/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm @@ -28,16 +28,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "DumpRenderTree.h" +#include "config.h" #include "PixelDumpSupport.h" #include "PixelDumpSupportCG.h" +#include "DumpRenderTree.h" #include "LayoutTestController.h" #include <CoreGraphics/CGBitmapContext.h> -#ifndef BUILDING_ON_LEOPARD -#include <OpenGL/OpenGL.h> -#include <OpenGL/CGLMacro.h> -#endif #include <wtf/Assertions.h> #include <wtf/RefPtr.h> @@ -46,6 +43,11 @@ #import <WebKit/WebKit.h> #import <WebKit/WebViewPrivate.h> +#if defined(BUILDING_ON_TIGER) +#include <OpenGL/OpenGL.h> +#include <OpenGL/CGLMacro.h> +#endif + // To ensure pixel tests consistency, we need to always render in the same colorspace. // Unfortunately, because of AppKit / WebKit constraints, we can't render directly in the colorspace of our choice. // This implies we have to temporarily change the profile of the main display to the colorspace we want to render into. @@ -153,11 +155,18 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool inc [view displayRectIgnoringOpacity:line inContext:nsContext]; } } else { + if (onscreen) { -#ifdef BUILDING_ON_LEOPARD +#if !defined(BUILDING_ON_TIGER) + // 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 + // (displayWebView() painted gray over the webview, but we'll be making everything repaint again). + [view display]; + // 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 - CGImageRef image = CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, [[view window] windowNumber], kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque); CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image)), image); CGImageRelease(image); @@ -216,10 +225,11 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool inc [window setLevel:oldLevel]; #endif } else { + // Make sure the view has been painted. + [view displayIfNeeded]; + // Grab directly the contents of the window backing buffer (this ignores any surfaces on the window) // FIXME: This path is suboptimal: data is read from window backing store, converted to RGB8 then drawn again into an RGBA8 bitmap - - [view displayIfNeeded]; [view lockFocus]; NSBitmapImageRep *imageRep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:[view frame]] autorelease]; [view unlockFocus]; |