Reviewed by Beth.
authorggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Oct 2006 03:23:35 +0000 (03:23 +0000)
committerggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Oct 2006 03:23:35 +0000 (03:23 +0000)
        Reorganized project file into Delegates and Controllers groups, and split
        UIDelegate stuff into a UIDelegate class.

        A little birdy told me that I might end up adding some UIDelegate methods
        to DRT soon.

        * DumpRenderTree/DumpRenderTree.m:
        (main):
        (runTest):
        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17465 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/DumpRenderTree.m
WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
WebKitTools/DumpRenderTree/UIDelegate.h [new file with mode: 0644]
WebKitTools/DumpRenderTree/UIDelegate.m [new file with mode: 0644]

index 9a3d451fb08b9d52d4aa2079a3faa85f46823908..841007559b719d7ca2acee01b1c39b3951780834 100644 (file)
@@ -1,3 +1,18 @@
+2006-10-30  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Beth.
+        
+        Reorganized project file into Delegates and Controllers groups, and split 
+        UIDelegate stuff into a UIDelegate class.
+        
+        A little birdy told me that I might end up adding some UIDelegate methods
+        to DRT soon.
+
+        * DumpRenderTree/DumpRenderTree.m:
+        (main):
+        (runTest):
+        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+
 2006-10-31  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Reviewed by Oliver.
index 2a2572f2b01dacb3517f025b2a4138c83383a039..b8554c2488d2c4b26edfab0ebfbcd06c3eba91b9 100644 (file)
  
 #import "DumpRenderTree.h"
 
+#import "AppleScriptController.h"
+#import "EditingDelegate.h"
+#import "EventSendingController.h"
+#import "GCController.h"
+#import "NavigationController.h"
+#import "ObjCPlugin.h"
+#import "ObjCPluginFunction.h"
+#import "TextInputController.h"
+#import "UIDelegate.h"
+#import <ApplicationServices/ApplicationServices.h> // for CMSetDefaultProfileBySpace
 #import <WebKit/DOMExtensions.h>
 #import <WebKit/DOMRange.h>
 #import <WebKit/WebBackForwardList.h>
 #import <WebKit/WebCoreStatistics.h>
 #import <WebKit/WebDataSource.h>
+#import <WebKit/WebDocumentPrivate.h>
 #import <WebKit/WebEditingDelegate.h>
 #import <WebKit/WebFramePrivate.h>
 #import <WebKit/WebFrameView.h>
+#import <WebKit/WebHTMLViewPrivate.h>
 #import <WebKit/WebHistory.h>
+#import <WebKit/WebHistoryItemPrivate.h>
+#import <WebKit/WebPluginDatabase.h>
 #import <WebKit/WebPreferences.h>
 #import <WebKit/WebPreferencesPrivate.h>
 #import <WebKit/WebView.h>
-#import <WebKit/WebHTMLViewPrivate.h>
-#import <WebKit/WebDocumentPrivate.h>
-#import <WebKit/WebPluginDatabase.h>
-#import <WebKit/WebHistoryItemPrivate.h>
-
-#import <ApplicationServices/ApplicationServices.h> // for CMSetDefaultProfileBySpace
+#import <getopt.h>
+#import <malloc/malloc.h>
 #import <objc/objc-runtime.h>                       // for class_poseAs
 
 #define COMMON_DIGEST_FOR_OPENSSL
 #import <CommonCrypto/CommonDigest.h>               // for MD5 functions
 
-#import <getopt.h>
-#import <malloc/malloc.h>
-
-#import "AppleScriptController.h"
-#import "DumpRenderTreeDraggingInfo.h"
-#import "EditingDelegate.h"
-#import "EventSendingController.h"
-#import "GCController.h"
-#import "NavigationController.h"
-#import "ObjCPlugin.h"
-#import "ObjCPluginFunction.h"
-#import "TextInputController.h"
-
 @interface DumpRenderTreeWindow : NSWindow
 @end
 
 @interface LayoutTestController : NSObject
 @end
 
+BOOL windowIsKey = YES;
+WebFrame *frame = 0;
+
 static void runTest(const char *pathOrURL);
 static NSString *md5HashStringForBitmap(CGImageRef bitmap);
 
-WebFrame *frame = 0;
-DumpRenderTreeDraggingInfo *draggingInfo = 0;
-
 static volatile BOOL done;
 static NavigationController *navigationController;
 
