[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 05:54:39 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 85a95b681f7fdcd6f21aaf1a2f0d0f204604c8b5
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Jan 29 23:14:19 2002 +0000
First pass at frame code. Still needs lots of cleanup.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 2be5388..403a9b6 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,23 @@
+2002-01-29 Richard Williamson <rjw at apple.com>
+
+ First pass at frame code. Still needs lots of cleanup.
+
+ * WebKit.pbproj/project.pbxproj:
+ * WebView.subproj/WKDefaultWebController.h:
+ * WebView.subproj/WKDefaultWebController.mm: (-[WKDefaultWebController init]):
+ * WebView.subproj/WKWebDataSource.h:
+ * WebView.subproj/WKWebDataSource.mm: (-[WKWebDataSource dealloc]),
+ (-[WKWebDataSource frameName]), (-[WKWebDataSource parent]), (-[WKWebDataSource
+ children]), (-[WKWebDataSource addFrame:]), (-[WKWebDataSource frameNamed:]):
+ * WebView.subproj/WKWebDataSourcePrivate.h:
+ * WebView.subproj/WKWebDataSourcePrivate.mm: (-[WKWebDataSourcePrivate init]),
+ (-[WKWebDataSourcePrivate dealloc]), (-[WKWebDataSource _setController:]),
+ (-[WKWebDataSource _setFrameName:]):
+ * WebView.subproj/WKWebView.mm: (-[WKWebView mouseUp:]):
+ * WebView.subproj/WKWebViewPrivate.h:
+ * WebView.subproj/WKWebViewPrivate.mm: (-[WKWebViewPrivate dealloc]),
+ (-[WKWebView _setController:]), (-[WKWebView _widget]):
+
2002-01-29 Kenneth Kocienda <kocienda at apple.com>
WebKit now links with WebFoundation
@@ -5,6 +25,7 @@
* WebKit.pbproj/kocienda.pbxuser:
* WebKit.pbproj/project.pbxproj:
+
2002-01-23 Ken Kocienda <kocienda at apple.com>
Took out @executable_path hack added for Alexander demo.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 2be5388..403a9b6 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,23 @@
+2002-01-29 Richard Williamson <rjw at apple.com>
+
+ First pass at frame code. Still needs lots of cleanup.
+
+ * WebKit.pbproj/project.pbxproj:
+ * WebView.subproj/WKDefaultWebController.h:
+ * WebView.subproj/WKDefaultWebController.mm: (-[WKDefaultWebController init]):
+ * WebView.subproj/WKWebDataSource.h:
+ * WebView.subproj/WKWebDataSource.mm: (-[WKWebDataSource dealloc]),
+ (-[WKWebDataSource frameName]), (-[WKWebDataSource parent]), (-[WKWebDataSource
+ children]), (-[WKWebDataSource addFrame:]), (-[WKWebDataSource frameNamed:]):
+ * WebView.subproj/WKWebDataSourcePrivate.h:
+ * WebView.subproj/WKWebDataSourcePrivate.mm: (-[WKWebDataSourcePrivate init]),
+ (-[WKWebDataSourcePrivate dealloc]), (-[WKWebDataSource _setController:]),
+ (-[WKWebDataSource _setFrameName:]):
+ * WebView.subproj/WKWebView.mm: (-[WKWebView mouseUp:]):
+ * WebView.subproj/WKWebViewPrivate.h:
+ * WebView.subproj/WKWebViewPrivate.mm: (-[WKWebViewPrivate dealloc]),
+ (-[WKWebView _setController:]), (-[WKWebView _widget]):
+
2002-01-29 Kenneth Kocienda <kocienda at apple.com>
WebKit now links with WebFoundation
@@ -5,6 +25,7 @@
* WebKit.pbproj/kocienda.pbxuser:
* WebKit.pbproj/project.pbxproj:
+
2002-01-23 Ken Kocienda <kocienda at apple.com>
Took out @executable_path hack added for Alexander demo.
diff --git a/WebKit/Misc.subproj/WebKitDebug.h b/WebKit/Misc.subproj/WebKitDebug.h
index 99dde47..4e9f2cb 100644
--- a/WebKit/Misc.subproj/WebKitDebug.h
+++ b/WebKit/Misc.subproj/WebKitDebug.h
@@ -17,6 +17,10 @@
#define WEBKIT_LOG_NONE 0
#define WEBKIT_LOG_ALL 0xffffffff
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void WebKitSetLogLevel(int mask);
unsigned int WebKitGetLogLevel(void);
void WebKitDebug(const char *format, ...);
@@ -100,3 +104,7 @@ void WebKitLogAtLevel(unsigned int level, NSString *format, ...);
[[NSException exceptionWithName:NSInvalidArgumentException reason:reason userInfo: nil] raise]; \
} \
} while (0)
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/WebKit/Misc.subproj/WebKitDebug.m b/WebKit/Misc.subproj/WebKitDebug.m
index f70ecdb..7fb8d3a 100644
--- a/WebKit/Misc.subproj/WebKitDebug.m
+++ b/WebKit/Misc.subproj/WebKitDebug.m
@@ -11,17 +11,17 @@ void WebKitSetLogLevel(int mask) {
WEBKIT_LOG_LEVEL = mask;
}
-bool checkedDefault = 0;
+bool __checkedDefault = 0;
unsigned int WebKitGetLogLevel(){
- if (!checkedDefault){
+ if (!__checkedDefault){
NSString *logLevelString = [[NSUserDefaults standardUserDefaults] objectForKey:@"WebKitLogLevel"];
if (logLevelString != nil){
if (![[NSScanner scannerWithString: logLevelString] scanHexInt: &WEBKIT_LOG_LEVEL]){
NSLog (@"Unable to scan hex value for WebKitLogLevel, default to value of %d", WEBKIT_LOG_LEVEL);
}
}
- checkedDefault = 1;
+ __checkedDefault = 1;
}
return WEBKIT_LOG_LEVEL;
}
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index fea5554..2451f61 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -194,6 +194,7 @@
9C64424901F790750ECA16EA,
9C64424F01F7AF2D0ECA16EA,
9C64425001F7AF2D0ECA16EA,
+ 9C13328B01FFB40A0ECA16EA,
);
isa = PBXHeadersBuildPhase;
name = Headers;
@@ -227,6 +228,7 @@
9C64425201F7AF2D0ECA16EA,
9C64425401F7B1740ECA16EA,
9C64425601F7B4E20ECA16EA,
+ 9C13328C01FFB40A0ECA16EA,
);
isa = PBXSourcesBuildPhase;
name = Sources;
@@ -924,6 +926,33 @@
);
};
};
+ 9C13328901FFB40A0ECA16EA = {
+ isa = PBXFileReference;
+ name = WKWebFrame.h;
+ path = WebView.subproj/WKWebFrame.h;
+ refType = 2;
+ };
+ 9C13328A01FFB40A0ECA16EA = {
+ isa = PBXFileReference;
+ name = WKWebFrame.m;
+ path = WebView.subproj/WKWebFrame.m;
+ refType = 2;
+ };
+ 9C13328B01FFB40A0ECA16EA = {
+ fileRef = 9C13328901FFB40A0ECA16EA;
+ isa = PBXBuildFile;
+ settings = {
+ ATTRIBUTES = (
+ Public,
+ );
+ };
+ };
+ 9C13328C01FFB40A0ECA16EA = {
+ fileRef = 9C13328A01FFB40A0ECA16EA;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
9C64424501F78B4B0ECA16EA = {
isa = PBXFileReference;
name = WKWebViewPrivate.mm;
@@ -1056,6 +1085,8 @@
9C64424E01F7AF2D0ECA16EA,
9C64425301F7B1740ECA16EA,
9C64425501F7B4E20ECA16EA,
+ 9C13328901FFB40A0ECA16EA,
+ 9C13328A01FFB40A0ECA16EA,
);
isa = PBXGroup;
name = WebView;
diff --git a/WebKit/WebView.subproj/IFBaseWebController.h b/WebKit/WebView.subproj/IFBaseWebController.h
index 39f4eb7..6177fe0 100644
--- a/WebKit/WebView.subproj/IFBaseWebController.h
+++ b/WebKit/WebView.subproj/IFBaseWebController.h
@@ -3,6 +3,7 @@
Copyright 2001, 2002 Apple, Inc. All rights reserved.
*/
#import <WebKit/WKWebController.h>
+#import <WebKit/WKWebFrame.h>
/*
@@ -14,6 +15,8 @@
}
+- init;
+
- initWithView: (WKWebView *)view dataSource: (WKWebDataSource *)dataSource;
- (void)setDirectsAllLinksToSystemBrowser: (BOOL)flag;
@@ -33,8 +36,6 @@
- (void)setMainDataSource: (WKWebDataSource *)dataSource;
- (WKWebDataSource *)mainDataSource;
-- (void)createViewForDataSource: (WKWebDataSource *)dataSource inFrameNamed: (NSString *)name;
-
-- (void)createViewForDataSource: (WKWebDataSource *)dataSource inIFrame: (id)iFrameIdentifier;
+- (void)addFrame: (WKWebFrame *)childFrame toParent: (WKWebDataSource *)parent;
@end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/IFBaseWebController.mm b/WebKit/WebView.subproj/IFBaseWebController.mm
index 7d724ef..1df43e6 100644
--- a/WebKit/WebView.subproj/IFBaseWebController.mm
+++ b/WebKit/WebView.subproj/IFBaseWebController.mm
@@ -9,7 +9,7 @@
#import <WebKit/WKException.h>
-// Used so we can use objects as keys in dictionaries without
+// WKObjectHolder holds objects as keys in dictionaries without
// copying.
@interface WKObjectHolder : NSObject
{
@@ -67,6 +67,13 @@
@implementation WKDefaultWebController
+- init
+{
+ [super init];
+ _controllerPrivate = [[WKDefaultWebControllerPrivate alloc] init];
+ return self;
+}
+
- initWithView: (WKWebView *)view dataSource: (WKWebDataSource *)dataSource
{
@@ -113,23 +120,41 @@
data->mainDataSource = [dataSource retain];
[dataSource _setController: self];
- [data->viewMap setObject: dataSource forKey: [WKObjectHolder holderWithObject:view]];
- [data->dataSourceMap setObject: view forKey: [WKObjectHolder holderWithObject:dataSource]];
+ [data->viewMap setObject: view forKey: [WKObjectHolder holderWithObject:dataSource]];
+ [data->dataSourceMap setObject: dataSource forKey: [WKObjectHolder holderWithObject:view]];
[view dataSourceChanged];
}
+
+- (void)addFrame: (WKWebFrame *)childFrame toParent: (WKWebDataSource *)parent;
+{
+ WKDefaultWebControllerPrivate *data = ((WKDefaultWebControllerPrivate *)_controllerPrivate);
+ id view = [childFrame view];
+ WKWebDataSource *child = [childFrame dataSource];
+
+ [data->viewMap setObject: view forKey: [WKObjectHolder holderWithObject:child]];
+ [view _setController: self];
+ [data->dataSourceMap setObject: child forKey: [WKObjectHolder holderWithObject:view]];
+ [child _setController: self];
+
+ [view dataSourceChanged];
+
+ [child startLoading: YES];
+}
+
+
- (WKWebView *)viewForDataSource: (WKWebDataSource *)dataSource
{
WKDefaultWebControllerPrivate *data = ((WKDefaultWebControllerPrivate *)_controllerPrivate);
- return [data->viewMap objectForKey: dataSource];
+ return [data->viewMap objectForKey: [WKObjectHolder holderWithObject:dataSource]];
}
- (WKWebDataSource *)dataSourceForView: (WKWebView *)view
{
WKDefaultWebControllerPrivate *data = ((WKDefaultWebControllerPrivate *)_controllerPrivate);
- return [data->dataSourceMap objectForKey: view];
+ return [data->dataSourceMap objectForKey: [WKObjectHolder holderWithObject:view]];
}
@@ -153,16 +178,6 @@
}
-- (void)createViewForDataSource: (WKWebDataSource *)dataSource inFrameNamed: (NSString *)name
-{
- [NSException raise:WKMethodNotYetImplemented format:@"WKDefaultWebController::createViewForDataSource:inFrameNamed: is not implemented"];
-}
-
-
-- (void)createViewForDataSource: (WKWebDataSource *)dataSource inIFrame: (id)iFrameIdentifier
-{
- [NSException raise:WKMethodNotYetImplemented format:@"WKDefaultWebController::createViewForDataSource:inIFrame: is not implemented"];
-}
diff --git a/WebKit/WebView.subproj/IFDefaultWebController.h b/WebKit/WebView.subproj/IFDefaultWebController.h
index 39f4eb7..6177fe0 100644
--- a/WebKit/WebView.subproj/IFDefaultWebController.h
+++ b/WebKit/WebView.subproj/IFDefaultWebController.h
@@ -3,6 +3,7 @@
Copyright 2001, 2002 Apple, Inc. All rights reserved.
*/
#import <WebKit/WKWebController.h>
+#import <WebKit/WKWebFrame.h>
/*
@@ -14,6 +15,8 @@
}
+- init;
+
- initWithView: (WKWebView *)view dataSource: (WKWebDataSource *)dataSource;
- (void)setDirectsAllLinksToSystemBrowser: (BOOL)flag;
@@ -33,8 +36,6 @@
- (void)setMainDataSource: (WKWebDataSource *)dataSource;
- (WKWebDataSource *)mainDataSource;
-- (void)createViewForDataSource: (WKWebDataSource *)dataSource inFrameNamed: (NSString *)name;
-
-- (void)createViewForDataSource: (WKWebDataSource *)dataSource inIFrame: (id)iFrameIdentifier;
+- (void)addFrame: (WKWebFrame *)childFrame toParent: (WKWebDataSource *)parent;
@end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/IFDefaultWebController.mm b/WebKit/WebView.subproj/IFDefaultWebController.mm
index 7d724ef..1df43e6 100644
--- a/WebKit/WebView.subproj/IFDefaultWebController.mm
+++ b/WebKit/WebView.subproj/IFDefaultWebController.mm
@@ -9,7 +9,7 @@
#import <WebKit/WKException.h>
-// Used so we can use objects as keys in dictionaries without
+// WKObjectHolder holds objects as keys in dictionaries without
// copying.
@interface WKObjectHolder : NSObject
{
@@ -67,6 +67,13 @@
@implementation WKDefaultWebController
+- init
+{
+ [super init];
+ _controllerPrivate = [[WKDefaultWebControllerPrivate alloc] init];
+ return self;
+}
+
- initWithView: (WKWebView *)view dataSource: (WKWebDataSource *)dataSource
{
@@ -113,23 +120,41 @@
data->mainDataSource = [dataSource retain];
[dataSource _setController: self];
- [data->viewMap setObject: dataSource forKey: [WKObjectHolder holderWithObject:view]];
- [data->dataSourceMap setObject: view forKey: [WKObjectHolder holderWithObject:dataSource]];
+ [data->viewMap setObject: view forKey: [WKObjectHolder holderWithObject:dataSource]];
+ [data->dataSourceMap setObject: dataSource forKey: [WKObjectHolder holderWithObject:view]];
[view dataSourceChanged];
}
+
+- (void)addFrame: (WKWebFrame *)childFrame toParent: (WKWebDataSource *)parent;
+{
+ WKDefaultWebControllerPrivate *data = ((WKDefaultWebControllerPrivate *)_controllerPrivate);
+ id view = [childFrame view];
+ WKWebDataSource *child = [childFrame dataSource];
+
+ [data->viewMap setObject: view forKey: [WKObjectHolder holderWithObject:child]];
+ [view _setController: self];
+ [data->dataSourceMap setObject: child forKey: [WKObjectHolder holderWithObject:view]];
+ [child _setController: self];
+
+ [view dataSourceChanged];
+
+ [child startLoading: YES];
+}
+
+
- (WKWebView *)viewForDataSource: (WKWebDataSource *)dataSource
{
WKDefaultWebControllerPrivate *data = ((WKDefaultWebControllerPrivate *)_controllerPrivate);
- return [data->viewMap objectForKey: dataSource];
+ return [data->viewMap objectForKey: [WKObjectHolder holderWithObject:dataSource]];
}
- (WKWebDataSource *)dataSourceForView: (WKWebView *)view
{
WKDefaultWebControllerPrivate *data = ((WKDefaultWebControllerPrivate *)_controllerPrivate);
- return [data->dataSourceMap objectForKey: view];
+ return [data->dataSourceMap objectForKey: [WKObjectHolder holderWithObject:view]];
}
@@ -153,16 +178,6 @@
}
-- (void)createViewForDataSource: (WKWebDataSource *)dataSource inFrameNamed: (NSString *)name
-{
- [NSException raise:WKMethodNotYetImplemented format:@"WKDefaultWebController::createViewForDataSource:inFrameNamed: is not implemented"];
-}
-
-
-- (void)createViewForDataSource: (WKWebDataSource *)dataSource inIFrame: (id)iFrameIdentifier
-{
- [NSException raise:WKMethodNotYetImplemented format:@"WKDefaultWebController::createViewForDataSource:inIFrame: is not implemented"];
-}
diff --git a/WebKit/WebView.subproj/IFWebDataSource.h b/WebKit/WebView.subproj/IFWebDataSource.h
index c8c2feb..959a467 100644
--- a/WebKit/WebView.subproj/IFWebDataSource.h
+++ b/WebKit/WebView.subproj/IFWebDataSource.h
@@ -7,7 +7,7 @@
#import <Cocoa/Cocoa.h>
#import <WebKit/WKWebController.h>
-#import <WebKit/WKWebCache.h>
+#import <WebKit/WKWebFrame.h>
/*
=============================================================================
@@ -71,6 +71,8 @@
@class WKLoader;
#endif
+
+
@interface WKWebDataSource : NSObject
{
@private
@@ -87,21 +89,29 @@
- initWithLoader: (WKLoader *)loader;
#endif
+// Returns YES if this is the main document. The main document is the 'top'
+// document, typically either a frameset or a normal HTML document.
+- (BOOL)isMainDocument;
+
+
// Returns nil if this data source represents the main document. Otherwise
// returns the parent data source.
- (WKWebDataSource *)parent;
-// Returns YES if this is the main document. The main document is the 'top'
-// document, typically either a frameset or a normal HTML document.
-- (BOOL)isMainDocument;
+// Add a child frame. [Should this be private? Only called when a
+// data source is created automatically in a frame set.
+- (void)addFrame: (WKWebFrame *)frame;
-// Returns an array of WKWebDataSource. The data sources in the array are
+
+// Returns an array of WKWebFrame. The data sources in the array are
// the data source assoicated with a frame set or iframe. If the main document
// is not a frameset, or has not iframes children will return nil.
- (NSArray *)children;
+- (WKWebFrame *)frameNamed: (NSString *)frameName;
+
// Returns an array of NSStrings or nil. The NSStrings corresponds to
// frame names. If this data source is the main document and has no
// frames then frameNames will return nil.
@@ -166,7 +176,11 @@
- (WKDOMDocument *)document;
#endif
-// Get the actual source of the docment.
+// Get the source of the document by reconstructing it from the DOM.
+- (NSString *)documentTextFromDOM;
+
+
+// Get the actual source of the document.
- (NSString *)documentText;
@@ -196,6 +210,8 @@
// Returns nil or the page title.
- (NSString *)pageTitle;
+- (NSString *)frameName;
+
@end
diff --git a/WebKit/WebView.subproj/IFWebDataSource.mm b/WebKit/WebView.subproj/IFWebDataSource.mm
index 48d1b3c..4733334 100644
--- a/WebKit/WebView.subproj/IFWebDataSource.mm
+++ b/WebKit/WebView.subproj/IFWebDataSource.mm
@@ -5,6 +5,9 @@
#import <WebKit/WKWebDataSource.h>
#import <WebKit/WKWebDataSourcePrivate.h>
#import <WebKit/WKException.h>
+#import <WebKit/WebKitDebug.h>
+
+#include <xml/dom_docimpl.h>
@implementation WKWebDataSource
@@ -46,6 +49,10 @@
return self;
}
+- (void)dealloc
+{
+ [_dataSourcePrivate release];
+}
#ifdef TENTATIVE_API
- initWithData: (NSData *)data
@@ -54,15 +61,14 @@
#endif
-// Returns nil if this data source represents the main document. Otherwise
-// returns the parent data source.
-- (WKWebDataSource *)parent
+// Returns the name of the frame containing this data source, or nil
+// if the data source is not in a frame set.
+- (NSString *)frameName
{
- return ((WKWebDataSourcePrivate *)_dataSourcePrivate)->parent;
+ return ((WKWebDataSourcePrivate *)_dataSourcePrivate)->frameName;
}
-
// Returns YES if this is the main document. The main document is the 'top'
// document, typically either a frameset or a normal HTML document.
- (BOOL)isMainDocument
@@ -73,14 +79,40 @@
}
+// Returns nil if this data source represents the main document. Otherwise
+// returns the parent data source.
+- (WKWebDataSource *)parent
+{
+ return ((WKWebDataSourcePrivate *)_dataSourcePrivate)->parent;
+}
+
+
// Returns an array of WKWebDataSource. The data sources in the array are
// the data source assoicated with a frame set or iframe. If the main document
// is not a frameset, or has not iframes children will return nil.
- (NSArray *)children
{
- return ((WKWebDataSourcePrivate *)_dataSourcePrivate)->children;
+ return [((WKWebDataSourcePrivate *)_dataSourcePrivate)->frames allValues];
+}
+
+- (void)addFrame: (WKWebFrame *)frame
+{
+ WKWebDataSourcePrivate *data = (WKWebDataSourcePrivate *)_dataSourcePrivate;
+
+ if (data->frames == nil)
+ data->frames = [[NSMutableDictionary alloc] init];
+ [data->frames setObject: frame forKey: [frame name]];
}
+
+- (WKWebFrame *)frameNamed: (NSString *)frameName
+{
+ WKWebDataSourcePrivate *data = (WKWebDataSourcePrivate *)_dataSourcePrivate;
+
+ return (WKWebFrame *)[data->frames objectForKey: frameName];
+}
+
+
// Returns an array of NSStrings or nil. The NSStrings corresponds to
// frame names. If this data source is the main document and has no
@@ -164,6 +196,7 @@
{
KURL url = [[[self inputURL] absoluteString] cString];
+ WEBKITDEBUG1 ("url = %s\n", [[[self inputURL] absoluteString] cString]);
[self _part]->openURL (url);
}
@@ -199,6 +232,26 @@
}
+- (NSString *)documentTextFromDOM
+{
+ DOM::DocumentImpl *doc;
+ NSString *string = nil;
+ KHTMLPart *part = [self _part];
+
+ if (part != 0){
+ doc = (DOM::DocumentImpl *)[self _part]->xmlDocImpl();
+ if (doc != 0){
+ QString str = doc->recursive_toHTML(1);
+ string = QSTRING_TO_NSSTRING(str);
+ }
+ }
+ if (string == nil) {
+ string = @"";
+ }
+ return string;
+}
+
+
// URL reference point, these should probably not be public for 1.0.
- (NSURL *)base
{
diff --git a/WebKit/WebView.subproj/IFWebDataSourcePrivate.h b/WebKit/WebView.subproj/IFWebDataSourcePrivate.h
index 718b7f4..c1557e6 100644
--- a/WebKit/WebView.subproj/IFWebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/IFWebDataSourcePrivate.h
@@ -15,10 +15,12 @@
@interface WKWebDataSourcePrivate : NSObject
{
WKWebDataSource *parent;
- NSArray *children;
+ NSMutableArray *children;
id <WKWebController>controller;
NSURL *inputURL;
KHTMLPart *part;
+ NSString *frameName;
+ NSMutableDictionary *frames;
}
- init;
@@ -29,4 +31,5 @@
@interface WKWebDataSource (WKPrivate)
- (void)_setController: (id <WKWebController>)controller;
- (KHTMLPart *)_part;
+- (void)_setFrameName: (NSString *)fName;
@end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm b/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm
index 2e9824e..6b28728 100644
--- a/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm
+++ b/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm
@@ -16,7 +16,7 @@
- init
{
parent = nil;
- children = nil;
+ frames = nil;
controller = nil;
inputURL = nil;
@@ -30,9 +30,9 @@
// controller is not retained! WKWebControllers maintain
// a reference to their view and main data source.
[parent release];
- [children release];
+ [frames release];
- //delete part;
+ delete part;
}
@end
@@ -43,6 +43,7 @@
if (((WKWebDataSourcePrivate *)_dataSourcePrivate)->parent != nil)
[NSException raise:WKRuntimeError format:@"WKWebDataSource::_setController: called not called on main data source."];
((WKWebDataSourcePrivate *)_dataSourcePrivate)->controller = controller;
+ ((WKWebDataSourcePrivate *)_dataSourcePrivate)->part->setDataSource (self);
}
@@ -51,5 +52,9 @@
return ((WKWebDataSourcePrivate *)_dataSourcePrivate)->part;
}
+- (void)_setFrameName: (NSString *)fname
+{
+ ((WKWebDataSourcePrivate *)_dataSourcePrivate)->frameName = [fname retain];
+}
@end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/IFWebFrame.h b/WebKit/WebView.subproj/IFWebFrame.h
new file mode 100644
index 0000000..3c55879
--- /dev/null
+++ b/WebKit/WebView.subproj/IFWebFrame.h
@@ -0,0 +1,23 @@
+/*
+ WKWebFrame.h
+
+ Copyright 2001, Apple, Inc. All rights reserved.
+
+ Public header file.
+*/
+#import <Cocoa/Cocoa.h>
+
+ at class WKWebDataSource;
+
+ at interface WKWebFrame : NSObject
+{
+ NSString *name;
+ id view;
+ WKWebDataSource *dataSource;
+}
+- initWithName: (NSString *)name view: view dataSource: (WKWebDataSource *)dataSource;
+- (NSString *)name;
+- (void)setView: view;
+- view;
+- (WKWebDataSource *)dataSource;
+ at end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/IFWebFrame.m b/WebKit/WebView.subproj/IFWebFrame.m
new file mode 100644
index 0000000..b6fa0c5
--- /dev/null
+++ b/WebKit/WebView.subproj/IFWebFrame.m
@@ -0,0 +1,56 @@
+/*
+ WKWebFrame.h
+
+ Copyright 2001, Apple, Inc. All rights reserved.
+
+ Public header file.
+*/
+#import <Cocoa/Cocoa.h>
+
+#import <WebKit/WKWebFrame.h>
+#import <WebKit/WKWebDataSource.h>
+
+ at implementation WKWebFrame
+
+- initWithName: (NSString *)n view: v dataSource: (WKWebDataSource *)d
+{
+ [super init];
+ name = [n retain];
+ view = [v retain];
+ dataSource = [d retain];
+ return self;
+}
+
+- (void)dealloc
+{
+ [name release];
+ [view release];
+ [dataSource release];
+}
+
+- (NSString *)name
+{
+ return name;
+}
+
+
+- (void)setView: v
+{
+ if (view)
+ [view autorelease];
+ view = [v retain];
+}
+
+- view
+{
+ return view;
+}
+
+
+- (WKWebDataSource *)dataSource
+{
+ return dataSource;
+}
+
+
+ at end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/IFWebView.mm b/WebKit/WebView.subproj/IFWebView.mm
index 19f2fb2..bcba506 100644
--- a/WebKit/WebView.subproj/IFWebView.mm
+++ b/WebKit/WebView.subproj/IFWebView.mm
@@ -59,7 +59,7 @@
// Nasty! Setup the cross references between the KHTMLView and
// the KHTMLPart.
- KHTMLPart *part = [[[self controller] mainDataSource] _part];
+ KHTMLPart *part = [[[self controller] dataSourceForView: self] _part];
data->widget = new KHTMLView (part, 0);
part->setView (data->widget);
@@ -264,6 +264,25 @@
(int)rect.size.width,
(int)rect.size.height );
//WebKitDebugAtLevel (0x200, "draw time %e\n", CFAbsoluteTimeGetCurrent() - start);
+
+#ifdef DEBUG_LAYOUT
+ NSRect vframe = [self frame];
+ [[NSColor blackColor] set];
+ NSBezierPath *path;
+ path = [NSBezierPath bezierPath];
+ [path setLineWidth:(float)0.1];
+ [path moveToPoint:NSMakePoint(0, 0)];
+ [path lineToPoint:NSMakePoint(vframe.size.width, vframe.size.height)];
+ [path closePath];
+ [path stroke];
+ path = [NSBezierPath bezierPath];
+ [path setLineWidth:(float)0.1];
+ [path moveToPoint:NSMakePoint(0, vframe.size.height)];
+ [path lineToPoint:NSMakePoint(vframe.size.width, 0)];
+ [path closePath];
+ [path stroke];
+#endif
+
[self unlockFocus];
}
}
@@ -293,15 +312,15 @@
{
int button, state;
- if ([event type] == NSLeftMouseDown){
+ if ([event type] == NSLeftMouseUp){
button = Qt::LeftButton;
state = Qt::LeftButton;
}
- else if ([event type] == NSRightMouseDown){
+ else if ([event type] == NSRightMouseUp){
button = Qt::RightButton;
state = Qt::RightButton;
}
- else if ([event type] == NSOtherMouseDown){
+ else if ([event type] == NSOtherMouseUp){
button = Qt::MidButton;
state = Qt::MidButton;
}
diff --git a/WebKit/WebView.subproj/IFWebViewPrivate.h b/WebKit/WebView.subproj/IFWebViewPrivate.h
index ae54238..6f754d1 100644
--- a/WebKit/WebView.subproj/IFWebViewPrivate.h
+++ b/WebKit/WebView.subproj/IFWebViewPrivate.h
@@ -27,4 +27,5 @@ class KHTMLView;
@interface WKWebView (WKPrivate)
- (void)_setController: (id <WKWebController>)controller;
- (void)_resetView;
+- (KHTMLView *)_widget;
@end
diff --git a/WebKit/WebView.subproj/IFWebViewPrivate.mm b/WebKit/WebView.subproj/IFWebViewPrivate.mm
index 9b78fc6..84b5c9c 100644
--- a/WebKit/WebView.subproj/IFWebViewPrivate.mm
+++ b/WebKit/WebView.subproj/IFWebViewPrivate.mm
@@ -28,8 +28,8 @@
// controller is not retained! WKWebControllers maintain
// a reference to their view and main data source.
- //if (widget)
- // delete widget;
+ if (widget)
+ delete widget;
}
@@ -59,4 +59,9 @@
((WKWebViewPrivate *)_viewPrivate)->controller = controller;
}
+- (KHTMLView *)_widget
+{
+ return ((WKWebViewPrivate *)_viewPrivate)->widget;
+}
+
@end
diff --git a/WebKit/WebView.subproj/WKDefaultWebController.h b/WebKit/WebView.subproj/WKDefaultWebController.h
index 39f4eb7..6177fe0 100644
--- a/WebKit/WebView.subproj/WKDefaultWebController.h
+++ b/WebKit/WebView.subproj/WKDefaultWebController.h
@@ -3,6 +3,7 @@
Copyright 2001, 2002 Apple, Inc. All rights reserved.
*/
#import <WebKit/WKWebController.h>
+#import <WebKit/WKWebFrame.h>
/*
@@ -14,6 +15,8 @@
}
+- init;
+
- initWithView: (WKWebView *)view dataSource: (WKWebDataSource *)dataSource;
- (void)setDirectsAllLinksToSystemBrowser: (BOOL)flag;
@@ -33,8 +36,6 @@
- (void)setMainDataSource: (WKWebDataSource *)dataSource;
- (WKWebDataSource *)mainDataSource;
-- (void)createViewForDataSource: (WKWebDataSource *)dataSource inFrameNamed: (NSString *)name;
-
-- (void)createViewForDataSource: (WKWebDataSource *)dataSource inIFrame: (id)iFrameIdentifier;
+- (void)addFrame: (WKWebFrame *)childFrame toParent: (WKWebDataSource *)parent;
@end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/WKDefaultWebController.mm b/WebKit/WebView.subproj/WKDefaultWebController.mm
index 7d724ef..1df43e6 100644
--- a/WebKit/WebView.subproj/WKDefaultWebController.mm
+++ b/WebKit/WebView.subproj/WKDefaultWebController.mm
@@ -9,7 +9,7 @@
#import <WebKit/WKException.h>
-// Used so we can use objects as keys in dictionaries without
+// WKObjectHolder holds objects as keys in dictionaries without
// copying.
@interface WKObjectHolder : NSObject
{
@@ -67,6 +67,13 @@
@implementation WKDefaultWebController
+- init
+{
+ [super init];
+ _controllerPrivate = [[WKDefaultWebControllerPrivate alloc] init];
+ return self;
+}
+
- initWithView: (WKWebView *)view dataSource: (WKWebDataSource *)dataSource
{
@@ -113,23 +120,41 @@
data->mainDataSource = [dataSource retain];
[dataSource _setController: self];
- [data->viewMap setObject: dataSource forKey: [WKObjectHolder holderWithObject:view]];
- [data->dataSourceMap setObject: view forKey: [WKObjectHolder holderWithObject:dataSource]];
+ [data->viewMap setObject: view forKey: [WKObjectHolder holderWithObject:dataSource]];
+ [data->dataSourceMap setObject: dataSource forKey: [WKObjectHolder holderWithObject:view]];
[view dataSourceChanged];
}
+
+- (void)addFrame: (WKWebFrame *)childFrame toParent: (WKWebDataSource *)parent;
+{
+ WKDefaultWebControllerPrivate *data = ((WKDefaultWebControllerPrivate *)_controllerPrivate);
+ id view = [childFrame view];
+ WKWebDataSource *child = [childFrame dataSource];
+
+ [data->viewMap setObject: view forKey: [WKObjectHolder holderWithObject:child]];
+ [view _setController: self];
+ [data->dataSourceMap setObject: child forKey: [WKObjectHolder holderWithObject:view]];
+ [child _setController: self];
+
+ [view dataSourceChanged];
+
+ [child startLoading: YES];
+}
+
+
- (WKWebView *)viewForDataSource: (WKWebDataSource *)dataSource
{
WKDefaultWebControllerPrivate *data = ((WKDefaultWebControllerPrivate *)_controllerPrivate);
- return [data->viewMap objectForKey: dataSource];
+ return [data->viewMap objectForKey: [WKObjectHolder holderWithObject:dataSource]];
}
- (WKWebDataSource *)dataSourceForView: (WKWebView *)view
{
WKDefaultWebControllerPrivate *data = ((WKDefaultWebControllerPrivate *)_controllerPrivate);
- return [data->dataSourceMap objectForKey: view];
+ return [data->dataSourceMap objectForKey: [WKObjectHolder holderWithObject:view]];
}
@@ -153,16 +178,6 @@
}
-- (void)createViewForDataSource: (WKWebDataSource *)dataSource inFrameNamed: (NSString *)name
-{
- [NSException raise:WKMethodNotYetImplemented format:@"WKDefaultWebController::createViewForDataSource:inFrameNamed: is not implemented"];
-}
-
-
-- (void)createViewForDataSource: (WKWebDataSource *)dataSource inIFrame: (id)iFrameIdentifier
-{
- [NSException raise:WKMethodNotYetImplemented format:@"WKDefaultWebController::createViewForDataSource:inIFrame: is not implemented"];
-}
diff --git a/WebKit/WebView.subproj/WKWebDataSource.h b/WebKit/WebView.subproj/WKWebDataSource.h
index c8c2feb..959a467 100644
--- a/WebKit/WebView.subproj/WKWebDataSource.h
+++ b/WebKit/WebView.subproj/WKWebDataSource.h
@@ -7,7 +7,7 @@
#import <Cocoa/Cocoa.h>
#import <WebKit/WKWebController.h>
-#import <WebKit/WKWebCache.h>
+#import <WebKit/WKWebFrame.h>
/*
=============================================================================
@@ -71,6 +71,8 @@
@class WKLoader;
#endif
+
+
@interface WKWebDataSource : NSObject
{
@private
@@ -87,21 +89,29 @@
- initWithLoader: (WKLoader *)loader;
#endif
+// Returns YES if this is the main document. The main document is the 'top'
+// document, typically either a frameset or a normal HTML document.
+- (BOOL)isMainDocument;
+
+
// Returns nil if this data source represents the main document. Otherwise
// returns the parent data source.
- (WKWebDataSource *)parent;
-// Returns YES if this is the main document. The main document is the 'top'
-// document, typically either a frameset or a normal HTML document.
-- (BOOL)isMainDocument;
+// Add a child frame. [Should this be private? Only called when a
+// data source is created automatically in a frame set.
+- (void)addFrame: (WKWebFrame *)frame;
-// Returns an array of WKWebDataSource. The data sources in the array are
+
+// Returns an array of WKWebFrame. The data sources in the array are
// the data source assoicated with a frame set or iframe. If the main document
// is not a frameset, or has not iframes children will return nil.
- (NSArray *)children;
+- (WKWebFrame *)frameNamed: (NSString *)frameName;
+
// Returns an array of NSStrings or nil. The NSStrings corresponds to
// frame names. If this data source is the main document and has no
// frames then frameNames will return nil.
@@ -166,7 +176,11 @@
- (WKDOMDocument *)document;
#endif
-// Get the actual source of the docment.
+// Get the source of the document by reconstructing it from the DOM.
+- (NSString *)documentTextFromDOM;
+
+
+// Get the actual source of the document.
- (NSString *)documentText;
@@ -196,6 +210,8 @@
// Returns nil or the page title.
- (NSString *)pageTitle;
+- (NSString *)frameName;
+
@end
diff --git a/WebKit/WebView.subproj/WKWebDataSource.mm b/WebKit/WebView.subproj/WKWebDataSource.mm
index 48d1b3c..4733334 100644
--- a/WebKit/WebView.subproj/WKWebDataSource.mm
+++ b/WebKit/WebView.subproj/WKWebDataSource.mm
@@ -5,6 +5,9 @@
#import <WebKit/WKWebDataSource.h>
#import <WebKit/WKWebDataSourcePrivate.h>
#import <WebKit/WKException.h>
+#import <WebKit/WebKitDebug.h>
+
+#include <xml/dom_docimpl.h>
@implementation WKWebDataSource
@@ -46,6 +49,10 @@
return self;
}
+- (void)dealloc
+{
+ [_dataSourcePrivate release];
+}
#ifdef TENTATIVE_API
- initWithData: (NSData *)data
@@ -54,15 +61,14 @@
#endif
-// Returns nil if this data source represents the main document. Otherwise
-// returns the parent data source.
-- (WKWebDataSource *)parent
+// Returns the name of the frame containing this data source, or nil
+// if the data source is not in a frame set.
+- (NSString *)frameName
{
- return ((WKWebDataSourcePrivate *)_dataSourcePrivate)->parent;
+ return ((WKWebDataSourcePrivate *)_dataSourcePrivate)->frameName;
}
-
// Returns YES if this is the main document. The main document is the 'top'
// document, typically either a frameset or a normal HTML document.
- (BOOL)isMainDocument
@@ -73,14 +79,40 @@
}
+// Returns nil if this data source represents the main document. Otherwise
+// returns the parent data source.
+- (WKWebDataSource *)parent
+{
+ return ((WKWebDataSourcePrivate *)_dataSourcePrivate)->parent;
+}
+
+
// Returns an array of WKWebDataSource. The data sources in the array are
// the data source assoicated with a frame set or iframe. If the main document
// is not a frameset, or has not iframes children will return nil.
- (NSArray *)children
{
- return ((WKWebDataSourcePrivate *)_dataSourcePrivate)->children;
+ return [((WKWebDataSourcePrivate *)_dataSourcePrivate)->frames allValues];
+}
+
+- (void)addFrame: (WKWebFrame *)frame
+{
+ WKWebDataSourcePrivate *data = (WKWebDataSourcePrivate *)_dataSourcePrivate;
+
+ if (data->frames == nil)
+ data->frames = [[NSMutableDictionary alloc] init];
+ [data->frames setObject: frame forKey: [frame name]];
}
+
+- (WKWebFrame *)frameNamed: (NSString *)frameName
+{
+ WKWebDataSourcePrivate *data = (WKWebDataSourcePrivate *)_dataSourcePrivate;
+
+ return (WKWebFrame *)[data->frames objectForKey: frameName];
+}
+
+
// Returns an array of NSStrings or nil. The NSStrings corresponds to
// frame names. If this data source is the main document and has no
@@ -164,6 +196,7 @@
{
KURL url = [[[self inputURL] absoluteString] cString];
+ WEBKITDEBUG1 ("url = %s\n", [[[self inputURL] absoluteString] cString]);
[self _part]->openURL (url);
}
@@ -199,6 +232,26 @@
}
+- (NSString *)documentTextFromDOM
+{
+ DOM::DocumentImpl *doc;
+ NSString *string = nil;
+ KHTMLPart *part = [self _part];
+
+ if (part != 0){
+ doc = (DOM::DocumentImpl *)[self _part]->xmlDocImpl();
+ if (doc != 0){
+ QString str = doc->recursive_toHTML(1);
+ string = QSTRING_TO_NSSTRING(str);
+ }
+ }
+ if (string == nil) {
+ string = @"";
+ }
+ return string;
+}
+
+
// URL reference point, these should probably not be public for 1.0.
- (NSURL *)base
{
diff --git a/WebKit/WebView.subproj/WKWebDataSourcePrivate.h b/WebKit/WebView.subproj/WKWebDataSourcePrivate.h
index 718b7f4..c1557e6 100644
--- a/WebKit/WebView.subproj/WKWebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WKWebDataSourcePrivate.h
@@ -15,10 +15,12 @@
@interface WKWebDataSourcePrivate : NSObject
{
WKWebDataSource *parent;
- NSArray *children;
+ NSMutableArray *children;
id <WKWebController>controller;
NSURL *inputURL;
KHTMLPart *part;
+ NSString *frameName;
+ NSMutableDictionary *frames;
}
- init;
@@ -29,4 +31,5 @@
@interface WKWebDataSource (WKPrivate)
- (void)_setController: (id <WKWebController>)controller;
- (KHTMLPart *)_part;
+- (void)_setFrameName: (NSString *)fName;
@end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/WKWebDataSourcePrivate.mm b/WebKit/WebView.subproj/WKWebDataSourcePrivate.mm
index 2e9824e..6b28728 100644
--- a/WebKit/WebView.subproj/WKWebDataSourcePrivate.mm
+++ b/WebKit/WebView.subproj/WKWebDataSourcePrivate.mm
@@ -16,7 +16,7 @@
- init
{
parent = nil;
- children = nil;
+ frames = nil;
controller = nil;
inputURL = nil;
@@ -30,9 +30,9 @@
// controller is not retained! WKWebControllers maintain
// a reference to their view and main data source.
[parent release];
- [children release];
+ [frames release];
- //delete part;
+ delete part;
}
@end
@@ -43,6 +43,7 @@
if (((WKWebDataSourcePrivate *)_dataSourcePrivate)->parent != nil)
[NSException raise:WKRuntimeError format:@"WKWebDataSource::_setController: called not called on main data source."];
((WKWebDataSourcePrivate *)_dataSourcePrivate)->controller = controller;
+ ((WKWebDataSourcePrivate *)_dataSourcePrivate)->part->setDataSource (self);
}
@@ -51,5 +52,9 @@
return ((WKWebDataSourcePrivate *)_dataSourcePrivate)->part;
}
+- (void)_setFrameName: (NSString *)fname
+{
+ ((WKWebDataSourcePrivate *)_dataSourcePrivate)->frameName = [fname retain];
+}
@end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/WKWebFrame.h b/WebKit/WebView.subproj/WKWebFrame.h
new file mode 100644
index 0000000..3c55879
--- /dev/null
+++ b/WebKit/WebView.subproj/WKWebFrame.h
@@ -0,0 +1,23 @@
+/*
+ WKWebFrame.h
+
+ Copyright 2001, Apple, Inc. All rights reserved.
+
+ Public header file.
+*/
+#import <Cocoa/Cocoa.h>
+
+ at class WKWebDataSource;
+
+ at interface WKWebFrame : NSObject
+{
+ NSString *name;
+ id view;
+ WKWebDataSource *dataSource;
+}
+- initWithName: (NSString *)name view: view dataSource: (WKWebDataSource *)dataSource;
+- (NSString *)name;
+- (void)setView: view;
+- view;
+- (WKWebDataSource *)dataSource;
+ at end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/WKWebFrame.m b/WebKit/WebView.subproj/WKWebFrame.m
new file mode 100644
index 0000000..b6fa0c5
--- /dev/null
+++ b/WebKit/WebView.subproj/WKWebFrame.m
@@ -0,0 +1,56 @@
+/*
+ WKWebFrame.h
+
+ Copyright 2001, Apple, Inc. All rights reserved.
+
+ Public header file.
+*/
+#import <Cocoa/Cocoa.h>
+
+#import <WebKit/WKWebFrame.h>
+#import <WebKit/WKWebDataSource.h>
+
+ at implementation WKWebFrame
+
+- initWithName: (NSString *)n view: v dataSource: (WKWebDataSource *)d
+{
+ [super init];
+ name = [n retain];
+ view = [v retain];
+ dataSource = [d retain];
+ return self;
+}
+
+- (void)dealloc
+{
+ [name release];
+ [view release];
+ [dataSource release];
+}
+
+- (NSString *)name
+{
+ return name;
+}
+
+
+- (void)setView: v
+{
+ if (view)
+ [view autorelease];
+ view = [v retain];
+}
+
+- view
+{
+ return view;
+}
+
+
+- (WKWebDataSource *)dataSource
+{
+ return dataSource;
+}
+
+
+ at end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/WKWebView.mm b/WebKit/WebView.subproj/WKWebView.mm
index 19f2fb2..bcba506 100644
--- a/WebKit/WebView.subproj/WKWebView.mm
+++ b/WebKit/WebView.subproj/WKWebView.mm
@@ -59,7 +59,7 @@
// Nasty! Setup the cross references between the KHTMLView and
// the KHTMLPart.
- KHTMLPart *part = [[[self controller] mainDataSource] _part];
+ KHTMLPart *part = [[[self controller] dataSourceForView: self] _part];
data->widget = new KHTMLView (part, 0);
part->setView (data->widget);
@@ -264,6 +264,25 @@
(int)rect.size.width,
(int)rect.size.height );
//WebKitDebugAtLevel (0x200, "draw time %e\n", CFAbsoluteTimeGetCurrent() - start);
+
+#ifdef DEBUG_LAYOUT
+ NSRect vframe = [self frame];
+ [[NSColor blackColor] set];
+ NSBezierPath *path;
+ path = [NSBezierPath bezierPath];
+ [path setLineWidth:(float)0.1];
+ [path moveToPoint:NSMakePoint(0, 0)];
+ [path lineToPoint:NSMakePoint(vframe.size.width, vframe.size.height)];
+ [path closePath];
+ [path stroke];
+ path = [NSBezierPath bezierPath];
+ [path setLineWidth:(float)0.1];
+ [path moveToPoint:NSMakePoint(0, vframe.size.height)];
+ [path lineToPoint:NSMakePoint(vframe.size.width, 0)];
+ [path closePath];
+ [path stroke];
+#endif
+
[self unlockFocus];
}
}
@@ -293,15 +312,15 @@
{
int button, state;
- if ([event type] == NSLeftMouseDown){
+ if ([event type] == NSLeftMouseUp){
button = Qt::LeftButton;
state = Qt::LeftButton;
}
- else if ([event type] == NSRightMouseDown){
+ else if ([event type] == NSRightMouseUp){
button = Qt::RightButton;
state = Qt::RightButton;
}
- else if ([event type] == NSOtherMouseDown){
+ else if ([event type] == NSOtherMouseUp){
button = Qt::MidButton;
state = Qt::MidButton;
}
diff --git a/WebKit/WebView.subproj/WKWebViewPrivate.h b/WebKit/WebView.subproj/WKWebViewPrivate.h
index ae54238..6f754d1 100644
--- a/WebKit/WebView.subproj/WKWebViewPrivate.h
+++ b/WebKit/WebView.subproj/WKWebViewPrivate.h
@@ -27,4 +27,5 @@ class KHTMLView;
@interface WKWebView (WKPrivate)
- (void)_setController: (id <WKWebController>)controller;
- (void)_resetView;
+- (KHTMLView *)_widget;
@end
diff --git a/WebKit/WebView.subproj/WKWebViewPrivate.mm b/WebKit/WebView.subproj/WKWebViewPrivate.mm
index 9b78fc6..84b5c9c 100644
--- a/WebKit/WebView.subproj/WKWebViewPrivate.mm
+++ b/WebKit/WebView.subproj/WKWebViewPrivate.mm
@@ -28,8 +28,8 @@
// controller is not retained! WKWebControllers maintain
// a reference to their view and main data source.
- //if (widget)
- // delete widget;
+ if (widget)
+ delete widget;
}
@@ -59,4 +59,9 @@
((WKWebViewPrivate *)_viewPrivate)->controller = controller;
}
+- (KHTMLView *)_widget
+{
+ return ((WKWebViewPrivate *)_viewPrivate)->widget;
+}
+
@end
diff --git a/WebKit/WebView.subproj/WebDataSource.h b/WebKit/WebView.subproj/WebDataSource.h
index c8c2feb..959a467 100644
--- a/WebKit/WebView.subproj/WebDataSource.h
+++ b/WebKit/WebView.subproj/WebDataSource.h
@@ -7,7 +7,7 @@
#import <Cocoa/Cocoa.h>
#import <WebKit/WKWebController.h>
-#import <WebKit/WKWebCache.h>
+#import <WebKit/WKWebFrame.h>
/*
=============================================================================
@@ -71,6 +71,8 @@
@class WKLoader;
#endif
+
+
@interface WKWebDataSource : NSObject
{
@private
@@ -87,21 +89,29 @@
- initWithLoader: (WKLoader *)loader;
#endif
+// Returns YES if this is the main document. The main document is the 'top'
+// document, typically either a frameset or a normal HTML document.
+- (BOOL)isMainDocument;
+
+
// Returns nil if this data source represents the main document. Otherwise
// returns the parent data source.
- (WKWebDataSource *)parent;
-// Returns YES if this is the main document. The main document is the 'top'
-// document, typically either a frameset or a normal HTML document.
-- (BOOL)isMainDocument;
+// Add a child frame. [Should this be private? Only called when a
+// data source is created automatically in a frame set.
+- (void)addFrame: (WKWebFrame *)frame;
-// Returns an array of WKWebDataSource. The data sources in the array are
+
+// Returns an array of WKWebFrame. The data sources in the array are
// the data source assoicated with a frame set or iframe. If the main document
// is not a frameset, or has not iframes children will return nil.
- (NSArray *)children;
+- (WKWebFrame *)frameNamed: (NSString *)frameName;
+
// Returns an array of NSStrings or nil. The NSStrings corresponds to
// frame names. If this data source is the main document and has no
// frames then frameNames will return nil.
@@ -166,7 +176,11 @@
- (WKDOMDocument *)document;
#endif
-// Get the actual source of the docment.
+// Get the source of the document by reconstructing it from the DOM.
+- (NSString *)documentTextFromDOM;
+
+
+// Get the actual source of the document.
- (NSString *)documentText;
@@ -196,6 +210,8 @@
// Returns nil or the page title.
- (NSString *)pageTitle;
+- (NSString *)frameName;
+
@end
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index 48d1b3c..4733334 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -5,6 +5,9 @@
#import <WebKit/WKWebDataSource.h>
#import <WebKit/WKWebDataSourcePrivate.h>
#import <WebKit/WKException.h>
+#import <WebKit/WebKitDebug.h>
+
+#include <xml/dom_docimpl.h>
@implementation WKWebDataSource
@@ -46,6 +49,10 @@
return self;
}
+- (void)dealloc
+{
+ [_dataSourcePrivate release];
+}
#ifdef TENTATIVE_API
- initWithData: (NSData *)data
@@ -54,15 +61,14 @@
#endif
-// Returns nil if this data source represents the main document. Otherwise
-// returns the parent data source.
-- (WKWebDataSource *)parent
+// Returns the name of the frame containing this data source, or nil
+// if the data source is not in a frame set.
+- (NSString *)frameName
{
- return ((WKWebDataSourcePrivate *)_dataSourcePrivate)->parent;
+ return ((WKWebDataSourcePrivate *)_dataSourcePrivate)->frameName;
}
-
// Returns YES if this is the main document. The main document is the 'top'
// document, typically either a frameset or a normal HTML document.
- (BOOL)isMainDocument
@@ -73,14 +79,40 @@
}
+// Returns nil if this data source represents the main document. Otherwise
+// returns the parent data source.
+- (WKWebDataSource *)parent
+{
+ return ((WKWebDataSourcePrivate *)_dataSourcePrivate)->parent;
+}
+
+
// Returns an array of WKWebDataSource. The data sources in the array are
// the data source assoicated with a frame set or iframe. If the main document
// is not a frameset, or has not iframes children will return nil.
- (NSArray *)children
{
- return ((WKWebDataSourcePrivate *)_dataSourcePrivate)->children;
+ return [((WKWebDataSourcePrivate *)_dataSourcePrivate)->frames allValues];
+}
+
+- (void)addFrame: (WKWebFrame *)frame
+{
+ WKWebDataSourcePrivate *data = (WKWebDataSourcePrivate *)_dataSourcePrivate;
+
+ if (data->frames == nil)
+ data->frames = [[NSMutableDictionary alloc] init];
+ [data->frames setObject: frame forKey: [frame name]];
}
+
+- (WKWebFrame *)frameNamed: (NSString *)frameName
+{
+ WKWebDataSourcePrivate *data = (WKWebDataSourcePrivate *)_dataSourcePrivate;
+
+ return (WKWebFrame *)[data->frames objectForKey: frameName];
+}
+
+
// Returns an array of NSStrings or nil. The NSStrings corresponds to
// frame names. If this data source is the main document and has no
@@ -164,6 +196,7 @@
{
KURL url = [[[self inputURL] absoluteString] cString];
+ WEBKITDEBUG1 ("url = %s\n", [[[self inputURL] absoluteString] cString]);
[self _part]->openURL (url);
}
@@ -199,6 +232,26 @@
}
+- (NSString *)documentTextFromDOM
+{
+ DOM::DocumentImpl *doc;
+ NSString *string = nil;
+ KHTMLPart *part = [self _part];
+
+ if (part != 0){
+ doc = (DOM::DocumentImpl *)[self _part]->xmlDocImpl();
+ if (doc != 0){
+ QString str = doc->recursive_toHTML(1);
+ string = QSTRING_TO_NSSTRING(str);
+ }
+ }
+ if (string == nil) {
+ string = @"";
+ }
+ return string;
+}
+
+
// URL reference point, these should probably not be public for 1.0.
- (NSURL *)base
{
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index 718b7f4..c1557e6 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -15,10 +15,12 @@
@interface WKWebDataSourcePrivate : NSObject
{
WKWebDataSource *parent;
- NSArray *children;
+ NSMutableArray *children;
id <WKWebController>controller;
NSURL *inputURL;
KHTMLPart *part;
+ NSString *frameName;
+ NSMutableDictionary *frames;
}
- init;
@@ -29,4 +31,5 @@
@interface WKWebDataSource (WKPrivate)
- (void)_setController: (id <WKWebController>)controller;
- (KHTMLPart *)_part;
+- (void)_setFrameName: (NSString *)fName;
@end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 2e9824e..6b28728 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -16,7 +16,7 @@
- init
{
parent = nil;
- children = nil;
+ frames = nil;
controller = nil;
inputURL = nil;
@@ -30,9 +30,9 @@
// controller is not retained! WKWebControllers maintain
// a reference to their view and main data source.
[parent release];
- [children release];
+ [frames release];
- //delete part;
+ delete part;
}
@end
@@ -43,6 +43,7 @@
if (((WKWebDataSourcePrivate *)_dataSourcePrivate)->parent != nil)
[NSException raise:WKRuntimeError format:@"WKWebDataSource::_setController: called not called on main data source."];
((WKWebDataSourcePrivate *)_dataSourcePrivate)->controller = controller;
+ ((WKWebDataSourcePrivate *)_dataSourcePrivate)->part->setDataSource (self);
}
@@ -51,5 +52,9 @@
return ((WKWebDataSourcePrivate *)_dataSourcePrivate)->part;
}
+- (void)_setFrameName: (NSString *)fname
+{
+ ((WKWebDataSourcePrivate *)_dataSourcePrivate)->frameName = [fname retain];
+}
@end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/WebFrame.h b/WebKit/WebView.subproj/WebFrame.h
new file mode 100644
index 0000000..3c55879
--- /dev/null
+++ b/WebKit/WebView.subproj/WebFrame.h
@@ -0,0 +1,23 @@
+/*
+ WKWebFrame.h
+
+ Copyright 2001, Apple, Inc. All rights reserved.
+
+ Public header file.
+*/
+#import <Cocoa/Cocoa.h>
+
+ at class WKWebDataSource;
+
+ at interface WKWebFrame : NSObject
+{
+ NSString *name;
+ id view;
+ WKWebDataSource *dataSource;
+}
+- initWithName: (NSString *)name view: view dataSource: (WKWebDataSource *)dataSource;
+- (NSString *)name;
+- (void)setView: view;
+- view;
+- (WKWebDataSource *)dataSource;
+ at end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/WebFrameView.m b/WebKit/WebView.subproj/WebFrameView.m
index 19f2fb2..bcba506 100644
--- a/WebKit/WebView.subproj/WebFrameView.m
+++ b/WebKit/WebView.subproj/WebFrameView.m
@@ -59,7 +59,7 @@
// Nasty! Setup the cross references between the KHTMLView and
// the KHTMLPart.
- KHTMLPart *part = [[[self controller] mainDataSource] _part];
+ KHTMLPart *part = [[[self controller] dataSourceForView: self] _part];
data->widget = new KHTMLView (part, 0);
part->setView (data->widget);
@@ -264,6 +264,25 @@
(int)rect.size.width,
(int)rect.size.height );
//WebKitDebugAtLevel (0x200, "draw time %e\n", CFAbsoluteTimeGetCurrent() - start);
+
+#ifdef DEBUG_LAYOUT
+ NSRect vframe = [self frame];
+ [[NSColor blackColor] set];
+ NSBezierPath *path;
+ path = [NSBezierPath bezierPath];
+ [path setLineWidth:(float)0.1];
+ [path moveToPoint:NSMakePoint(0, 0)];
+ [path lineToPoint:NSMakePoint(vframe.size.width, vframe.size.height)];
+ [path closePath];
+ [path stroke];
+ path = [NSBezierPath bezierPath];
+ [path setLineWidth:(float)0.1];
+ [path moveToPoint:NSMakePoint(0, vframe.size.height)];
+ [path lineToPoint:NSMakePoint(vframe.size.width, 0)];
+ [path closePath];
+ [path stroke];
+#endif
+
[self unlockFocus];
}
}
@@ -293,15 +312,15 @@
{
int button, state;
- if ([event type] == NSLeftMouseDown){
+ if ([event type] == NSLeftMouseUp){
button = Qt::LeftButton;
state = Qt::LeftButton;
}
- else if ([event type] == NSRightMouseDown){
+ else if ([event type] == NSRightMouseUp){
button = Qt::RightButton;
state = Qt::RightButton;
}
- else if ([event type] == NSOtherMouseDown){
+ else if ([event type] == NSOtherMouseUp){
button = Qt::MidButton;
state = Qt::MidButton;
}
diff --git a/WebKit/WebView.subproj/WebFrameViewInternal.h b/WebKit/WebView.subproj/WebFrameViewInternal.h
index ae54238..6f754d1 100644
--- a/WebKit/WebView.subproj/WebFrameViewInternal.h
+++ b/WebKit/WebView.subproj/WebFrameViewInternal.h
@@ -27,4 +27,5 @@ class KHTMLView;
@interface WKWebView (WKPrivate)
- (void)_setController: (id <WKWebController>)controller;
- (void)_resetView;
+- (KHTMLView *)_widget;
@end
diff --git a/WebKit/WebView.subproj/WebFrameViewPrivate.h b/WebKit/WebView.subproj/WebFrameViewPrivate.h
index ae54238..6f754d1 100644
--- a/WebKit/WebView.subproj/WebFrameViewPrivate.h
+++ b/WebKit/WebView.subproj/WebFrameViewPrivate.h
@@ -27,4 +27,5 @@ class KHTMLView;
@interface WKWebView (WKPrivate)
- (void)_setController: (id <WKWebController>)controller;
- (void)_resetView;
+- (KHTMLView *)_widget;
@end
diff --git a/WebKit/WebView.subproj/WebFrameViewPrivate.m b/WebKit/WebView.subproj/WebFrameViewPrivate.m
index 9b78fc6..84b5c9c 100644
--- a/WebKit/WebView.subproj/WebFrameViewPrivate.m
+++ b/WebKit/WebView.subproj/WebFrameViewPrivate.m
@@ -28,8 +28,8 @@
// controller is not retained! WKWebControllers maintain
// a reference to their view and main data source.
- //if (widget)
- // delete widget;
+ if (widget)
+ delete widget;
}
@@ -59,4 +59,9 @@
((WKWebViewPrivate *)_viewPrivate)->controller = controller;
}
+- (KHTMLView *)_widget
+{
+ return ((WKWebViewPrivate *)_viewPrivate)->widget;
+}
+
@end
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list