summaryrefslogtreecommitdiff
path: root/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm')
-rw-r--r--Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm42
1 files changed, 40 insertions, 2 deletions
diff --git a/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm b/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm
index db5d1197c..4c7b15f58 100644
--- a/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm
+++ b/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm
@@ -25,6 +25,7 @@
#include "config.h"
#include "PlatformWebView.h"
+#include "TestController.h"
#import <WebKit2/WKImageCG.h>
#import <WebKit2/WKViewPrivate.h>
@@ -37,6 +38,32 @@
@property (nonatomic, assign) WTR::PlatformWebView* platformWebView;
@end
+@interface TestRunnerWKView : WKView {
+ BOOL _useTiledDrawing;
+}
+
+- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)context pageGroupRef:(WKPageGroupRef)pageGroup useTiledDrawing:(BOOL)useTiledDrawing;
+
+@property (nonatomic, assign) BOOL useTiledDrawing;
+@end
+
+@implementation TestRunnerWKView
+
+@synthesize useTiledDrawing = _useTiledDrawing;
+
+- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)context pageGroupRef:(WKPageGroupRef)pageGroup useTiledDrawing:(BOOL)useTiledDrawing
+{
+ _useTiledDrawing = useTiledDrawing;
+ return [super initWithFrame:frame contextRef:context pageGroupRef:pageGroup];
+}
+
+- (BOOL)_shouldUseTiledDrawingArea
+{
+ return _useTiledDrawing;
+}
+
+@end
+
@implementation WebKitTestRunnerWindow
@synthesize platformWebView = _platformWebView;
@@ -78,11 +105,14 @@
namespace WTR {
-PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef, WKDictionaryRef options)
: m_windowIsKey(true)
{
+ WKRetainPtr<WKStringRef> useTiledDrawingKey(AdoptWK, WKStringCreateWithUTF8CString("TiledDrawing"));
+ bool useTiledDrawing = options ? WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(options, useTiledDrawingKey.get()))) : false;
+
NSRect rect = NSMakeRect(0, 0, 800, 600);
- m_view = [[WKView alloc] initWithFrame:rect contextRef:contextRef pageGroupRef:pageGroupRef];
+ m_view = [[TestRunnerWKView alloc] initWithFrame:rect contextRef:contextRef pageGroupRef:pageGroupRef useTiledDrawing:useTiledDrawing];
NSRect windowRect = NSOffsetRect(rect, -10000, [(NSScreen *)[[NSScreen screens] objectAtIndex:0] frame].size.height - rect.size.height + 10000);
m_window = [[WebKitTestRunnerWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
@@ -168,4 +198,12 @@ WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
return adoptWK(WKImageCreateFromCGImage(windowSnapshotImage.get(), 0));
}
+bool PlatformWebView::viewSupportsOptions(WKDictionaryRef options) const
+{
+ WKRetainPtr<WKStringRef> useTiledDrawingKey(AdoptWK, WKStringCreateWithUTF8CString("TiledDrawing"));
+ bool useTiledDrawing = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(options, useTiledDrawingKey.get())));
+
+ return useTiledDrawing == [(TestRunnerWKView *)m_view useTiledDrawing];
+}
+
} // namespace WTR