@@ -119,14 +116,13 @@ static BOOL printSeparators;
 static NSString *currentTest = nil;
 static NSPasteboard *localPasteboard;
 static WebHistoryItem *prevTestBFItem = nil;  // current b/f item at the end of the previous test
-static BOOL windowIsKey = YES;
 static unsigned char* screenCaptureBuffer;
 static CGColorSpaceRef sharedColorSpace;
 // a queue of NSInvocations, queued by callouts from the test, to be exec'ed when the load is done
 static NSMutableArray *workQueue = nil;
 // to prevent infinite loops, only the first page of a test can add to a work queue
 // (since we may well come back to that same page)
-BOOL workQueueFrozen;
+static BOOL workQueueFrozen;
 
 const unsigned maxViewHeight = 600;
 const unsigned maxViewWidth = 800;
@@ -288,15 +284,18 @@ int main(int argc, const char *argv[])
     navigationController = [[NavigationController alloc] init];
 
     NSRect rect = NSMakeRect(0, 0, maxViewWidth, maxViewHeight);
-    
     WebView *webView = [[WebView alloc] initWithFrame:rect];
-    WaitUntilDoneDelegate *delegate = [[WaitUntilDoneDelegate alloc] init];
-    EditingDelegate *editingDelegate = [[EditingDelegate alloc] init];
-    [webView setFrameLoadDelegate:delegate];
-    [webView setEditingDelegate:editingDelegate];
-    [webView setUIDelegate:delegate];
     frame = [webView mainFrame];
     
+    WaitUntilDoneDelegate *waitUntilDoneDelegate = [[WaitUntilDoneDelegate alloc] init];
+    [webView setFrameLoadDelegate:waitUntilDoneDelegate];
+    
+    UIDelegate *uiDelegate = [[UIDelegate alloc] init];
+    [webView setUIDelegate:uiDelegate];
+
+    EditingDelegate *editingDelegate = [[EditingDelegate alloc] init];
+    [webView setEditingDelegate:editingDelegate];
+
     [[webView preferences] setTabsToLinks:YES];
     
     NSString *pwd = [[NSString stringWithUTF8String:argv[0]] stringByDeletingLastPathComponent];
@@ -374,9 +373,10 @@ int main(int argc, const char *argv[])
     
     [window close]; // releases when closed
     [webView release];
-    [delegate release];
+    [waitUntilDoneDelegate release];
     [editingDelegate release];
-
+    [uiDelegate release];
+    
     [localPasteboard releaseGlobally];
     localPasteboard = nil;
     
@@ -688,35 +688,12 @@ static void dump(void)
     [pluginFunction release];
 }
 
-- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message
-{
-    printf("ALERT: %s\n", [message UTF8String]);
-}
-
 - (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame
 {
     if (dumpTitleChanges)
         printf("TITLE CHANGED: %s\n", [title UTF8String]);
 }
 
-- (void)webView:(WebView *)sender dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag forView:(NSView *)view
-{
-    // A new drag was started before the old one ended.  Probably shouldn't happen.
-    if (draggingInfo) {
-        [[draggingInfo draggingSource] draggedImage:[draggingInfo draggedImage] endedAt:lastMousePosition operation:NSDragOperationNone];
-        [draggingInfo release];
-    }
-    draggingInfo = [[DumpRenderTreeDraggingInfo alloc] initWithImage:anImage offset:initialOffset pasteboard:pboard source:sourceObj];
-}
-
-- (void)webViewFocus:(WebView *)webView
-{
-    windowIsKey = YES;
-    NSView *documentView = [[frame frameView] documentView];
-    if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView *)documentView _updateActiveState];
-}
-
 @end
 
 @implementation LayoutTestController
@@ -1000,9 +977,6 @@ static void runTest(const char *pathOrURL)
     }
     pool = [[NSAutoreleasePool alloc] init];
     [[frame webView] setSelectedDOMRange:nil affinity:NSSelectionAffinityDownstream];
-    if (draggingInfo)
-        [draggingInfo release];
-    draggingInfo = nil;
     [pool release];
 }
 
