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

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:20:23 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 4f892f8ac678df813f0b655bcc3831b52a02011e
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jun 18 02:35:45 2002 +0000

        Fixed window.open regression.
        Partial fix to targeting frame of new name.
    
    	* kwq/KWQKHTMLPart.mm:
    	(KWQKHTMLPartImpl::urlSelected):
    	    Partial fix to frame not found problem.
    	* kwq/KWQKHTMLPartBrowserExtension.mm:
    	(KHTMLPartBrowserExtension::createNewWindow):
    	    Fix for window.open regression.
    	* kwq/WebCoreBridge.h:
            Changed return type of openNewWindowWithURL:
    
        Fixed window.open regression.
        Partial fix to targeting frame of new name.
    
    	* WebCoreSupport.subproj/IFWebCoreBridge.h:
    	* WebCoreSupport.subproj/IFWebCoreBridge.mm:
    	(-[IFWebCoreBridge openNewWindowWithURL:]):
    	    Return the newly created bridge.
    	(-[IFWebCoreBridge receivedData:withDataSource:]):
    	    Use setDataSource: method
    	(-[IFWebCoreBridge startLoadingResource:withURL:]):
    	    No change.
    	(-[IFWebCoreBridge setDataSource:]):
    	    New method.
    	* WebView.subproj/IFHTMLView.mm:
    	(-[IFHTMLView mouseMovedNotification:]):
    	    Selection support.
    	(-[IFHTMLView mouseDragged:]):
    	    Selection support.
    
    	* WebView.subproj/IFWebController.mm:
    	(-[IFWebController haveContentPolicy:andPath:forLocationChangeHandler:]):
            Only change representation if it hasn't been pre-bound, or if it's
            class changed.
    
    	* WebView.subproj/IFWebFrame.mm:
    	(-[IFWebFrame initWithName:webView:provisionalDataSource:controller:]):
    	    More hackery to support window.open.
    
    	* WebController.m:
    	(-[WebController openNewWindowWithURL:]):
    	    Cleanup.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1396 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index a7409bf..2704069 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,17 @@
+2002-06-17  Richard Williamson  <rjw at apple.com>
+
+    Fixed window.open regression.
+    Partial fix to targeting frame of new name.
+    
+	* kwq/KWQKHTMLPart.mm:
+	(KWQKHTMLPartImpl::urlSelected):
+	    Partial fix to frame not found problem.
+	* kwq/KWQKHTMLPartBrowserExtension.mm:
+	(KHTMLPartBrowserExtension::createNewWindow):
+	    Fix for window.open regression.
+	* kwq/WebCoreBridge.h:
+        Changed return type of openNewWindowWithURL:
+
 2002-06-17  Darin Adler  <darin at apple.com>
 
 	Fixed a storage leak.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index a7409bf..2704069 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,17 @@
+2002-06-17  Richard Williamson  <rjw at apple.com>
+
+    Fixed window.open regression.
+    Partial fix to targeting frame of new name.
+    
+	* kwq/KWQKHTMLPart.mm:
+	(KWQKHTMLPartImpl::urlSelected):
+	    Partial fix to frame not found problem.
+	* kwq/KWQKHTMLPartBrowserExtension.mm:
+	(KHTMLPartBrowserExtension::createNewWindow):
+	    Fix for window.open regression.
+	* kwq/WebCoreBridge.h:
+        Changed return type of openNewWindowWithURL:
+
 2002-06-17  Darin Adler  <darin at apple.com>
 
 	Fixed a storage leak.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index a7409bf..2704069 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,17 @@
