summaryrefslogtreecommitdiff
path: root/Tools/WebKitTestRunner/mac
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
commitcfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch)
tree24d68c6f61c464ecba1e05670b80390ea3b0e50c /Tools/WebKitTestRunner/mac
parent69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff)
downloadqtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Tools/WebKitTestRunner/mac')
-rw-r--r--Tools/WebKitTestRunner/mac/EventSenderProxy.mm12
-rw-r--r--Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm42
-rw-r--r--Tools/WebKitTestRunner/mac/main.mm1
3 files changed, 47 insertions, 8 deletions
diff --git a/Tools/WebKitTestRunner/mac/EventSenderProxy.mm b/Tools/WebKitTestRunner/mac/EventSenderProxy.mm
index dfe10745d..ece5b523e 100644
--- a/Tools/WebKitTestRunner/mac/EventSenderProxy.mm
+++ b/Tools/WebKitTestRunner/mac/EventSenderProxy.mm
@@ -111,6 +111,10 @@ EventSenderProxy::EventSenderProxy(TestController* testController)
{
}
+EventSenderProxy::~EventSenderProxy()
+{
+}
+
void EventSenderProxy::updateClickCountForButton(int button)
{
if (m_time - m_clickTime < 1 && m_position == m_clickPosition && button == m_clickButton) {
@@ -385,15 +389,11 @@ void EventSenderProxy::mouseScrollBy(int x, int y)
RetainPtr<CGEventRef> cgScrollEvent(AdoptCF, CGEventCreateScrollWheelEvent(0, kCGScrollEventUnitLine, 2, y, x));
// CGEvent locations are in global display coordinates.
- CGPoint lastGlobalMousePosition = {
- m_position.x,
- [[NSScreen mainScreen] frame].size.height - m_position.y
- };
+ CGPoint lastGlobalMousePosition = CGPointMake(m_position.x, [[NSScreen mainScreen] frame].size.height - m_position.y);
CGEventSetLocation(cgScrollEvent.get(), lastGlobalMousePosition);
NSEvent *event = [NSEvent eventWithCGEvent:cgScrollEvent.get()];
- NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:[event locationInWindow]];
- if (targetView)
+ if (NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:[event locationInWindow]])
[targetView scrollWheel:event];
}
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
diff --git a/Tools/WebKitTestRunner/mac/main.mm b/Tools/WebKitTestRunner/mac/main.mm
index 12326a4d3..b5c34f769 100644
--- a/Tools/WebKitTestRunner/mac/main.mm
+++ b/Tools/WebKitTestRunner/mac/main.mm
@@ -31,6 +31,7 @@ int main(int argc, const char* argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[NSApplication sharedApplication];
+ [[NSUserDefaults standardUserDefaults] setVolatileDomain:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:@"WebKitKerningAndLigaturesEnabledByDefault"] forName:NSArgumentDomain];
{
WTR::TestController controller(argc, argv);
}