index 8c3218ba283af7597bbab9a876a82dd921c0ca5d..d51da76092944f219182e6c425d2b6aa47f3235b 100644 (file)
@@ -32,6 +32,8 @@
                141BF44B096A45C800E0753C /* PluginObject.c in Sources */ = {isa = PBXBuildFile; fileRef = 141BF446096A45C800E0753C /* PluginObject.c */; };
                141BF44C096A45C800E0753C /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 141BF448096A45C800E0753C /* Info.plist */; };
                141BF453096A45EB00E0753C /* PluginObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 141BF447096A45C800E0753C /* PluginObject.h */; };
+               1422A1BA0AF6EDD600E1A883 /* UIDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1422A1B80AF6EDD600E1A883 /* UIDelegate.h */; };
+               1422A1BB0AF6EDD600E1A883 /* UIDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1422A1B90AF6EDD600E1A883 /* UIDelegate.m */; };
                14770FE20A22ADF7009342EE /* GCController.h in Headers */ = {isa = PBXBuildFile; fileRef = 14770FE00A22ADF7009342EE /* GCController.h */; };
                14770FE30A22ADF7009342EE /* GCController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 14770FE10A22ADF7009342EE /* GCController.mm */; };
                14A6FB8A0971CAE5008B014F /* NavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A6FB880971CAE5008B014F /* NavigationController.h */; };