+2002-06-17  Richard Williamson  <rjw at apple.com>
+
+    Fixed window.open regression.
+    Partial fix to targeting frame of new name.
+    
+	* kwq/KWQKHTMLPart.mm:
+	(KWQKHTMLPartImpl::urlSelected):
+	    Partial fix to frame not found problem.
+	* kwq/KWQKHTMLPartBrowserExtension.mm:
+	(KHTMLPartBrowserExtension::createNewWindow):
+	    Fix for window.open regression.
+	* kwq/WebCoreBridge.h:
+        Changed return type of openNewWindowWithURL:
+
 2002-06-17  Darin Adler  <darin at apple.com>
 
 	Fixed a storage leak.
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 7da4a00..2b61bce 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -413,9 +413,8 @@ void KWQKHTMLPartImpl::urlSelected( const QString &url, int button, int state, c
     else {
         frame = [bridge descendantFrameNamed:_target.getNSString()];
         if (frame == nil) {
-            // FIXME: What is the correct behavior here? Other browsers seem to open new windows.
-            NSLog (@"ERROR: unable to find frame named %@\n", _target.getNSString());
-            return;
+            NSLog (@"WARNING: unable to find frame named %@, creating new window with \"_blank\" name.  New window will not be named until 2959902 is fixed.\n", _target.getNSString());
+                frame = [bridge descendantFrameNamed:@"_blank"];
         }
     }
     
diff --git a/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm b/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
index cba08e3..7fcd03e 100644
--- a/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
+++ b/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
@@ -58,12 +58,13 @@ void KHTMLPartBrowserExtension::createNewWindow(const KURL &url,
 						const KParts::WindowArgs &winArgs, 
 						KParts::ReadOnlyPart **partResult)
 { 
-    [m_part->impl->getBridge() openNewWindowWithURL:url.getNSURL()];
+    WebCoreBridge *bridge = [m_part->impl->getBridge() openNewWindowWithURL:url.getNSURL()];
     
     // We can't return a KHTMLPart in all cases, because the new window might not even
     // have HTML in it. And we don't create the KHTMLPart until we become "committed".
     // So it's better not to try to return the KHTMLPart, and no callers currently need it.
-    if (partResult) {
-	*partResult = 0;
-    }
+    //if (partResult) {
+	//    *partResult = 0;
+    //}
+    *partResult = [bridge part];
 }
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index 7da4a00..2b61bce 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -413,9 +413,8 @@ void KWQKHTMLPartImpl::urlSelected( const QString &url, int button, int state, c
     else {
         frame = [bridge descendantFrameNamed:_target.getNSString()];
         if (frame == nil) {
-            // FIXME: What is the correct behavior here? Other browsers seem to open new windows.
-            NSLog (@"ERROR: unable to find frame named %@\n", _target.getNSString());
-            return;
+            NSLog (@"WARNING: unable to find frame named %@, creating new window with \"_blank\" name.  New window will not be named until 2959902 is fixed.\n", _target.getNSString());
+                frame = [bridge descendantFrameNamed:@"_blank"];
         }
     }
     
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index ad36449..16c7fe7 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -105,7 +105,7 @@ typedef khtml::RenderPart KHTMLRenderPart;
     withURL:(NSURL *)URL renderPart:(KHTMLRenderPart *)renderPart
     allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height;
 
-- (void)openNewWindowWithURL:(NSURL *)URL;
+- (WebCoreBridge *)openNewWindowWithURL:(NSURL *)URL;
 
 - (IFURLHandle *)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL;
 
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index d8383c4..661b55d 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,33 @@
+2002-06-17  Richard Williamson  <rjw at apple.com>
+
+    Fixed window.open regression.
+    Partial fix to targeting frame of new name.
+    
+	* WebCoreSupport.subproj/IFWebCoreBridge.h:
+	* WebCoreSupport.subproj/IFWebCoreBridge.mm:
+	(-[IFWebCoreBridge openNewWindowWithURL:]):
+	    Return the newly created bridge.
+	(-[IFWebCoreBridge receivedData:withDataSource:]):
+	    Use setDataSource: method
+	(-[IFWebCoreBridge startLoadingResource:withURL:]):
+	    No change.
+	(-[IFWebCoreBridge setDataSource:]):
+	    New method.
+	* WebView.subproj/IFHTMLView.mm:
+	(-[IFHTMLView mouseMovedNotification:]):
+	    Selection support.
+	(-[IFHTMLView mouseDragged:]):
+	    Selection support.
+
+	* WebView.subproj/IFWebController.mm:
+	(-[IFWebController haveContentPolicy:andPath:forLocationChangeHandler:]):
+        Only change representation if it hasn't been pre-bound, or if it's
+        class changed.
+        
+	* WebView.subproj/IFWebFrame.mm:
+	(-[IFWebFrame initWithName:webView:provisionalDataSource:controller:]):
+	    More hackery to support window.open.
+
 2002-06-17  Darin Adler  <darin at apple.com>
 
 	Fixed many of the reasons that we were leaking the world. But we still leak
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index d8383c4..661b55d 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,33 @@
+2002-06-17  Richard Williamson  <rjw at apple.com>
+
+    Fixed window.open regression.
+    Partial fix to targeting frame of new name.
+    
+	* WebCoreSupport.subproj/IFWebCoreBridge.h:
+	* WebCoreSupport.subproj/IFWebCoreBridge.mm:
+	(-[IFWebCoreBridge openNewWindowWithURL:]):
+	    Return the newly created bridge.
+	(-[IFWebCoreBridge receivedData:withDataSource:]):
+	    Use setDataSource: method
+	(-[IFWebCoreBridge startLoadingResource:withURL:]):
+	    No change.
+	(-[IFWebCoreBridge setDataSource:]):
+	    New method.
+	* WebView.subproj/IFHTMLView.mm:
+	(-[IFHTMLView mouseMovedNotification:]):
+	    Selection support.
+	(-[IFHTMLView mouseDragged:]):
+	    Selection support.
+
+	* WebView.subproj/IFWebController.mm:
+	(-[IFWebController haveContentPolicy:andPath:forLocationChangeHandler:]):
+        Only change representation if it hasn't been pre-bound, or if it's
+        class changed.
+        
+	* WebView.subproj/IFWebFrame.mm:
+	(-[IFWebFrame initWithName:webView:provisionalDataSource:controller:]):
+	    More hackery to support window.open.
+
 2002-06-17  Darin Adler  <darin at apple.com>
 
 	Fixed many of the reasons that we were leaking the world. But we still leak
diff --git a/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.h b/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.h
index c392abc..09bbeb1 100644
--- a/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.h
+++ b/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.h
@@ -16,6 +16,7 @@
 }
 
 - (void)receivedData:(NSData *)data withDataSource:(IFWebDataSource *)dataSource;
+- (void)setDataSource: (IFWebDataSource *)ds;
 
 @end
 
diff --git a/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.mm b/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.mm
index a715cc2..4b4449d 100644
--- a/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.mm
+++ b/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.mm
@@ -5,6 +5,7 @@
 
 #import <WebKit/IFWebCoreBridge.h>
 
+#import <WebKit/IFHTMLRepresentation.h>
 #import <WebKit/IFResourceURLHandleClient.h>
 #import <WebKit/IFWebControllerPrivate.h>
 #import <WebKit/IFWebCoreFrame.h>
@@ -83,9 +84,16 @@
     return YES;
 }
 
