Fixed: <rdar://problem/3880410> save 5 dirty pages by soft-linking against PDFKit...
authorcblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Nov 2004 00:25:11 +0000 (00:25 +0000)
committercblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Nov 2004 00:25:11 +0000 (00:25 +0000)
        Reviewed by john.

        * WebKit.pbproj/project.pbxproj:
        * WebView.subproj/WebPDFRepresentation.m:
        (+[WebPDFRepresentation PDFDocumentClass]): new
        (-[WebPDFRepresentation finishedLoadingWithDataSource:]): use PDFDocumentClass
        * WebView.subproj/WebPDFView.h:
        * WebView.subproj/WebPDFView.m:
        (+[WebPDFView PDFKitBundle]): new
        (+[WebPDFView PDFViewClass]): new
        (-[WebPDFView initWithFrame:]): create a PDFView subview
        (-[WebPDFView dealloc]): release the PDFView subview
        (-[WebPDFView PDFSubview]): new

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

WebKit/ChangeLog
WebKit/English.lproj/StringsNotToBeLocalized.txt
WebKit/WebKit.pbproj/project.pbxproj
WebKit/WebView.subproj/WebPDFRepresentation.m
WebKit/WebView.subproj/WebPDFView.h
WebKit/WebView.subproj/WebPDFView.m

index 0a22cfd..709b873 100644 (file)
@@ -1,5 +1,23 @@
 2004-11-15  Chris Blumenberg  <cblu@apple.com>
 
+       Fixed: <rdar://problem/3880410> save 5 dirty pages by soft-linking against PDFKit framework
+
+        Reviewed by john.
+
+        * WebKit.pbproj/project.pbxproj:
+        * WebView.subproj/WebPDFRepresentation.m:
+        (+[WebPDFRepresentation PDFDocumentClass]): new
+        (-[WebPDFRepresentation finishedLoadingWithDataSource:]): use PDFDocumentClass
+        * WebView.subproj/WebPDFView.h:
+        * WebView.subproj/WebPDFView.m:
+        (+[WebPDFView PDFKitBundle]): new
+        (+[WebPDFView PDFViewClass]): new
+        (-[WebPDFView initWithFrame:]): create a PDFView subview
+        (-[WebPDFView dealloc]): release the PDFView subview
+        (-[WebPDFView PDFSubview]): new
+
+2004-11-15  Chris Blumenberg  <cblu@apple.com>
+
        Fixed: <rdar://problem/3879891> WebKit should link against PDFKit instead of Quartz
 
         Reviewed by darin.
index 673d61f..d90a279 100644 (file)
@@ -27,6 +27,7 @@
 "- %s:%d %s - "
 "/"
 "/<!--frame%d-->-->"
+"/Frameworks/PDFKit.framework"
 "/Library/Internet Plug-Ins"
 "/favicon.ico"
 "/image.pict"
 "NSFileOwnerAccountName"
 "NSFilePosixPermissions"
 "NeXT smart paste pasteboard type"
+"PDFDocument"
+"PDFView"
 "POST"
 "Papyrus"
+"Quartz.framework"
 "SAMILang"
 "SAMIStyle"
 "Set-Cookie"
index 8417c61..dd19b98 100644 (file)
                                DYLIB_COMPATIBILITY_VERSION = 1;
                                DYLIB_CURRENT_VERSION = 1;
                                EXPORTED_SYMBOLS_FILE = WebKit.exp;
-                               FRAMEWORK_SEARCH_PATHS = "\"${DSTROOT}\" \"${MERGE_DIR}/${SYSTEM_LIBRARY_DIR}/Frameworks\" \"${MERGE_DIR}/$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Frameworks\" \"$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Frameworks\" \"$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks\" \"$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks\" \"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\" /usr/local/SecurityPieces/Frameworks /System/Library/Frameworks/Quartz.framework/Frameworks";
+                               FRAMEWORK_SEARCH_PATHS = "\"${DSTROOT}\" \"${MERGE_DIR}/${SYSTEM_LIBRARY_DIR}/Frameworks\" \"${MERGE_DIR}/$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Frameworks\" \"$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Frameworks\" \"$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks\" \"$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks\" \"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\" /usr/local/SecurityPieces/Frameworks";
                                FRAMEWORK_VERSION = A;
                                GCC_ENABLE_OBJC_GC = YES;
                                GCC_FAST_OBJC_DISPATCH = YES;
                                PREFIX_HEADER = WebKitPrefix.h;
                                PRODUCT_NAME = WebKit;
                                SECTORDER_FLAGS = "-sectorder __TEXT __text /AppleInternal/OrderFiles/WebKit.order";
-                               TIGER_FRAMEWORKS_LDFLAGS = "-framework \"`if [ -f /System/Library/Frameworks/Quartz.framework/Frameworks/PDFKit.framework/PDFKit ]; then echo \\\"PDFKit\\\"; else echo \\\"System\\\"; fi`\" -framework \"`if [ -f /usr/local/SecurityPieces/Frameworks/security_cdsa_utils.framework/security_cdsa_utils ]; then echo \\\"security_cdsa_utils\\\"; else echo \\\"System\\\"; fi`\"";
+                               TIGER_FRAMEWORKS_LDFLAGS = "-framework \"`if [ -f /usr/local/SecurityPieces/Frameworks/security_cdsa_utils.framework/security_cdsa_utils ]; then echo \\\"security_cdsa_utils\\\"; else echo \\\"System\\\"; fi`\"";
                                USE_GCC3_PFE_SUPPORT = YES;
                                WARNING_CFLAGS = "-Werror -Wall -W -Wcast-align -Wchar-subscripts -Wformat-security -Wmissing-format-attribute -Wmissing-prototypes -Wpointer-arith -Wwrite-strings -Wno-format-y2k -Wno-unused-parameter -Wbad-function-cast -Wmissing-declarations -Wnested-externs";
                                WARNING_CPLUSPLUSFLAGS = "-Werror -Wall -Wcast-align -Wchar-subscripts -Wformat-security -Wmissing-format-attribute -Wmissing-prototypes -Wpointer-arith -Wwrite-strings -Wno-format-y2k -Wno-unused-parameter";
