[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:24:57 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 84a5e13541527748516dc4fc0364a07bac220eba
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 17 22:24:10 2002 +0000

    	Some refactoring in preparation for the KHTMLPart change.
    
            * WebView.subproj/WebController.m:
    	(-[WebController haveContentPolicy:andPath:forDataSource:]): Move
    	more of the work of creating and setting the representation and
    	document view into WebDataSource and WebView.
    
            * WebView.subproj/WebDataSource.h,
    	WebView.subproj/WebDataSource.m:
    	(+[(id <WebDocumentRepresentation>) createRepresentationForMIMEType:]): Removed.
            (-[WebDataSource makeRepresentation]): A method to build the right
    	kind of representation for the content type.
    
            * WebView.subproj/WebDataSourcePrivate.h:
            * WebView.subproj/WebDataSourcePrivate.m:
    	(-[WebDataSource _representationClass]): Method to get the right
    	representation class for the current content type.
    	(-[WebDataSource _bridge]): Move here from WebBridge.[mh], so we
    	can later add an assertion that the data source is not provisional.
    
            * WebView.subproj/WebHTMLViewPrivate.m: #import WebDataSourcePrivate.h
            * WebView.subproj/WebView.h, WebView.subproj/WebView.m:
    	(+[(id <WebDocumentRepresentation>) createDocumentViewForMIMEType:]): Removed.
    	(-[WebView makeDocumentViewForMIMEType:]): Method to build the
    	right kind of document view for the specified MIME type.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1582 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 367051c..ca3d5ae 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,31 @@
+2002-07-17  Maciej Stachowiak  <mjs at apple.com>
+
+	Some refactoring in preparation for the KHTMLPart change.
+	
+        * WebView.subproj/WebController.m: 
+	(-[WebController haveContentPolicy:andPath:forDataSource:]): Move
+	more of the work of creating and setting the representation and
+	document view into WebDataSource and WebView.
+	
+        * WebView.subproj/WebDataSource.h,
+	WebView.subproj/WebDataSource.m:
+	(+[(id <WebDocumentRepresentation>) createRepresentationForMIMEType:]): Removed.
+        (-[WebDataSource makeRepresentation]): A method to build the right
+	kind of representation for the content type.
+
+        * WebView.subproj/WebDataSourcePrivate.h:
+        * WebView.subproj/WebDataSourcePrivate.m:
+	(-[WebDataSource _representationClass]): Method to get the right
+	representation class for the current content type.
+	(-[WebDataSource _bridge]): Move here from WebBridge.[mh], so we
+	can later add an assertion that the data source is not provisional.
+	
+        * WebView.subproj/WebHTMLViewPrivate.m: #import WebDataSourcePrivate.h
+        * WebView.subproj/WebView.h, WebView.subproj/WebView.m:
+	(+[(id <WebDocumentRepresentation>) createDocumentViewForMIMEType:]): Removed.
+	(-[WebView makeDocumentViewForMIMEType:]): Method to build the
+	right kind of document view for the specified MIME type.
+
 2002-07-16  Darin Adler  <darin at apple.com>
 
         * History.subproj/WebBackForwardList.m: Replace MyCompanyName with Apple Computer.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 367051c..ca3d5ae 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,31 @@
+2002-07-17  Maciej Stachowiak  <mjs at apple.com>
+
+	Some refactoring in preparation for the KHTMLPart change.
+	
+        * WebView.subproj/WebController.m: 
+	(-[WebController haveContentPolicy:andPath:forDataSource:]): Move
+	more of the work of creating and setting the representation and
+	document view into WebDataSource and WebView.
+	
+        * WebView.subproj/WebDataSource.h,
+	WebView.subproj/WebDataSource.m:
+	(+[(id <WebDocumentRepresentation>) createRepresentationForMIMEType:]): Removed.
+        (-[WebDataSource makeRepresentation]): A method to build the right
+	kind of representation for the content type.
+
+        * WebView.subproj/WebDataSourcePrivate.h:
+        * WebView.subproj/WebDataSourcePrivate.m:
+	(-[WebDataSource _representationClass]): Method to get the right
+	representation class for the current content type.
+	(-[WebDataSource _bridge]): Move here from WebBridge.[mh], so we
+	can later add an assertion that the data source is not provisional.
+	
+        * WebView.subproj/WebHTMLViewPrivate.m: #import WebDataSourcePrivate.h
+        * WebView.subproj/WebView.h, WebView.subproj/WebView.m:
+	(+[(id <WebDocumentRepresentation>) createDocumentViewForMIMEType:]): Removed.
+	(-[WebView makeDocumentViewForMIMEType:]): Method to build the
+	right kind of document view for the specified MIME type.
+
 2002-07-16  Darin Adler  <darin at apple.com>
 
         * History.subproj/WebBackForwardList.m: Replace MyCompanyName with Apple Computer.
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.h b/WebKit/WebCoreSupport.subproj/WebBridge.h
index 745315e..69efd29 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.h
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.h
@@ -20,9 +20,3 @@
 
 @end
 
-// Convenience interface for getting here from an WebDataSource.
-// This returns nil if the representation is not an WebHTMLRepresentation.
-
- at interface WebDataSource (WebBridge)
-- (WebBridge *)_bridge;
- at end
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index c7b2bd3..a08ee0b 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -19,16 +19,6 @@
 
 #import <WebFoundation/WebResourceHandle.h>
 
- at implementation WebDataSource (WebBridge)
-
-- (WebBridge *)_bridge
-{
-    id representation = [self representation];
-    return [representation respondsToSelector:@selector(_bridge)] ? [representation _bridge] : nil;
-}
-
- at end
-
 @interface NSApplication (DeclarationStolenFromAppKit)
 - (void)_cycleWindowsReversed:(BOOL)reversed;
 @end
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index 23f2b50..c6923e8 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -227,39 +227,30 @@
 
 - (void)haveContentPolicy: (WebContentPolicy)policy andPath: (NSString *)path forDataSource: (WebDataSource *)dataSource
 {
-    NSString *MIMEType;
-    
-    if(policy == WebContentPolicyNone)
+    if (policy == WebContentPolicyNone) {
         [NSException raise:NSInvalidArgumentException format:@"Can't set policy of WebContentPolicyNone. Use WebContentPolicyIgnore instead"];
+    }
         
-    if([dataSource contentPolicy] != WebContentPolicyNone){
+    if ([dataSource contentPolicy] != WebContentPolicyNone) {
         [NSException raise:NSGenericException format:@"Content policy can only be set once on for a dataSource."];
-    }else{
-        [dataSource _setContentPolicy:policy];
-        [dataSource _setDownloadPath:path];
+    }
+    
+    [dataSource _setContentPolicy:policy];
+    [dataSource _setDownloadPath:path];
         
-        if(policy == WebContentPolicyShow){
-            MIMEType = [dataSource contentType];
-            if([[self class] canShowMIMEType:MIMEType]){
-                id documentView;
-                WebView *webView;
-                id <WebDocumentRepresentation> dataRepresentation, oldRepresentation;
-                
-                // Check if the data source was already bound?
-                oldRepresentation = [dataSource representation];
-                dataRepresentation = [WebDataSource createRepresentationForMIMEType:MIMEType];
-                if (!oldRepresentation || ![oldRepresentation isKindOfClass: [dataRepresentation class]])
-                    [dataSource _setRepresentation:dataRepresentation];
-                webView = [[dataSource webFrame] webView];
-                documentView = [WebView createViewForMIMEType:MIMEType];
-                [webView _setDocumentView: documentView];
-                [documentView provisionalDataSourceChanged: dataSource];
-            }else{
-                WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCannotShowMIMEType 
-                                    inDomain:WebErrorDomainWebKit failingURL: [dataSource inputURL]];
-                [[self policyHandler] unableToImplementContentPolicy:error forDataSource:dataSource];
-            }
-        }
+    if (policy == WebContentPolicyShow){
+	if ([[self class] canShowMIMEType:[dataSource contentType]]){
+	    WebView *webView = [[dataSource webFrame] webView];
+	    [dataSource makeRepresentation];
+	    [webView makeDocumentViewForMIMEType:[dataSource contentType]];
+	    // FIXME: this ought to be part of makeDocumentView but I need to figure out
+	    // the provisional / committed situation
+	    [[webView documentView] provisionalDataSourceChanged:dataSource];
+	} else {
+	    WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCannotShowMIMEType 
+			           inDomain:WebErrorDomainWebKit failingURL: [dataSource inputURL]];
+	    [[self policyHandler] unableToImplementContentPolicy:error forDataSource:dataSource];
+	}
     }
 }
 