-- (void)openNewWindowWithURL:(NSURL *)url
+- (WebCoreBridge *)openNewWindowWithURL:(NSURL *)url
 {
-    [[dataSource controller] openNewWindowWithURL:url];
+    IFWebController *newController = [[dataSource controller] openNewWindowWithURL:url];
+    IFWebDataSource *newDataSource;
+    
+    newDataSource = [[newController mainFrame] provisionalDataSource];
+    if ([newDataSource isDocumentHTML])
+        return [(IFHTMLRepresentation *)[newDataSource representation] _bridge];
+        
+    return nil;
 }
 
 - (void)setTitle:(NSString *)title
@@ -107,7 +115,7 @@
 - (void)receivedData:(NSData *)data withDataSource:(IFWebDataSource *)withDataSource
 {
     if (dataSource == nil) {
-        dataSource = withDataSource; // FIXME: non-retained because data source owns representation owns bridge
+        [self setDataSource: withDataSource];
         [self openURL:[dataSource inputURL]];
     } else {
         WEBKIT_ASSERT(dataSource == withDataSource);
@@ -121,4 +129,10 @@
     return [IFResourceURLHandleClient startLoadingResource:resourceLoader withURL:URL dataSource:dataSource];
 }
 
+- (void)setDataSource: (IFWebDataSource *)ds
+{
+    // FIXME: non-retained because data source owns representation owns bridge
+    dataSource = ds;
+}
+
 @end
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.h b/WebKit/WebCoreSupport.subproj/WebBridge.h
index c392abc..09bbeb1 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.h
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.h
@@ -16,6 +16,7 @@
 }
 
 - (void)receivedData:(NSData *)data withDataSource:(IFWebDataSource *)dataSource;