index 23b4a79..dddf596 100644 (file)
@@ -5,16 +5,29 @@
 
 #ifndef OMIT_TIGER_FEATURES
 
-#import <Quartz/Quartz.h>
-
+#import <WebKit/WebAssertions.h>
 #import <WebKit/WebDataSource.h>
 #import <WebKit/WebFrame.h>
 #import <WebKit/WebFrameView.h>
 #import <WebKit/WebPDFRepresentation.h>
 #import <WebKit/WebPDFView.h>
 
+#import <Quartz/Quartz.h>
+
 @implementation WebPDFRepresentation
 
++ (Class)PDFDocumentClass
+{
+    static Class PDFDocumentClass = nil;
+    if (PDFDocumentClass == nil) {
+        PDFDocumentClass = [[WebPDFView PDFKitBundle] classNamed:@"PDFDocument"];
+        if (PDFDocumentClass == nil) {
+            ERROR("Couldn't find PDFDocument class in PDFKit.framework");
+        }
+    }
+    return PDFDocumentClass;
+}
+
 - (void)setDataSource:(WebDataSource *)dataSource;
 {
 }
@@ -30,8 +43,8 @@
 - (void)finishedLoadingWithDataSource:(WebDataSource *)dataSource
 {
     WebPDFView *view = (WebPDFView *)[[[dataSource webFrame] frameView] documentView];
-    PDFDocument *doc = [[PDFDocument alloc] initWithData:[dataSource data]];
-    [view setDocument:doc];
+    PDFDocument *doc = [[[[self class] PDFDocumentClass] alloc] initWithData:[dataSource data]];
+    [[view PDFSubview] setDocument:doc];
     [doc release];
 }
 
index fd2d7cc..e7eda5c 100644 (file)
@@ -4,16 +4,20 @@
 */
 #ifndef OMIT_TIGER_FEATURES
 
-#import <Quartz/Quartz.h>
-
+@class PDFView;
 @class WebDataSource;
 
-@interface WebPDFView : PDFView <WebDocumentView, WebDocumentSearching>
+@interface WebPDFView : NSView <WebDocumentView, WebDocumentSearching>
 {
+    PDFView *PDFSubview;
     WebDataSource *dataSource;
     NSString *path;
     BOOL written;
 }
+
++ (NSBundle *)PDFKitBundle;
+- (PDFView *)PDFSubview;
+
 @end
 
 #endif  // OMIT_TIGER_FEATURES
index d62de83..8d0cf98 100644 (file)
@@ -7,29 +7,71 @@
 
 #import <Foundation/NSString_NSURLExtras.h>
 
+#import <WebKit/WebAssertions.h>
 #import <WebKit/WebDataSource.h>
 #import <WebKit/WebLocalizableStrings.h>
 #import <WebKit/WebPDFView.h>
 
+#import <Quartz/Quartz.h>
+
+NSString *_NSPathForSystemFramework(NSString *framework);
 
 @implementation WebPDFView
 
++ (NSBundle *)PDFKitBundle
+{
+    static NSBundle *PDFKitBundle = nil;
+    if (PDFKitBundle == nil) {
+        NSString *PDFKitPath = [_NSPathForSystemFramework(@"Quartz.framework") stringByAppendingString:@"/Frameworks/PDFKit.framework"];
+        if (PDFKitPath == nil) {
+            ERROR("Couldn't find PDFKit.framework");
+            return nil;
+        }
+        PDFKitBundle = [NSBundle bundleWithPath:PDFKitPath];
+        if (![PDFKitBundle load]) {
+            ERROR("Couldn't load PDFKit.framework");
+        }
+    }
+    return PDFKitBundle;
+}
+
++ (Class)PDFViewClass
+{
+    static Class PDFViewClass = nil;
+    if (PDFViewClass == nil) {
+        PDFViewClass = [[WebPDFView PDFKitBundle] classNamed:@"PDFView"];
+        if (PDFViewClass == nil) {
+            ERROR("Couldn't find PDFView class in PDFKit.framework");
+        }
+    }
+    return PDFViewClass;
+}
+
 - (id)initWithFrame:(NSRect)frame
 {
     self = [super initWithFrame:frame];
     if (self) {
         [self setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
-            written = NO;
+        PDFSubview = [[[[self class] PDFViewClass] alloc] initWithFrame:frame];
+        [PDFSubview setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
+        [self addSubview:PDFSubview];
+        written = NO;
     }
     return self;
 }
 
 - (void)dealloc
 {
+    [PDFSubview release];
     [path release];
     [super dealloc];
 }
 
+- (PDFView *)PDFSubview
+{
+    return PDFSubview;
+}
+
 #define TEMP_PREFIX "/tmp/XXXXXX-"
 #define OBJC_TEMP_PREFIX @"/tmp/XXXXXX-"