diff --git a/WebKit/WebView.subproj/WebDataSource.h b/WebKit/WebView.subproj/WebDataSource.h
index d4d20d0..e9159e3 100644
--- a/WebKit/WebView.subproj/WebDataSource.h
+++ b/WebKit/WebView.subproj/WebDataSource.h
@@ -173,6 +173,6 @@
 
 + (void) registerRepresentationClass:(Class)repClass forMIMEType:(NSString *)MIMEType;
 
-+ (id <WebDocumentRepresentation>) createRepresentationForMIMEType:(NSString *)MIMEType;
+- (void) makeRepresentation;
 
 @end
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index ec090c6..5de16ee 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -345,10 +345,14 @@
     [[self _repTypes] setObject:repClass forKey:MIMEType];
 }
 
-+ (id <WebDocumentRepresentation>) createRepresentationForMIMEType:(NSString *)MIMEType
+- (void) makeRepresentation
 {
-    Class repClass = [[self _repTypes] _web_objectForMIMEType:MIMEType];
-    return repClass ? [[[repClass alloc] init] autorelease] : nil;
+    Class repClass = [self _representationClass];
+
+    // Check if the data source was already bound?
+    if (![[self representation] isKindOfClass:repClass]) {
+	[self _setRepresentation:repClass != nil ? [[repClass alloc] init] : nil];
+    }
 }
 
 @end
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index 4626962..39c699b 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -8,7 +8,7 @@
 
 #import <WebKit/WebDataSource.h>
 #import <WebKit/WebLocationChangeHandler.h>