+- (void)setDataSource: (IFWebDataSource *)ds;
 
 @end
 
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index a715cc2..4b4449d 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -5,6 +5,7 @@
 
 #import <WebKit/IFWebCoreBridge.h>
 
+#import <WebKit/IFHTMLRepresentation.h>
 #import <WebKit/IFResourceURLHandleClient.h>
 #import <WebKit/IFWebControllerPrivate.h>
 #import <WebKit/IFWebCoreFrame.h>
@@ -83,9 +84,16 @@
     return YES;
 }
 
-- (void)openNewWindowWithURL:(NSURL *)url
+- (WebCoreBridge *)openNewWindowWithURL:(NSURL *)url
 {
-    [[dataSource controller] openNewWindowWithURL:url];
+    IFWebController *newController = [[dataSource controller] openNewWindowWithURL:url];
+    IFWebDataSource *newDataSource;
+    
+    newDataSource = [[newController mainFrame] provisionalDataSource];
+    if ([newDataSource isDocumentHTML])
+        return [(IFHTMLRepresentation *)[newDataSource representation] _bridge];
+        
+    return nil;
 }
 
 - (void)setTitle:(NSString *)title
@@ -107,7 +115,7 @@
 - (void)receivedData:(NSData *)data withDataSource:(IFWebDataSource *)withDataSource
 {
     if (dataSource == nil) {
-        dataSource = withDataSource; // FIXME: non-retained because data source owns representation owns bridge
+        [self setDataSource: withDataSource];
         [self openURL:[dataSource inputURL]];
     } else {
         WEBKIT_ASSERT(dataSource == withDataSource);
@@ -121,4 +129,10 @@
     return [IFResourceURLHandleClient startLoadingResource:resourceLoader withURL:URL dataSource:dataSource];
 }
 
+- (void)setDataSource: (IFWebDataSource *)ds
+{
+    // FIXME: non-retained because data source owns representation owns bridge
+    dataSource = ds;
+}
+
 @end
diff --git a/WebKit/WebView.subproj/IFHTMLView.mm b/WebKit/WebView.subproj/IFHTMLView.mm
index 49a9e74..0fa7bca 100644
--- a/WebKit/WebView.subproj/IFHTMLView.mm
+++ b/WebKit/WebView.subproj/IFHTMLView.mm
@@ -535,7 +535,7 @@
     if ([thisWindow isMainWindow] &&
         [[[notification userInfo] objectForKey: @"NSEvent"] window] == thisWindow &&
         [[thisWindow contentView] hitTest:p] == self) {
-        QMouseEvent kEvent(QEvent::MouseButtonPress, QPoint((int)p.x, (int)p.y), 0, 0);
+        QMouseEvent kEvent(QEvent::MouseMove, QPoint((int)p.x, (int)p.y), 0, 0);
         KHTMLView *widget = _private->widget;
         if (widget != 0l) {
             widget->viewportMouseMoveEvent(&kEvent);
@@ -546,7 +546,12 @@
 - (void)mouseDragged: (NSEvent *)event
 {
     NSPoint p = [event locationInWindow];
-    //WebKitDebugAtLevel (WEBKIT_LOG_EVENTS, "mouseDragged %f, %f\n", p.x, p.y);
+    
+    QMouseEvent kEvent(QEvent::MouseMove, QPoint((int)p.x, (int)p.y), Qt::LeftButton, Qt::LeftButton);
+    KHTMLView *widget = _private->widget;
+    if (widget != 0l) {
+        widget->viewportMouseMoveEvent(&kEvent);
+    }
 }
 
 - (void)keyDown: (NSEvent *)event
diff --git a/WebKit/WebView.subproj/IFWebController.mm b/WebKit/WebView.subproj/IFWebController.mm
index 8226598..172039d 100644
--- a/WebKit/WebView.subproj/IFWebController.mm
+++ b/WebKit/WebView.subproj/IFWebController.mm
@@ -250,10 +250,13 @@
                 if([[self class] canShowMIMEType:MIMEType]){
                     id documentView;
                     IFWebView *webView;
-                    id <IFDocumentRepresentation> dataRepresentation;
+                    id <IFDocumentRepresentation> dataRepresentation, oldRepresentation;
                     
+                    // Check if the data source was already bound?
+                    oldRepresentation = [dataSource representation];
                     dataRepresentation = [IFWebDataSource createRepresentationForMIMEType:MIMEType];
-                    [dataSource _setRepresentation:dataRepresentation];
+                    if (!oldRepresentation || ![oldRepresentation isKindOfClass: [dataRepresentation class]])
+                        [dataSource _setRepresentation:dataRepresentation];
                     webView = [[dataSource webFrame] webView];
                     documentView = [IFWebView createViewForMIMEType:MIMEType];
                     [webView _setDocumentView: documentView];
diff --git a/WebKit/WebView.subproj/IFWebFrame.mm b/WebKit/WebView.subproj/IFWebFrame.mm
index feca593..505eb1e 100644
--- a/WebKit/WebView.subproj/IFWebFrame.mm
+++ b/WebKit/WebView.subproj/IFWebFrame.mm
@@ -1,22 +1,21 @@
 /*	
         IFWebFrame.m
-	    
-	    Copyright 2001, Apple, Inc. All rights reserved.
+	    Copyright (c) 2001, Apple, Inc. All rights reserved.
 */
 
 #import <WebKit/IFWebFrame.h>
 
 #import <Cocoa/Cocoa.h>
 
+#import <WebKit/IFHTMLRepresentationPrivate.h>
+#import <WebKit/IFHTMLViewPrivate.h>
+#import <WebKit/IFWebControllerPrivate.h>
+#import <WebKit/IFWebCoreBridge.h>
 #import <WebKit/IFWebCoreFrame.h>
+#import <WebKit/IFWebDataSourcePrivate.h>
 #import <WebKit/IFWebFramePrivate.h>
 #import <WebKit/IFWebViewPrivate.h>
-#import <WebKit/IFWebDataSourcePrivate.h>
-#import <WebKit/IFWebControllerPrivate.h>
-#import <WebKit/IFWebController.h>
 #import <WebKit/IFLocationChangeHandler.h>
-#import <WebKit/IFHTMLView.h>
-#import <WebKit/IFHTMLViewPrivate.h>
 
 #import <WebFoundation/WebFoundation.h>
 
@@ -43,20 +42,29 @@
     [self setController: c];
 
     if (d == nil) {
-	// Set a dummy data source so that the main frame for a
-	// newly-created empty window has a KHTMLPart. JavaScript
-	// always creates new windows initially empty, and then wants
-	// to use the main frame's part to make the new window load
-	// it's URL, so we need to make sure empty frames have a part.
-	// However, we don't want to do the spinner, so we do this
-	// weird thing:
-
-	IFWebDataSource *dummyDataSource = [[IFWebDataSource alloc] initWithURL:nil];
+        // set a dummy data source so that the main from for a
+        // newly-created empty window has a KHTMLPart. JavaScript
+        // always creates new windows initially empty, and then wants
+        // to use the main frame's part to make the new window load
+        // it's URL, so we need to make sure empty frames have a part.
+        // However, we don't want to do the spinner, so we do this
+        // weird thing:
+
+        // FIXME: HACK ALERT!!!
+        // We need to keep a shadow part for all frames, even in the case
+        // of a non HTML representation.  This is required khtml
+        // can reference the frame (window.frames, targeting, etc.).
+    
+        IFWebDataSource *dummyDataSource = [[IFWebDataSource alloc] initWithURL:nil];
+        IFHTMLRepresentation *dummyRep = [[IFHTMLRepresentation alloc] init];
+        [[dummyRep _bridge] setDataSource: dummyDataSource];
+        [dummyDataSource _setRepresentation: dummyRep];
+        [dummyRep release];
+
         [dummyDataSource _setController: [self controller]];
         [_private setProvisionalDataSource: dummyDataSource];
         [dummyDataSource release];
-
-    // Allow controller to override?
+        
     } else if ([self setProvisionalDataSource: d] == NO){
         [self autorelease];
         return nil;
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index 8226598..172039d 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -250,10 +250,13 @@
                 if([[self class] canShowMIMEType:MIMEType]){
                     id documentView;
                     IFWebView *webView;
-                    id <IFDocumentRepresentation> dataRepresentation;
+                    id <IFDocumentRepresentation> dataRepresentation, oldRepresentation;
                     
+                    // Check if the data source was already bound?
+                    oldRepresentation = [dataSource representation];
                     dataRepresentation = [IFWebDataSource createRepresentationForMIMEType:MIMEType];
-                    [dataSource _setRepresentation:dataRepresentation];
+                    if (!oldRepresentation || ![oldRepresentation isKindOfClass: [dataRepresentation class]])
+                        [dataSource _setRepresentation:dataRepresentation];
                     webView = [[dataSource webFrame] webView];
                     documentView = [IFWebView createViewForMIMEType:MIMEType];
                     [webView _setDocumentView: documentView];
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index feca593..505eb1e 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -1,22 +1,21 @@
 /*	
         IFWebFrame.m
-	    
-	    Copyright 2001, Apple, Inc. All rights reserved.
+	    Copyright (c) 2001, Apple, Inc. All rights reserved.
 */
 
 #import <WebKit/IFWebFrame.h>
 
 #import <Cocoa/Cocoa.h>
 
+#import <WebKit/IFHTMLRepresentationPrivate.h>
+#import <WebKit/IFHTMLViewPrivate.h>
+#import <WebKit/IFWebControllerPrivate.h>
+#import <WebKit/IFWebCoreBridge.h>
 #import <WebKit/IFWebCoreFrame.h>
+#import <WebKit/IFWebDataSourcePrivate.h>
 #import <WebKit/IFWebFramePrivate.h>
 #import <WebKit/IFWebViewPrivate.h>
-#import <WebKit/IFWebDataSourcePrivate.h>
-#import <WebKit/IFWebControllerPrivate.h>
-#import <WebKit/IFWebController.h>
 #import <WebKit/IFLocationChangeHandler.h>
-#import <WebKit/IFHTMLView.h>
-#import <WebKit/IFHTMLViewPrivate.h>
 
 #import <WebFoundation/WebFoundation.h>
 
@@ -43,20 +42,29 @@
     [self setController: c];
 
     if (d == nil) {
-	// Set a dummy data source so that the main frame for a
-	// newly-created empty window has a KHTMLPart. JavaScript
-	// always creates new windows initially empty, and then wants
-	// to use the main frame's part to make the new window load
-	// it's URL, so we need to make sure empty frames have a part.
-	// However, we don't want to do the spinner, so we do this
-	// weird thing:
-
-	IFWebDataSource *dummyDataSource = [[IFWebDataSource alloc] initWithURL:nil];
+        // set a dummy data source so that the main from for a
+        // newly-created empty window has a KHTMLPart. JavaScript
+        // always creates new windows initially empty, and then wants
+        // to use the main frame's part to make the new window load
+        // it's URL, so we need to make sure empty frames have a part.
+        // However, we don't want to do the spinner, so we do this
+        // weird thing:
+
+        // FIXME: HACK ALERT!!!
+        // We need to keep a shadow part for all frames, even in the case
+        // of a non HTML representation.  This is required khtml
+        // can reference the frame (window.frames, targeting, etc.).
+    
+        IFWebDataSource *dummyDataSource = [[IFWebDataSource alloc] initWithURL:nil];
+        IFHTMLRepresentation *dummyRep = [[IFHTMLRepresentation alloc] init];
+        [[dummyRep _bridge] setDataSource: dummyDataSource];
+        [dummyDataSource _setRepresentation: dummyRep];
+        [dummyRep release];
+
         [dummyDataSource _setController: [self controller]];
         [_private setProvisionalDataSource: dummyDataSource];
         [dummyDataSource release];
-
-    // Allow controller to override?
+        
     } else if ([self setProvisionalDataSource: d] == NO){
         [self autorelease];
         return nil;
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 49a9e74..0fa7bca 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -535,7 +535,7 @@
     if ([thisWindow isMainWindow] &&
         [[[notification userInfo] objectForKey: @"NSEvent"] window] == thisWindow &&
         [[thisWindow contentView] hitTest:p] == self) {
-        QMouseEvent kEvent(QEvent::MouseButtonPress, QPoint((int)p.x, (int)p.y), 0, 0);
+        QMouseEvent kEvent(QEvent::MouseMove, QPoint((int)p.x, (int)p.y), 0, 0);
         KHTMLView *widget = _private->widget;
         if (widget != 0l) {
             widget->viewportMouseMoveEvent(&kEvent);
@@ -546,7 +546,12 @@
 - (void)mouseDragged: (NSEvent *)event
 {
     NSPoint p = [event locationInWindow];
-    //WebKitDebugAtLevel (WEBKIT_LOG_EVENTS, "mouseDragged %f, %f\n", p.x, p.y);
+    
+    QMouseEvent kEvent(QEvent::MouseMove, QPoint((int)p.x, (int)p.y), Qt::LeftButton, Qt::LeftButton);
+    KHTMLView *widget = _private->widget;
+    if (widget != 0l) {
+        widget->viewportMouseMoveEvent(&kEvent);
+    }
 }
 
 - (void)keyDown: (NSEvent *)event
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 8226598..172039d 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -250,10 +250,13 @@
                 if([[self class] canShowMIMEType:MIMEType]){
                     id documentView;
                     IFWebView *webView;
-                    id <IFDocumentRepresentation> dataRepresentation;
+                    id <IFDocumentRepresentation> dataRepresentation, oldRepresentation;
                     
+                    // Check if the data source was already bound?
+                    oldRepresentation = [dataSource representation];
                     dataRepresentation = [IFWebDataSource createRepresentationForMIMEType:MIMEType];
-                    [dataSource _setRepresentation:dataRepresentation];
+                    if (!oldRepresentation || ![oldRepresentation isKindOfClass: [dataRepresentation class]])
+                        [dataSource _setRepresentation:dataRepresentation];
                     webView = [[dataSource webFrame] webView];
                     documentView = [IFWebView createViewForMIMEType:MIMEType];
                     [webView _setDocumentView: documentView];

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list