summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/mac
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/DumpRenderTree/mac')
-rw-r--r--WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm2
-rw-r--r--WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm9
-rw-r--r--WebKitTools/DumpRenderTree/mac/ObjCController.m14
-rw-r--r--WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm55
-rw-r--r--WebKitTools/DumpRenderTree/mac/ResourceLoadDelegate.mm8
-rw-r--r--WebKitTools/DumpRenderTree/mac/WorkQueueItemMac.mm9
6 files changed, 78 insertions, 19 deletions
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
index ce02081..89a25cf 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
@@ -1129,7 +1129,7 @@ void dump()
}
}
- if (dumpPixels && !dumpAsText)
+ if (dumpPixels && gLayoutTestController->generatePixelResults())
// FIXME: when isPrinting is set, dump the image with page separators.
dumpWebViewAsPixelsAndCompareWithExpected(gLayoutTestController->expectedPixelHash());
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index aec4c19..6b921f0 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -46,6 +46,7 @@
#import <WebKit/WebCoreStatistics.h>
#import <WebKit/WebDataSource.h>
#import <WebKit/WebDatabaseManagerPrivate.h>
+#import <WebKit/WebDOMOperationsPrivate.h>
#import <WebKit/WebFrame.h>
#import <WebKit/WebFrameViewPrivate.h>
#import <WebKit/WebGeolocationPosition.h>
@@ -196,8 +197,12 @@ JSRetainPtr<JSStringRef> LayoutTestController::layerTreeAsText() const
JSRetainPtr<JSStringRef> LayoutTestController::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const
{
- // FIXME: Implement me.
- return JSRetainPtr<JSStringRef>();
+ DOMElement *element = [DOMElement _DOMElementFromJSContext:context value:nodeObject];
+ if (!element)
+ return JSRetainPtr<JSStringRef>();
+
+ JSRetainPtr<JSStringRef> markerText(Adopt, JSStringCreateWithCFString((CFStringRef)[element _markerTextForListItem]));
+ return markerText;
}
int LayoutTestController::pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels)
diff --git a/WebKitTools/DumpRenderTree/mac/ObjCController.m b/WebKitTools/DumpRenderTree/mac/ObjCController.m
index aa9ee49..641d2cc 100644
--- a/WebKitTools/DumpRenderTree/mac/ObjCController.m
+++ b/WebKitTools/DumpRenderTree/mac/ObjCController.m
@@ -36,6 +36,11 @@
#import <pthread.h>
#import <wtf/Assertions.h>
+// Remove this once hasWebScriptKey has been made public.
+@interface WebScriptObject (StagedForPublic)
+- (BOOL)hasWebScriptKey:(NSString *)name;
+@end
+
static void* runJavaScriptThread(void* arg)
{
JSGlobalContextRef ctx = JSGlobalContextCreate(0);
@@ -66,6 +71,7 @@ static void* runJavaScriptThread(void* arg)
|| aSelector == @selector(accessStoredWebScriptObject)
|| aSelector == @selector(storeWebScriptObject:)
|| aSelector == @selector(testValueForKey)
+ || aSelector == @selector(testHasWebScriptKey:)
|| aSelector == @selector(testArray)
)
return NO;
@@ -92,6 +98,8 @@ static void* runJavaScriptThread(void* arg)
return @"storeWebScriptObject";
if (aSelector == @selector(testValueForKey))
return @"testValueForKey";
+ if (aSelector == @selector(testHasWebScriptKey:))
+ return @"testHasWebScriptKey";
if (aSelector == @selector(testArray))
return @"testArray";
@@ -166,6 +174,12 @@ static void* runJavaScriptThread(void* arg)
pthread_join(pthread, 0);
}
+- (BOOL)testHasWebScriptKey:(NSString *)key
+{
+ ASSERT(storedWebScriptObject);
+ return [storedWebScriptObject hasWebScriptKey:key];
+}
+
- (BOOL)testWrapperRoundTripping:(WebScriptObject *)webScriptObject
{
JSObjectRef jsObject = [webScriptObject JSObject];
diff --git a/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm b/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm
index 0059b69..3967186 100644
--- a/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm
@@ -38,6 +38,7 @@
#include <wtf/Assertions.h>
#include <wtf/RefPtr.h>
+#import <WebKit/WebCoreStatistics.h>
#import <WebKit/WebDocumentPrivate.h>
#import <WebKit/WebHTMLViewPrivate.h>
#import <WebKit/WebKit.h>
@@ -104,21 +105,11 @@ void setupMainDisplayColorProfile()
signal(SIGTERM, restoreMainDisplayColorProfile);
}
-PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect)
+static PassRefPtr<BitmapContext> createBitmapContext(size_t pixelsWide, size_t pixelsHigh, size_t& rowBytes, void*& buffer)
{
- WebView* view = [mainFrame webView];
+ rowBytes = (4 * pixelsWide + 63) & ~63; // Use a multiple of 64 bytes to improve CG performance
- // If the WebHTMLView uses accelerated compositing, we need for force the on-screen capture path
- // and also force Core Animation to start its animations with -display since the DRT window has autodisplay disabled.
- if ([view _isUsingAcceleratedCompositing])
- onscreen = YES;
-
- NSSize webViewSize = [view frame].size;
- size_t pixelsWide = static_cast<size_t>(webViewSize.width);
- size_t pixelsHigh = static_cast<size_t>(webViewSize.height);
- size_t rowBytes = (4 * pixelsWide + 63) & ~63; // Use a multiple of 64 bytes to improve CG performance
-
- void *buffer = calloc(pixelsHigh, rowBytes);
+ buffer = calloc(pixelsHigh, rowBytes);
if (!buffer)
return 0;
@@ -140,9 +131,28 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool inc
return 0;
}
- // The BitmapContext keeps the CGContextRef and the pixel buffer alive
- RefPtr<BitmapContext> bitmapContext = BitmapContext::createByAdoptingBitmapAndContext(buffer, context);
-
+ return BitmapContext::createByAdoptingBitmapAndContext(buffer, context);
+}
+
+PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect)
+{
+ WebView* view = [mainFrame webView];
+
+ // If the WebHTMLView uses accelerated compositing, we need for force the on-screen capture path
+ // and also force Core Animation to start its animations with -display since the DRT window has autodisplay disabled.
+ if ([view _isUsingAcceleratedCompositing])
+ onscreen = YES;
+
+ NSSize webViewSize = [view frame].size;
+ size_t pixelsWide = static_cast<size_t>(webViewSize.width);
+ size_t pixelsHigh = static_cast<size_t>(webViewSize.height);
+ size_t rowBytes = 0;
+ void* buffer = 0;
+ RefPtr<BitmapContext> bitmapContext = createBitmapContext(pixelsWide, pixelsHigh, rowBytes, buffer);
+ if (!bitmapContext)
+ return 0;
+ CGContextRef context = bitmapContext->cgContext();
+
NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO];
ASSERT(nsContext);
@@ -254,3 +264,16 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool inc
return bitmapContext.release();
}
+
+PassRefPtr<BitmapContext> createPagedBitmapContext()
+{
+ int pageWidthInPixels = LayoutTestController::maxViewWidth;
+ int pageHeightInPixels = LayoutTestController::maxViewHeight;
+ int numberOfPages = [mainFrame numberOfPages:pageWidthInPixels:pageHeightInPixels];
+ size_t rowBytes = 0;
+ void* buffer = 0;
+
+ RefPtr<BitmapContext> bitmapContext = createBitmapContext(pageWidthInPixels, numberOfPages * (pageHeightInPixels + 1) - 1, rowBytes, buffer);
+ [mainFrame printToCGContext:bitmapContext->cgContext():pageWidthInPixels:pageHeightInPixels];
+ return bitmapContext.release();
+}
diff --git a/WebKitTools/DumpRenderTree/mac/ResourceLoadDelegate.mm b/WebKitTools/DumpRenderTree/mac/ResourceLoadDelegate.mm
index fca65f9..0855b83 100644
--- a/WebKitTools/DumpRenderTree/mac/ResourceLoadDelegate.mm
+++ b/WebKitTools/DumpRenderTree/mac/ResourceLoadDelegate.mm
@@ -33,6 +33,7 @@
#import "LayoutTestController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WebTypesInternal.h>
+#import <WebKit/WebDataSourcePrivate.h>
#import <wtf/Assertions.h>
using namespace std;
@@ -131,6 +132,10 @@ using namespace std;
printf("%s\n", [string UTF8String]);
}
+ if (!done && !gLayoutTestController->deferMainResourceDataLoad()) {
+ [dataSource _setDeferMainResourceDataLoad:false];
+ }
+
if (!done && gLayoutTestController->willSendRequestReturnsNull())
return nil;
@@ -167,6 +172,9 @@ using namespace std;
- (void)webView:(WebView *)wv resource:(id)identifier didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource
{
if (!gLayoutTestController->handlesAuthenticationChallenges()) {
+ NSString *string = [NSString stringWithFormat:@"%@ - didReceiveAuthenticationChallenge - Simulating cancelled authentication sheet", identifier];
+ printf("%s\n", [string UTF8String]);
+
[[challenge sender] continueWithoutCredentialForAuthenticationChallenge:challenge];
return;
}
diff --git a/WebKitTools/DumpRenderTree/mac/WorkQueueItemMac.mm b/WebKitTools/DumpRenderTree/mac/WorkQueueItemMac.mm
index 4e39a5a..797afb7 100644
--- a/WebKitTools/DumpRenderTree/mac/WorkQueueItemMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/WorkQueueItemMac.mm
@@ -54,6 +54,15 @@ bool LoadItem::invoke() const
return true;
}
+bool LoadHTMLStringItem::invoke() const
+{
+ RetainPtr<CFStringRef> contentCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_content.get()));
+ RetainPtr<CFStringRef> baseURLCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_baseURL.get()));
+
+ [mainFrame loadHTMLString:(NSString *)contentCF.get() baseURL:[NSURL URLWithString:(NSString *)baseURLCF.get()]];
+ return true;
+}
+
bool ReloadItem::invoke() const
{
[[mainFrame webView] reload:nil];