-
+#import <WebKit/WebBridge.h>
 
 @class WebResourceHandle;
 @class WebMainResourceClient;
@@ -73,7 +73,8 @@
 
 @interface WebDataSource (WebPrivate)
 - (void)_setResourceData:(NSData *)data;
-- (void)_setRepresentation:(id <WebDocumentRepresentation>)representation;
+- (Class)_representationClass;
+- (void)_setRepresentation: (id<WebDocumentRepresentation>)representation;
 - (void)_setController: (WebController *)controller;
 - (void)_setParent: (WebDataSource *)p;
 - (void)_startLoading: (BOOL)forceRefresh;
@@ -99,4 +100,8 @@
 + (NSMutableDictionary *)_repTypes;
 + (BOOL)_canShowMIMEType:(NSString *)MIMEType;
 - (void)_removeFromFrame;
+
+// Convenience interface for getting here from an WebDataSource.
+// This returns nil if the representation is not an WebHTMLRepresentation.
+- (WebBridge *)_bridge;
 @end
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index feb7791..271602c 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -86,12 +86,17 @@
     _private->resourceData = [data retain];
 }
 
-- (void)_setRepresentation:(id <WebDocumentRepresentation>) representation
+- (void)_setRepresentation: (id<WebDocumentRepresentation>)representation
 {
     [_private->representation release];
     _private->representation = [representation retain];
 }
 
+- (Class)_representationClass
+{
+    return [[[self class] _repTypes] _web_objectForMIMEType:[self contentType]];
+}
+
 - (void)_setLoading:(BOOL)loading
 {
     WEBKIT_ASSERT_VALID_ARG("loading", loading == NO || loading == YES);
@@ -396,4 +401,10 @@
     [self _setLocationChangeHandler:nil];
 }
 
+- (WebBridge *)_bridge
+{
+    id representation = [self representation];
+    return [representation respondsToSelector:@selector(_bridge)] ? [representation _bridge] : nil;
+}
+
 @end
diff --git a/WebKit/WebView.subproj/WebFrameView.h b/WebKit/WebView.subproj/WebFrameView.h
index 95f60c5..3e89021 100644
--- a/WebKit/WebView.subproj/WebFrameView.h
+++ b/WebKit/WebView.subproj/WebFrameView.h
@@ -40,7 +40,6 @@
 // The view must conform to the WebDocumentLoading protocol
 + (void)registerViewClass:(Class)viewClass forMIMEType:(NSString *)MIMEType;
 
-// Called when the contentPolicy is set to WebContentPolicyShow
-+ (id <WebDocumentLoading>) createViewForMIMEType:(NSString *)MIMEType;
+-(void)makeDocumentViewForMIMEType:(NSString *)MIMEType;
 
 @end
diff --git a/WebKit/WebView.subproj/WebFrameView.m b/WebKit/WebView.subproj/WebFrameView.m
index e249382..ce6e3eb 100644
--- a/WebKit/WebView.subproj/WebFrameView.m
+++ b/WebKit/WebView.subproj/WebFrameView.m
@@ -199,10 +199,10 @@ enum {
     [[self _viewTypes] setObject:viewClass forKey:MIMEType];
 }
 