@@ -94,6 +96,8 @@
                141BF446096A45C800E0753C /* PluginObject.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = PluginObject.c; sourceTree = "<group>"; };
                141BF447096A45C800E0753C /* PluginObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PluginObject.h; sourceTree = "<group>"; };
                141BF448096A45C800E0753C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
+               1422A1B80AF6EDD600E1A883 /* UIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIDelegate.h; sourceTree = "<group>"; };
+               1422A1B90AF6EDD600E1A883 /* UIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIDelegate.m; sourceTree = "<group>"; };
                14770FE00A22ADF7009342EE /* GCController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCController.h; sourceTree = "<group>"; };
                14770FE10A22ADF7009342EE /* GCController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GCController.mm; sourceTree = "<group>"; };
                14A6FB880971CAE5008B014F /* NavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigationController.h; sourceTree = "<group>"; };
                08FB7794FE84155DC02AAC07 /* DumpRenderTree */ = {
                        isa = PBXGroup;
                        children = (
+                               32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */,
+                               1422A2750AF6F4BD00E1A883 /* Delegates */,
+                               1422A2690AF6F45200E1A883 /* Controllers */,
                                141BF1F5096A439800E0753C /* TestNetscapePlugIn.subproj */,
-                               A803FFF309CAAFE0009B2A37 /* EditingDelegate.h */,
-                               A803FFF409CAAFE0009B2A37 /* EditingDelegate.m */,
                                A803FF7409CAAD08009B2A37 /* DumpRenderTree.h */,
                                08FB7796FE84155DC02AAC07 /* DumpRenderTree.m */,
                                A803FFB209CAAE0B009B2A37 /* DumpRenderTreeDraggingInfo.h */,
                                A803FFB309CAAE0B009B2A37 /* DumpRenderTreeDraggingInfo.m */,
-                               32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */,
-                               A803FCB709CAAAB0009B2A37 /* EventSendingController.h */,
-                               A803FCB809CAAAB1009B2A37 /* EventSendingController.m */,
-                               14770FE00A22ADF7009342EE /* GCController.h */,
-                               14770FE10A22ADF7009342EE /* GCController.mm */,
-                               93442CF408F8BA4900BFE8CA /* TextInputController.h */,
-                               93442CF508F8BA4900BFE8CA /* TextInputController.m */,
-                               E13307FE099624DA00AC0A91 /* AppleScriptController.h */,
-                               E13307FF099624DA00AC0A91 /* AppleScriptController.m */,
                                B5A7525808AF4A3600138E45 /* ImageDiff.m */,
-                               14A6FB880971CAE5008B014F /* NavigationController.h */,
-                               14A6FB890971CAE5008B014F /* NavigationController.m */,
                                22181BCD09DC8C4B008342E8 /* ObjCPlugin.h */,
                                22181BCE09DC8C4B008342E8 /* ObjCPlugin.m */,
                                22181BCF09DC8C4B008342E8 /* ObjCPluginFunction.h */,
                        path = TestNetscapePlugIn.subproj;
                        sourceTree = "<group>";
                };
+               1422A2690AF6F45200E1A883 /* Controllers */ = {
+                       isa = PBXGroup;
+                       children = (
+                               E13307FE099624DA00AC0A91 /* AppleScriptController.h */,
+                               E13307FF099624DA00AC0A91 /* AppleScriptController.m */,
+                               A803FCB709CAAAB0009B2A37 /* EventSendingController.h */,
+                               A803FCB809CAAAB1009B2A37 /* EventSendingController.m */,
+                               14770FE00A22ADF7009342EE /* GCController.h */,
+                               14770FE10A22ADF7009342EE /* GCController.mm */,
+                               14A6FB880971CAE5008B014F /* NavigationController.h */,
+                               14A6FB890971CAE5008B014F /* NavigationController.m */,
+                               93442CF408F8BA4900BFE8CA /* TextInputController.h */,
+                               93442CF508F8BA4900BFE8CA /* TextInputController.m */,
+                       );
+                       name = Controllers;
+                       sourceTree = "<group>";
+               };
+               1422A2750AF6F4BD00E1A883 /* Delegates */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A803FFF309CAAFE0009B2A37 /* EditingDelegate.h */,
+                               A803FFF409CAAFE0009B2A37 /* EditingDelegate.m */,
+                               1422A1B80AF6EDD600E1A883 /* UIDelegate.h */,
+                               1422A1B90AF6EDD600E1A883 /* UIDelegate.m */,
+                       );
+                       name = Delegates;
+                       sourceTree = "<group>";
+               };
                9340995508540CAF007F3BC8 /* Products */ = {
                        isa = PBXGroup;
                        children = (
                                22181BD109DC8C4B008342E8 /* ObjCPlugin.h in Headers */,
                                22181BD309DC8C4B008342E8 /* ObjCPluginFunction.h in Headers */,
                                14770FE20A22ADF7009342EE /* GCController.h in Headers */,
+                               1422A1BA0AF6EDD600E1A883 /* UIDelegate.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                22181BD209DC8C4B008342E8 /* ObjCPlugin.m in Sources */,
                                22181BD409DC8C4B008342E8 /* ObjCPluginFunction.m in Sources */,
                                14770FE30A22ADF7009342EE /* GCController.mm in Sources */,
+                               1422A1BB0AF6EDD600E1A883 /* UIDelegate.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
diff --git a/WebKitTools/DumpRenderTree/UIDelegate.h b/WebKitTools/DumpRenderTree/UIDelegate.h
new file mode 100644 (file)
index 0000000..e332889
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#import <Cocoa/Cocoa.h>
+
+@class WebFrame;
+
+@interface UIDelegate : NSObject {
+
+}
+
+@end
+
+extern NSPoint lastMousePosition;
+extern BOOL windowIsKey;
+extern WebFrame *frame;
diff --git a/WebKitTools/DumpRenderTree/UIDelegate.m b/WebKitTools/DumpRenderTree/UIDelegate.m
new file mode 100644 (file)
index 0000000..47da97d
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#import "UIDelegate.h"
+
+#import "DumpRenderTreeDraggingInfo.h"
+#import <WebKit/WebFramePrivate.h>
+#import <WebKit/WebHTMLViewPrivate.h>
+#import <WebKit/WebView.h>
+
+DumpRenderTreeDraggingInfo *draggingInfo = nil;
+
+@implementation UIDelegate
+
+- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message
+{
+    printf("ALERT: %s\n", [message UTF8String]);
+}
+
+- (void)webView:(WebView *)sender dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag forView:(NSView *)view
+{
+    // A new drag was started before the old one ended.  Probably shouldn't happen.
+    if (draggingInfo) {
+        [[draggingInfo draggingSource] draggedImage:[draggingInfo draggedImage] endedAt:lastMousePosition operation:NSDragOperationNone];
+        [draggingInfo release];
+    }
+    draggingInfo = [[DumpRenderTreeDraggingInfo alloc] initWithImage:anImage offset:initialOffset pasteboard:pboard source:sourceObj];
+}
+
+- (void)webViewFocus:(WebView *)webView
+{
+    windowIsKey = YES;
+    NSView *documentView = [[frame frameView] documentView];
+    if ([documentView isKindOfClass:[WebHTMLView class]])
+        [(WebHTMLView *)documentView _updateActiveState];
+}
+
+- (void)dealloc
+{
+    [draggingInfo release];
+    draggingInfo = nil;
+
+    [super dealloc];
+}
+
+@end