diff options
Diffstat (limited to 'WebKitTools/DumpRenderTree/mac')
6 files changed, 56 insertions, 12 deletions
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm index 9e4b203..51ea004 100644 --- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm @@ -111,7 +111,7 @@ static void runTest(const string& testPathOrURL); volatile bool done; NavigationController* gNavigationController = 0; -LayoutTestController* gLayoutTestController = 0; +RefPtr<LayoutTestController> gLayoutTestController; WebFrame *mainFrame = 0; // This is the topmost frame that is loading, during a given load, or nil when no load is @@ -136,7 +136,7 @@ static int dumpPixels; static int threaded; static int dumpTree = YES; static int forceComplexText; -static int useHTML5Parser; +static int useHTML5Parser = YES; static BOOL printSeparators; static RetainPtr<CFStringRef> persistentUserStyleSheetLocation; @@ -562,7 +562,7 @@ static void initializeGlobalsFromCommandLineOptions(int argc, const char *argv[] {"tree", no_argument, &dumpTree, YES}, {"threaded", no_argument, &threaded, YES}, {"complex-text", no_argument, &forceComplexText, YES}, - {"html5-parser", no_argument, &useHTML5Parser, YES}, + {"legacy-parser", no_argument, &useHTML5Parser, NO}, {NULL, 0, NULL, 0} }; @@ -1185,6 +1185,9 @@ static void resetWebViewToConsistentStateBeforeTesting() [WebView _resetOriginAccessWhitelists]; [[MockGeolocationProvider shared] stopTimer]; + + // Clear the contents of the general pasteboard + [[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; } static void runTest(const string& testPathOrURL) @@ -1221,7 +1224,7 @@ static void runTest(const string& testPathOrURL) resetWebViewToConsistentStateBeforeTesting(); - gLayoutTestController = new LayoutTestController(testURL, expectedPixelHash); + gLayoutTestController = LayoutTestController::create(testURL, expectedPixelHash); topLoadingFrame = nil; ASSERT(!draggingInfo); // the previous test should have called eventSender.mouseUp to drop! releaseAndZero(&draggingInfo); @@ -1311,8 +1314,7 @@ static void runTest(const string& testPathOrURL) ASSERT(CFArrayGetCount(openWindowsRef) == 1); ASSERT(CFArrayGetValueAtIndex(openWindowsRef, 0) == [[mainFrame webView] window]); - gLayoutTestController->deref(); - gLayoutTestController = 0; + gLayoutTestController.clear(); if (ignoreWebCoreNodeLeaks) [WebCoreStatistics stopIgnoringWebCoreNodeLeaks]; diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTreePasteboard.m b/WebKitTools/DumpRenderTree/mac/DumpRenderTreePasteboard.m index 75be9de..b1b3b86 100644 --- a/WebKitTools/DumpRenderTree/mac/DumpRenderTreePasteboard.m +++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTreePasteboard.m @@ -177,7 +177,7 @@ static NSMutableDictionary *localPasteboards; return [dataByType objectForKey:dataType]; } -- (BOOL)setPropertyList:(id)propertyList forType:(NSString *)dataType; +- (BOOL)setPropertyList:(id)propertyList forType:(NSString *)dataType { CFDataRef data = NULL; if (propertyList) diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.mm index 8845ef0..e0cdc6b 100644 --- a/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.mm +++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.mm @@ -82,7 +82,7 @@ static CFArrayCallBacks NonRetainingArrayCallbacks = { return gLayoutTestController ? gLayoutTestController->windowIsKey() : YES; } -- (void)keyDown:(id)sender +- (void)keyDown:(NSEvent *)event { // Do nothing, avoiding the beep we'd otherwise get from NSResponder, // once we get to the end of the responder chain. diff --git a/WebKitTools/DumpRenderTree/mac/EventSendingController.mm b/WebKitTools/DumpRenderTree/mac/EventSendingController.mm index 73831ff..9d2fc75 100644 --- a/WebKitTools/DumpRenderTree/mac/EventSendingController.mm +++ b/WebKitTools/DumpRenderTree/mac/EventSendingController.mm @@ -598,7 +598,7 @@ static int buildModifierFlags(const WebScriptObject* modifiers) eventCharacter = [NSString stringWithCharacters:&ch length:1]; keyCode = 0x77; } else if ([character isEqualToString:@"delete"]) { - const unichar ch = 0x7f; + const unichar ch = NSDeleteFunctionKey; eventCharacter = [NSString stringWithCharacters:&ch length:1]; keyCode = 0x75; } diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm index eb01090..d0599e0 100644 --- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm +++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm @@ -212,6 +212,29 @@ int LayoutTestController::pageNumberForElementById(JSStringRef id, float pageWid return [mainFrame pageNumberForElement:element:pageWidthInPixels:pageHeightInPixels]; } +JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* propertyName, int pageNumber) const +{ + JSRetainPtr<JSStringRef> propertyValue(Adopt, JSStringCreateWithCFString((CFStringRef)[mainFrame pageProperty:propertyName:pageNumber])); + return propertyValue; +} + +bool LayoutTestController::isPageBoxVisible(int pageNumber) const +{ + return [mainFrame isPageBoxVisible:pageNumber]; +} + +JSRetainPtr<JSStringRef> LayoutTestController::pageAreaRectInPixels(int pageNumber) const +{ + JSRetainPtr<JSStringRef> propertyValue(Adopt, JSStringCreateWithCFString((CFStringRef)[mainFrame pageAreaRectInPixels:pageNumber])); + return propertyValue; +} + +JSRetainPtr<JSStringRef> LayoutTestController::preferredPageSizeInPixels(int pageNumber) const +{ + JSRetainPtr<JSStringRef> propertyValue(Adopt, JSStringCreateWithCFString((CFStringRef)[mainFrame preferredPageSizeInPixels:pageNumber])); + return propertyValue; +} + int LayoutTestController::numberOfPages(float pageWidthInPixels, float pageHeightInPixels) { return [mainFrame numberOfPages:pageWidthInPixels:pageHeightInPixels]; @@ -487,9 +510,9 @@ int LayoutTestController::windowCount() return CFArrayGetCount(openWindowsRef); } -bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef id) +bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef jsString) { - RetainPtr<CFStringRef> idCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, id)); + RetainPtr<CFStringRef> idCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, jsString)); NSString *idNS = (NSString *)idCF.get(); DOMElement *element = [[mainFrame DOMDocument] getElementById:idNS]; @@ -520,7 +543,7 @@ void LayoutTestController::setCacheModel(int cacheModel) bool LayoutTestController::isCommandEnabled(JSStringRef name) { RetainPtr<CFStringRef> nameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, name)); - NSString *nameNS = reinterpret_cast<const NSString *>(nameCF.get()); + NSString *nameNS = (NSString *)nameCF.get(); // Accept command strings with capital letters for first letter without trailing colon. if (![nameNS hasSuffix:@":"] && [nameNS length]) { @@ -860,3 +883,8 @@ void LayoutTestController::setEditingBehavior(const char* editingBehavior) [[WebPreferences standardPreferences] setEditingBehavior:WebKitEditingWinBehavior]; [editingBehaviorNS release]; } + +void LayoutTestController::abortModal() +{ + [NSApp abortModal]; +} diff --git a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm index e6754c1..83bf0c6 100644 --- a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm +++ b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm @@ -67,6 +67,20 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil; printf ("CONSOLE MESSAGE: line %d: %s\n", [lineNumber intValue], [message UTF8String]); } +- (void)modalWindowWillClose:(NSNotification *)notification +{ + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:nil]; + [NSApp abortModal]; +} + +- (void)webViewRunModal:(WebView *)sender +{ + gLayoutTestController->setWindowIsKey(false); + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(modalWindowWillClose:) name:NSWindowWillCloseNotification object:nil]; + [NSApp runModalForWindow:[sender window]]; + gLayoutTestController->setWindowIsKey(true); +} + - (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame { if (!done) |