-+ (id <WebDocumentLoading>) createViewForMIMEType:(NSString *)MIMEType
+-(void)makeDocumentViewForMIMEType:(NSString *)MIMEType
 {
-    Class viewClass = [[self _viewTypes] _web_objectForMIMEType:MIMEType];
-    return viewClass ? [[[viewClass alloc] init] autorelease] : nil;
+    Class viewClass = [[[self class] _viewTypes] _web_objectForMIMEType:MIMEType];
+    [self _setDocumentView: (id<WebDocumentLoading>)(viewClass ? [[[viewClass alloc] init] autorelease] : nil)];
 }
 
 -(BOOL)acceptsFirstResponder
diff --git a/WebKit/WebView.subproj/WebFrameViewPrivate.m b/WebKit/WebView.subproj/WebFrameViewPrivate.m
index eb594ba..7fe10f0 100644
--- a/WebKit/WebView.subproj/WebFrameViewPrivate.m
+++ b/WebKit/WebView.subproj/WebFrameViewPrivate.m
@@ -65,7 +65,6 @@
     [[self frameScrollView] setDocumentView: view];    
 }
 
-
 - (void)_setController: (WebController *)controller
 {
     // Not retained; the controller owns the view.
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.m b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
index a7ee35d..5a5b3b0 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.m
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
@@ -17,6 +17,7 @@
 #import <WebKit/WebBridge.h>
 #import <WebKit/WebFramePrivate.h>
 #import <WebKit/WebViewPrivate.h>
+#import <WebKit/WebDataSourcePrivate.h>
 
 @interface NSView (WebHTMLViewPrivate)
 - (void)_web_stopIfPluginView;
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 23f2b50..c6923e8 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -227,39 +227,30 @@
 
 - (void)haveContentPolicy: (WebContentPolicy)policy andPath: (NSString *)path forDataSource: (WebDataSource *)dataSource
 {
-    NSString *MIMEType;
-    
-    if(policy == WebContentPolicyNone)
+    if (policy == WebContentPolicyNone) {
         [NSException raise:NSInvalidArgumentException format:@"Can't set policy of WebContentPolicyNone. Use WebContentPolicyIgnore instead"];
+    }
         
-    if([dataSource contentPolicy] != WebContentPolicyNone){
+    if ([dataSource contentPolicy] != WebContentPolicyNone) {
         [NSException raise:NSGenericException format:@"Content policy can only be set once on for a dataSource."];
-    }else{
-        [dataSource _setContentPolicy:policy];
-        [dataSource _setDownloadPath:path];
+    }
+    
+    [dataSource _setContentPolicy:policy];
+    [dataSource _setDownloadPath:path];
         
-        if(policy == WebContentPolicyShow){
-            MIMEType = [dataSource contentType];
-            if([[self class] canShowMIMEType:MIMEType]){
-                id documentView;
-                WebView *webView;
-                id <WebDocumentRepresentation> dataRepresentation, oldRepresentation;
-                
-                // Check if the data source was already bound?
-                oldRepresentation = [dataSource representation];
-                dataRepresentation = [WebDataSource createRepresentationForMIMEType:MIMEType];
-                if (!oldRepresentation || ![oldRepresentation isKindOfClass: [dataRepresentation class]])
-                    [dataSource _setRepresentation:dataRepresentation];
-                webView = [[dataSource webFrame] webView];
-                documentView = [WebView createViewForMIMEType:MIMEType];
-                [webView _setDocumentView: documentView];
-                [documentView provisionalDataSourceChanged: dataSource];
-            }else{
-                WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCannotShowMIMEType 
-                                    inDomain:WebErrorDomainWebKit failingURL: [dataSource inputURL]];
-                [[self policyHandler] unableToImplementContentPolicy:error forDataSource:dataSource];
-            }
-        }
+    if (policy == WebContentPolicyShow){
+	if ([[self class] canShowMIMEType:[dataSource contentType]]){
+	    WebView *webView = [[dataSource webFrame] webView];
+	    [dataSource makeRepresentation];
+	    [webView makeDocumentViewForMIMEType:[dataSource contentType]];
+	    // FIXME: this ought to be part of makeDocumentView but I need to figure out
+	    // the provisional / committed situation
+	    [[webView documentView] provisionalDataSourceChanged:dataSource];
+	} else {
+	    WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCannotShowMIMEType 
+			           inDomain:WebErrorDomainWebKit failingURL: [dataSource inputURL]];
+	    [[self policyHandler] unableToImplementContentPolicy:error forDataSource:dataSource];
+	}
     }
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list