+2006-02-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - cut out a little unneeded bridge code
+
+ * bridge/mac/WebCoreFrameBridge.h: Removed frame name from createWindowWithURL: method
+ and changed it to return a page bridge. Also made createModalDialogWithURL: method
+ return a page bridge. Removed the mainFrame and webView methods.
+ * bridge/mac/WebCoreFrameBridge.mm:
+ (-[WebCoreFrameBridge nextFrameWithWrap:]): Use page to get to main frame.
+ (-[WebCoreFrameBridge setFrameNamespace:]): Ditto.
+ (-[WebCoreFrameBridge frameNamespace]): Ditto.
+ (-[WebCoreFrameBridge _shouldAllowAccessFrom:]): Ditto.
+ (-[WebCoreFrameBridge _frameInAnyWindowNamed:sourceFrame:]): Ditto.
+ (-[WebCoreFrameBridge findFrameNamed:]): Ditto.
+ (-[WebCoreFrameBridge installInFrame:]): Ditto.
+
+ * bridge/mac/WebCorePageBridge.h: Added outerView method to replace webView method
+ on the frame bridge.
+
+ * bridge/mac/BrowserExtensionMac.mm: (WebCore::BrowserExtensionMac::createNewWindow):
+ Update to use a page bridge instead of frame bridge.
+
2006-02-19 Maciej Stachowiak <mjs@apple.com>
Rubber-stamped by Anders.
/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#import "config.h"
#import "BrowserExtensionMac.h"
+#import "FrameTree.h"
#import "KWQExceptions.h"
#import "MacFrame.h"
#import "WebCoreFrameBridge.h"
+#import "WebCorePageBridge.h"
#import <kxmlcore/Assertions.h>
-#import "FrameTree.h"
namespace WebCore {
}
}
- WebCoreFrameBridge *bridge;
+ WebCorePageBridge *page;
if (winArgs.dialog)
- bridge = [m_frame->bridge() createModalDialogWithURL:url.getNSURL()];
+ page = [m_frame->bridge() createModalDialogWithURL:url.getNSURL()];
else
- bridge = [m_frame->bridge() createWindowWithURL:url.getNSURL() frameName:frameName];
-
- if (!bridge)
+ page = [m_frame->bridge() createWindowWithURL:url.getNSURL()];
+ if (!page)
return;
+ WebCoreFrameBridge *bridge = [page mainFrame];
if ([bridge impl])
[bridge impl]->tree()->setName(urlArgs.frameName);
NSRect windowFrame = [bridge windowFrame];
NSSize size = { 1, 1 }; // workaround for 4213314
- NSSize scaleRect = [[bridge webView] convertSize:size toView:nil];
+ NSSize scaleRect = [[page outerView] convertSize:size toView:nil];
float scaleX = scaleRect.width;
float scaleY = scaleRect.height;
// 'width' and 'height' specify the dimensions of the WebView, but we can only resize the window,
// so we compute a delta, translate it to window coordinates, and use the translated delta
// to resize the window.
- NSRect webViewFrame = [[bridge webView] frame];
+ NSRect webViewFrame = [[page outerView] frame];
if (winArgs.widthSet) {
float widthDelta = (winArgs.width - webViewFrame.size.width) * scaleX;
windowFrame.size.width += widthDelta;
WebUndoActionTyping,
} WebUndoAction;
-typedef enum
-{
+typedef enum {
ObjectElementNone,
ObjectElementImage,
ObjectElementFrame,
- (WebCoreFrameBridge *)childFrameNamed:(NSString *)name;
- (WebCoreFrameBridge *)findFrameNamed:(NSString *)name;
+
- (void)setFrameNamespace:(NSString *)ns;
- (NSString *)frameNamespace;
@protocol WebCoreFrameBridge
-- (WebCoreFrameBridge *)mainFrame;
- (void)frameDetached;
- (NSView *)documentView;
-- (WebView *)webView;
- (void)loadURL:(NSURL *)URL referrer:(NSString *)referrer reload:(BOOL)reload userGesture:(BOOL)forUser target:(NSString *)target triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values;
- (void)postWithURL:(NSURL *)URL referrer:(NSString *)referrer target:(NSString *)target data:(NSArray *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values;
-- (WebCoreFrameBridge *)createWindowWithURL:(NSURL *)URL frameName:(NSString *)name;
+- (WebCorePageBridge *)createWindowWithURL:(NSURL *)URL;
- (void)showWindow;
- (BOOL)canRunModal;
- (BOOL)canRunModalNow;
-- (WebCoreFrameBridge *)createModalDialogWithURL:(NSURL *)URL;
+- (WebCorePageBridge *)createModalDialogWithURL:(NSURL *)URL;
- (void)runModal;
- (NSString *)userAgentForURL:(NSURL *)URL;
- (WebCoreFrameBridge *)nextFrameWithWrap:(BOOL)wrapFlag
{
WebCoreFrameBridge *result = [self traverseNextFrameStayWithin:nil];
-
if (!result && wrapFlag)
- return [self mainFrame];
-
+ return [[self page] mainFrame];
return result;
}
- (void)setFrameNamespace:(NSString *)ns
{
- ASSERT(self == [self mainFrame]);
+ ASSERT(self == [[self page] mainFrame]);
if (ns != _frameNamespace){
[WebCoreFrameNamespaces removeFrame:self fromNamespace:_frameNamespace];
- (NSString *)frameNamespace
{
- ASSERT(self == [self mainFrame]);
+ ASSERT(self == [[self page] mainFrame]);
return _frameNamespace;
}
return YES;
// - allow access if the two frames are in the same window
- if ([self mainFrame] == [source mainFrame])
+ if ([self page] == [source page])
return YES;
// - allow if the request is made from a local file.
- (WebCoreFrameBridge *)_frameInAnyWindowNamed:(NSString *)name sourceFrame:(WebCoreFrameBridge *)source
{
- ASSERT(self == [self mainFrame]);
+ ASSERT(self == [[self page] mainFrame]);
// Try this WebView first.
WebCoreFrameBridge *frame = [self _descendantFrameNamed:name sourceFrame:source];
return self;
if ([name isEqualToString:@"_top"])
- return [self mainFrame];
+ return [[self page] mainFrame];
if ([name isEqualToString:@"_parent"]) {
WebCoreFrameBridge *parent = [self parent];
// Search in the main frame for this window then in others.
if (!frame)
- frame = [[self mainFrame] _frameInAnyWindowNamed:name sourceFrame:self];
+ frame = [[[self page] mainFrame] _frameInAnyWindowNamed:name sourceFrame:self];
return frame;
}
- (void)restoreDocumentState
{
DocumentImpl *doc = m_frame->document();
-
- if (doc != 0){
+ if (doc) {
NSArray *documentState = [self documentState];
QStringList s;
- (BOOL)scrollOverflowInDirection:(WebScrollDirection)direction granularity:(WebScrollGranularity)granularity
{
- if (m_frame == NULL) {
+ if (!m_frame)
return NO;
- }
return m_frame->scrollOverflow((KWQScrollDirection)direction, (KWQScrollGranularity)granularity);
}
// If we own the view, delete the old one - otherwise the render m_frame will take care of deleting the view.
[self removeFromFrame];
- FrameView* kview = new FrameView(m_frame);
- m_frame->setView(kview);
- kview->deref();
+ FrameView* frameView = new FrameView(m_frame);
+ m_frame->setView(frameView);
+ frameView->deref();
- kview->setView(view);
+ frameView->setView(view);
if (mw >= 0)
- kview->setMarginWidth(mw);
+ frameView->setMarginWidth(mw);
if (mh >= 0)
- kview->setMarginHeight(mh);
+ frameView->setMarginHeight(mh);
}
- (void)scrollToAnchor:(NSString *)a
{
// If this isn't the main frame, it must have a render m_frame set, or it
// won't ever get installed in the view hierarchy.
- ASSERT(self == [self mainFrame] || m_frame->ownerRenderer());
+ ASSERT(self == [[self page] mainFrame] || m_frame->ownerRenderer());
m_frame->view()->setView(view);
// FIXME: frame tries to do this too, is it needed?
// WebView in WebKit. It is a two-way bridge, with subclasses expected
// to implement a protocol of bridging methods.
-// The WebCorePageBridge interface contains methods for use by the
-// non-WebCore side of the bridge.
-
#ifdef __cplusplus
namespace WebCore { class Page; }
typedef WebCore::Page WebCorePage;
class WebCoreFrameBridge;
#endif
+// The WebCorePageBridge interface contains methods for use by the
+// non-WebCore side of the bridge.
+
@interface WebCorePageBridge : NSObject
{
- WebCorePage* _page;
+ WebCorePage *_page;
}
-- (void)setMainFrame:(WebCoreFrameBridge*)mainFrame;
+- (void)setMainFrame:(WebCoreFrameBridge *)mainFrame;
-- (WebCoreFrameBridge*)mainFrame;
+- (WebCoreFrameBridge *)mainFrame;
@end
// The WebCorePageBridge protocol contains methods for use by the WebCore side of the bridge.
@protocol WebCorePageBridge
+
+- (NSView *)outerView;
+
@end
// This interface definition allows those who hold a WebCorePageBridge * to call all the methods
// Could move this to another header, but would be a pity to create an entire header just for that.
@interface WebCorePageBridge (WebCoreInternalUse)
-- (WebCorePage*)impl;
+- (WebCorePage *)impl;
@end
+2006-02-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - cut out a little unneeded bridge code
+
+ * WebCoreSupport/WebFrameBridge.m:
+ (-[WebFrameBridge webView]): Added. Helper, since the WebCore side of the bridge no longer
+ has this method.
+ (-[WebFrameBridge createWindowWithURL:]): Removed the frameName parameter -- this is now
+ handled on the WebCore side. Also return a page bridge instead of a frame bridge.
+ (-[WebFrameBridge createModalDialogWithURL:]): Changed to return a page bridge instead of
+ a frame bridge.
+
+ * WebView/WebFrame.m: (-[WebFrame webView]): Change to get the webView from the page bridge
+ instead of the frame bridge, since it's a per-page thing.
+
+ * WebView/WebView.m: Removed init method since it just does what the default does (calls
+ initWithFrame: with a zero rect).
+ (-[WebView initWithCoder:]): Added checking so that if the obejcts have the wrong type
+ we will fail gracefully instead of hitting "method not found" and the like.
+ (-[WebView setPreferencesIdentifier:]): Fix storage leak. The WebPreferences object was
+ not released.
+ (-[WebView mainFrame]): Removed excess "return nil".
+ (-[WebView _pageBridge]): Added. Helper to let you go from the WebView to the bridge
+ from outside the WebView class.
+ * WebView/WebViewInternal.h: Put _pageBridge into an internal header.
+
+ * WebCoreSupport/WebPageBridge.m: (-[WebPageBridge outerView]): Added. Replaces "webView"
+ as public method to tell the WebCore side about the view everything's embedded in.
+
+ - other cleanup
+
+ * WebCoreSupport/WebPageBridge.h: Removed some unneeded declarations.
+
+ * Plugins/WebBaseNetscapePluginView.m: (-[WebBaseNetscapePluginView loadPluginRequest:]):
+ Rearrange code so it doesn't have to get the main frame twice.
+
2006-02-18 Maciej Stachowiak <mjs@apple.com>
Not reviewed.
} else {
newWebView = [[WebDefaultUIDelegate sharedUIDelegate] webView:currentWebView createWebViewWithRequest:nil];
}
-
- [[[newWebView mainFrame] _bridge] setName:frameName];
- [[newWebView _UIDelegateForwarder] webViewShow:newWebView];
frame = [newWebView mainFrame];
+ [[frame _bridge] setName:frameName];
+ [[newWebView _UIDelegateForwarder] webViewShow:newWebView];
}
}
@end
@interface NSView (JavaPluginSecrets)
-- (jobject)pollForAppletInWindow: (NSWindow *)window;
+- (jobject)pollForAppletInWindow:(NSWindow *)window;
@end
NSString *WebPluginBaseURLKey = @"WebPluginBaseURL";
@implementation WebFrameBridge
+- (WebView *)webView
+{
+ ASSERT([[self page] isKindOfClass:[WebPageBridge class]]);
+ return [(WebPageBridge *)[self page] webView];
+}
+
- (id)initMainFrameWithPage:(WebPageBridge *)page frameName:(NSString *)name view:(WebFrameView *)view
{
self = [super initMainFrameWithPage:page];
return [[[self webView] mainFrame] _bridge];
}
-- (WebView *)webView
-{
- ASSERT([[self page] isKindOfClass:[WebPageBridge class]]);
- return [(WebPageBridge *)[self page] webView];
-}
-
- (NSView *)documentView
{
ASSERT(_frame != nil);
return [[_frame frameView] documentView];
}
-- (WebCoreFrameBridge *)createWindowWithURL:(NSURL *)URL frameName:(NSString *)name
+- (WebCorePageBridge *)createWindowWithURL:(NSURL *)URL
{
ASSERT(_frame != nil);
NSMutableURLRequest *request = nil;
-
if (URL != nil && ![URL _web_isEmpty]) {
request = [NSMutableURLRequest requestWithURL:URL];
[request _web_setHTTPReferrer:[self referrer]];
WebView *currentWebView = [self webView];
id wd = [currentWebView UIDelegate];
- WebView *newWebView = nil;
-
+ WebView *newWebView;
if ([wd respondsToSelector:@selector(webView:createWebViewWithRequest:)])
newWebView = [wd webView:currentWebView createWebViewWithRequest:request];
else
newWebView = [[WebDefaultUIDelegate sharedUIDelegate] webView:currentWebView createWebViewWithRequest:request];
- WebFrameBridge *resultBridge = [[newWebView mainFrame] _bridge];
- [resultBridge setName:name];
- return resultBridge;
+ return [newWebView _pageBridge];
}
- (void)showWindow
{
WebView *wv = [self webView];
- [[wv _UIDelegateForwarder] webViewShow: wv];
+ [[wv _UIDelegateForwarder] webViewShow:wv];
}
- (BOOL)areToolbarsVisible
ASSERT(_frame != nil);
WebView *wv = [self webView];
id wd = [wv UIDelegate];
- if ([wd respondsToSelector: @selector(webViewAreToolbarsVisible:)])
- return [wd webViewAreToolbarsVisible: wv];
+ if ([wd respondsToSelector:@selector(webViewAreToolbarsVisible:)])
+ return [wd webViewAreToolbarsVisible:wv];
return [[WebDefaultUIDelegate sharedUIDelegate] webViewAreToolbarsVisible:wv];
}
ASSERT(_frame != nil);
WebView *wv = [self webView];
id wd = [wv UIDelegate];
- if ([wd respondsToSelector: @selector(webViewIsStatusBarVisible:)])
+ if ([wd respondsToSelector:@selector(webViewIsStatusBarVisible:)])
return [wd webViewIsStatusBarVisible:wv];
return [[WebDefaultUIDelegate sharedUIDelegate] webViewIsStatusBarVisible:wv];
}
id wd = [wv UIDelegate];
// Check whether delegate implements new version, then whether delegate implements old version. If neither,
// fall back to shared delegate's implementation of new version.
- if ([wd respondsToSelector: @selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:)])
+ if ([wd respondsToSelector:@selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:)])
return [wd webView:wv runJavaScriptConfirmPanelWithMessage:message initiatedByFrame:_frame];
- if ([wd respondsToSelector: @selector(webView:runJavaScriptConfirmPanelWithMessage:)])
+ if ([wd respondsToSelector:@selector(webView:runJavaScriptConfirmPanelWithMessage:)])
return [wd webView:wv runJavaScriptConfirmPanelWithMessage:message];
return [[WebDefaultUIDelegate sharedUIDelegate] webView:wv runJavaScriptConfirmPanelWithMessage:message initiatedByFrame:_frame];
}
id wd = [wv UIDelegate];
// Check whether delegate implements new version, then whether delegate implements old version. If neither,
// fall back to shared delegate's implementation of new version.
- if ([wd respondsToSelector: @selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:)])
+ if ([wd respondsToSelector:@selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:)])
*result = [wd webView:wv runJavaScriptTextInputPanelWithPrompt:prompt defaultText:defaultText initiatedByFrame:_frame];
- else if ([wd respondsToSelector: @selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:)])
+ else if ([wd respondsToSelector:@selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:)])
*result = [wd webView:wv runJavaScriptTextInputPanelWithPrompt:prompt defaultText:defaultText];
else
*result = [[WebDefaultUIDelegate sharedUIDelegate] webView:wv runJavaScriptTextInputPanelWithPrompt:prompt defaultText:defaultText initiatedByFrame:_frame];
{
WebView *wv = [self webView];
id wd = [wv UIDelegate];
- if ([wd respondsToSelector: @selector(webView:addMessageToConsole:)])
+ if ([wd respondsToSelector:@selector(webView:addMessageToConsole:)])
[wd webView:wv addMessageToConsole:message];
}
}
- (WebCoreFrameBridge *)createChildFrameNamed:(NSString *)frameName
- withURL:(NSURL *)URL
- referrer:(NSString *)referrer
- renderPart:(WebCoreRenderPart *)childRenderPart
- allowsScrolling:(BOOL)allowsScrolling
- marginWidth:(int)width
- marginHeight:(int)height
+ withURL:(NSURL *)URL
+ referrer:(NSString *)referrer
+ renderPart:(WebCoreRenderPart *)childRenderPart
+ allowsScrolling:(BOOL)allowsScrolling
+ marginWidth:(int)width
+ marginHeight:(int)height
{
BOOL hideReferrer;
if (![self canLoadURL:URL fromReferrer:referrer hideReferrer:&hideReferrer])
WebHistoryItem *item = [_frame _itemForSavingDocState];
LOG(Loading, "%@: saving form state from to 0x%x", [_frame name], item);
if (item) {
- [item setDocumentState: documentState];
+ [item setDocumentState:documentState];
// You might think we could save the scroll state here too, but unfortunately this
// often gets called after WebFrame::_transitionToCommitted has restored the scroll
// position of the next document.
return [[_frame _itemForRestoringDocState] documentState];
}
-- (BOOL)saveDocumentToPageCache: documentInfo
+- (BOOL)saveDocumentToPageCache:(id)documentInfo
{
WebHistoryItem *item = [_frame _itemForSavingDocState];
if (![item hasPageCache]) {
return false;
}
- [[item pageCache] setObject: documentInfo forKey: WebCorePageCacheStateKey];
+ [[item pageCache] setObject:documentInfo forKey:WebCorePageCacheStateKey];
return true;
}
- (jobject)getAppletInView:(NSView *)view
{
- jobject applet = 0;
+ jobject applet;
- if ([view respondsToSelector: @selector(webPlugInGetApplet)])
+ if ([view respondsToSelector:@selector(webPlugInGetApplet)])
applet = [view webPlugInGetApplet];
else
applet = [self pollForAppletInView:view];
// until a timeout is exceeded. It will return nil if the timeour is
// exceeded.
// Deprecated, use getAppletInView:.
-- (jobject)pollForAppletInView: (NSView *)view
+- (jobject)pollForAppletInView:(NSView *)view
{
jobject applet = 0;
- if ([view respondsToSelector: @selector(pollForAppletInWindow:)]) {
+ if ([view respondsToSelector:@selector(pollForAppletInWindow:)]) {
// The Java VM needs the containing window of the view to
// initialize. The view may not yet be in the window's view
// hierarchy, so we have to pass the window when requesting
[wv _addScrollerDashboardRegions:regions];
if (![self _compareDashboardRegions:regions]) {
- if ([wd respondsToSelector: @selector(webView:dashboardRegionsChanged:)]) {
+ if ([wd respondsToSelector:@selector(webView:dashboardRegionsChanged:)]) {
[wd webView:wv dashboardRegionsChanged:regions];
[lastDashboardRegions release];
lastDashboardRegions = [regions retain];
return [isPreviousCharacter ? _getPreSmartSet() : _getPostSmartSet() characterIsMember:c];
}
-- (WebCoreFrameBridge *)createModalDialogWithURL:(NSURL *)URL
+- (WebCorePageBridge *)createModalDialogWithURL:(NSURL *)URL
{
ASSERT(_frame != nil);
else
newWebView = [[WebDefaultUIDelegate sharedUIDelegate] webView:currentWebView createWebViewWithRequest:request];
- return [[newWebView mainFrame] _bridge];
+ return [newWebView _pageBridge];
}
- (BOOL)canRunModal
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <Foundation/Foundation.h>
-
#import <WebCore/WebCorePageBridge.h>
-@class WebPageBridge;
-@class WebFrameBridge;
@class WebFrameView;
@class WebView;
return _webView;
}
+- (NSView *)outerView
+{
+ return _webView;
+}
+
@end
- (WebView *)webView
{
- return [[self _bridge] webView];
+ return [[[self _bridge] page] webView];
}
- (DOMDocument *)DOMDocument
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <WebKit/WebViewInternal.h>
-
-#import <WebKit/DOM.h>
-#import <WebKit/DOMExtensions.h>
-#import <WebKit/WebAssertions.h>
-#import <WebKit/WebBackForwardList.h>
-#import <WebKit/WebBaseNetscapePluginView.h>
-#import <WebKit/WebFrameBridge.h>
-#import <WebKit/WebPageBridge.h>
-#import <WebKit/WebDashboardRegion.h>
-#import <WebKit/WebDataProtocol.h>
-#import <WebKit/WebDataSourcePrivate.h>
-#import <WebKit/WebDefaultEditingDelegate.h>
-#import <WebKit/WebDefaultFrameLoadDelegate.h>
-#import <WebKit/WebDefaultPolicyDelegate.h>
-#import <WebKit/WebDefaultResourceLoadDelegate.h>
-#import <WebKit/WebDefaultScriptDebugDelegate.h>
-#import <WebKit/WebDefaultUIDelegate.h>
-#import <WebKit/WebDOMOperationsPrivate.h>
-#import <WebKit/WebDocument.h>
-#import <WebKit/WebDocumentInternal.h>
-#import <WebKit/WebDynamicScrollBarsView.h>
-#import <WebKit/WebDownload.h>
-#import <WebKit/WebDownloadInternal.h>
-#import <WebKit/WebEditingDelegate.h>
-#import <WebKit/WebFormDelegatePrivate.h>
-#import <WebKit/WebFrameInternal.h>
-#import <WebKit/WebFrameViewInternal.h>
-#import <WebKit/WebHistoryItemPrivate.h>
-#import <WebKit/WebHTMLRepresentation.h>
-#import <WebKit/WebHTMLViewInternal.h>
-#import <WebKit/WebIconDatabase.h>
-#import <WebKit/WebKitErrors.h>
-#import <WebKit/WebKitLogging.h>
-#import <WebKit/WebLocalizableStrings.h>
-#import <WebKit/WebKitNSStringExtras.h>
-#import <WebKit/WebKitStatisticsPrivate.h>
-#import <WebKit/WebNSDataExtras.h>
-#import <WebKit/WebNSDataExtrasPrivate.h>
-#import <WebKit/WebNSDictionaryExtras.h>
-#import <WebKit/WebNSObjectExtras.h>
-#import <WebKit/WebNSPasteboardExtras.h>
-#import <WebKit/WebNSPrintOperationExtras.h>
-#import <WebKit/WebNSEventExtras.h>
-#import <WebKit/WebNSURLExtras.h>
-#import <WebKit/WebNSURLRequestExtras.h>
-#import <WebKit/WebNSUserDefaultsExtras.h>
-#import <WebKit/WebNSViewExtras.h>
-#import <WebKit/WebPluginDatabase.h>
-#import <WebKit/WebPolicyDelegate.h>
-#import <WebKit/WebPreferencesPrivate.h>
-#import <WebKit/WebResourceLoadDelegate.h>
-#import <WebKit/WebScriptDebugDelegatePrivate.h>
-#import <WebKit/WebTextView.h>
-#import <WebKit/WebTextRepresentation.h>
-#import <WebKit/WebTextRenderer.h>
-#import <WebKit/WebUIDelegate.h>
-#import <WebKit/WebUIDelegatePrivate.h>
-#import <WebKit/WebInspector.h>
-#import <WebKitSystemInterface.h>
-
+#import "WebViewInternal.h"
+
+#import "WebAssertions.h"
+#import "WebBackForwardList.h"
+#import "WebBaseNetscapePluginView.h"
+#import "WebDOMOperationsPrivate.h"
+#import "WebDashboardRegion.h"
+#import "WebDataProtocol.h"
+#import "WebDataSourcePrivate.h"
+#import "WebDefaultEditingDelegate.h"
+#import "WebDefaultFrameLoadDelegate.h"
+#import "WebDefaultPolicyDelegate.h"
+#import "WebDefaultResourceLoadDelegate.h"
+#import "WebDefaultScriptDebugDelegate.h"
+#import "WebDefaultUIDelegate.h"
+#import "WebDocument.h"
+#import "WebDocumentInternal.h"
+#import "WebDownload.h"
+#import "WebDownloadInternal.h"
+#import "WebDynamicScrollBarsView.h"
+#import "WebEditingDelegate.h"
+#import "WebFormDelegatePrivate.h"
+#import "WebFrameBridge.h"
+#import "WebFrameInternal.h"
+#import "WebFrameViewInternal.h"
+#import "WebHTMLRepresentation.h"
+#import "WebHTMLViewInternal.h"
+#import "WebHistoryItemPrivate.h"
+#import "WebIconDatabase.h"
+#import "WebInspector.h"
+#import "WebKitErrors.h"
+#import "WebKitLogging.h"
+#import "WebKitNSStringExtras.h"
+#import "WebKitStatisticsPrivate.h"
+#import "WebLocalizableStrings.h"
+#import "WebNSDataExtras.h"
+#import "WebNSDataExtrasPrivate.h"
+#import "WebNSDictionaryExtras.h"
+#import "WebNSEventExtras.h"
+#import "WebNSObjectExtras.h"
+#import "WebNSPasteboardExtras.h"
+#import "WebNSPrintOperationExtras.h"
+#import "WebNSURLExtras.h"
+#import "WebNSURLRequestExtras.h"
+#import "WebNSUserDefaultsExtras.h"
+#import "WebNSViewExtras.h"
+#import "WebPageBridge.h"
+#import "WebPluginDatabase.h"
+#import "WebPolicyDelegate.h"
+#import "WebPreferencesPrivate.h"
+#import "WebResourceLoadDelegate.h"
+#import "WebScriptDebugDelegatePrivate.h"
+#import "WebTextRenderer.h"
+#import "WebTextRepresentation.h"
+#import "WebTextView.h"
+#import "WebUIDelegate.h"
+#import "WebUIDelegatePrivate.h"
+#import <CoreFoundation/CFSet.h>
+#import <Foundation/NSURLConnection.h>
#import <WebCore/WebCoreEncodings.h>
#import <WebCore/WebCoreSettings.h>
#import <WebCore/WebCoreView.h>
-
-#import <CoreFoundation/CFSet.h>
-
-#import <Foundation/NSURLConnection.h>
+#import <WebKit/DOM.h>
+#import <WebKit/DOMExtensions.h>
+#import <WebKitSystemInterface.h>
#import <objc/objc-runtime.h>
#if __ppc__
name:WebPreferencesChangedNotification object:[self preferences]];
}
-- init
-{
- return [self initWithFrame: NSZeroRect frameName: nil groupName: nil];
-}
-
-- initWithFrame: (NSRect)f
+- initWithFrame:(NSRect)f
{
- return [self initWithFrame: f frameName:nil groupName:nil];
+ return [self initWithFrame:f frameName:nil groupName:nil];
}
-- initWithFrame: (NSRect)f frameName: (NSString *)frameName groupName: (NSString *)groupName;
+- initWithFrame:(NSRect)f frameName:(NSString *)frameName groupName:(NSString *)groupName;
{
self = [super initWithFrame:f];
if (!self)
NSString *frameName;
NSString *groupName;
-
+ WebPreferences *preferences;
+ BOOL useBackForwardList;
+
result = [super initWithCoder:decoder];
result->_private = [[WebViewPrivate alloc] init];
-
- // We don't want any of the archived subviews. The subviews will always
+
+ // We don't want any of the archived subviews. The subviews will always
// be created in _commonInitializationFrameName:groupName:.
[[result subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
-
- if ([decoder allowsKeyedCoding]){
+
+ if ([decoder allowsKeyedCoding]) {
frameName = [decoder decodeObjectForKey:@"FrameName"];
groupName = [decoder decodeObjectForKey:@"GroupName"];
-
- [result setPreferences: [decoder decodeObjectForKey:@"Preferences"]];
+ preferences = [decoder decodeObjectForKey:@"Preferences"];
result->_private->useBackForwardList = [decoder decodeBoolForKey:@"UseBackForwardList"];
-
- LOG (Encoding, "FrameName = %@, GroupName = %@, useBackForwardList = %d\n", frameName, groupName, (int)_private->useBackForwardList);
- }
- else {
+ } else {
int version;
-
[decoder decodeValueOfObjCType:@encode(int) at:&version];
frameName = [decoder decodeObject];
groupName = [decoder decodeObject];
- [result setPreferences: [decoder decodeObject]];
+ preferences = [decoder decodeObject];
if (version > 1)
- [decoder decodeValuesOfObjCTypes:"c",&result->_private->useBackForwardList];
+ [decoder decodeValuesOfObjCTypes:"c", &useBackForwardList];
}
+
+ if (![frameName isKindOfClass:[NSString class]])
+ frameName = nil;
+ if (![groupName isKindOfClass:[NSString class]])
+ groupName = nil;
+ if (![preferences isKindOfClass:[WebPreferences class]])
+ preferences = nil;
+
+ LOG(Encoding, "FrameName = %@, GroupName = %@, useBackForwardList = %d\n", frameName, groupName, (int)useBackForwardList);
+
+ if (preferences)
+ [result setPreferences:preferences];
+ result->_private->useBackForwardList = useBackForwardList;
[result _commonInitializationWithFrameName:frameName groupName:groupName];
-
+
NS_HANDLER
result = nil;
{
[super encodeWithCoder:encoder];
- if ([encoder allowsKeyedCoding]){
+ if ([encoder allowsKeyedCoding]) {
[encoder encodeObject:[[self mainFrame] name] forKey:@"FrameName"];
[encoder encodeObject:[self groupName] forKey:@"GroupName"];
[encoder encodeObject:[self preferences] forKey:@"Preferences"];
[encoder encodeBool:_private->useBackForwardList forKey:@"UseBackForwardList"];
-
- LOG (Encoding, "FrameName = %@, GroupName = %@, useBackForwardList = %d\n", [[self mainFrame] name], [self groupName], (int)_private->useBackForwardList);
- }
- else {
+ } else {
int version = WebViewVersion;
[encoder encodeValueOfObjCType:@encode(int) at:&version];
[encoder encodeObject:[[self mainFrame] name]];
[encoder encodeObject:[self groupName]];
[encoder encodeObject:[self preferences]];
- [encoder encodeValuesOfObjCTypes:"c",&_private->useBackForwardList];
+ [encoder encodeValuesOfObjCTypes:"c", &_private->useBackForwardList];
}
+
+ LOG(Encoding, "FrameName = %@, GroupName = %@, useBackForwardList = %d\n", [[self mainFrame] name], [self groupName], (int)_private->useBackForwardList);
}
- (void)dealloc
[super finalize];
}
-- (void)setPreferences: (WebPreferences *)prefs
+- (void)setPreferences:(WebPreferences *)prefs
{
- if (_private->preferences != prefs){
- [[NSNotificationCenter defaultCenter] removeObserver: self name: WebPreferencesChangedNotification object: [self preferences]];
- [WebPreferences _removeReferenceForIdentifier: [_private->preferences identifier]];
+ if (_private->preferences != prefs) {
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:WebPreferencesChangedNotification object:[self preferences]];
+ [WebPreferences _removeReferenceForIdentifier:[_private->preferences identifier]];
[_private->preferences release];
_private->preferences = [prefs retain];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:)
- name:WebPreferencesChangedNotification object:[self preferences]];
-
+ name:WebPreferencesChangedNotification object:[self preferences]];
[[NSNotificationCenter defaultCenter]
- postNotificationName:WebPreferencesChangedNotification object:prefs userInfo:nil];
+ postNotificationName:WebPreferencesChangedNotification object:prefs userInfo:nil];
}
}
- (void)setPreferencesIdentifier:(NSString *)anIdentifier
{
- if (![anIdentifier isEqual: [[self preferences] identifier]]){
- [self setPreferences: [[WebPreferences alloc] initWithIdentifier:anIdentifier]];
+ if (![anIdentifier isEqual:[[self preferences] identifier]]) {
+ WebPreferences *prefs = [[WebPreferences alloc] initWithIdentifier:anIdentifier];
+ [self setPreferences:prefs];
+ [prefs release];
}
}
return nil;
return [(WebFrameBridge *)[_private->_pageBridge mainFrame] webFrame];
-
- return nil;
}
- (WebBackForwardList *)backForwardList
}
@end
+
+@implementation WebView (WebViewBridge)
+
+- (WebPageBridge *)_pageBridge
+{
+ return _private->_pageBridge;
+}
+
+@end
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
// This header contains WebView declarations that can be used anywhere in the Web Kit, but are neither SPI nor API.
-#import <WebKit/WebViewPrivate.h>
+#import "WebViewPrivate.h"
-@class DOMCSSStyleDeclaration;
-@class WebBackForwardList;
-
-@protocol WebDocumentDragging;
+@class WebPageBridge;
@interface WebView (WebViewEditingExtras)
- (BOOL)_interceptEditingKeyEvent:(NSEvent *)event;
- (void)_removeFromAllWebViewsSet;
- (void)_addToAllWebViewsSet;
@end
+
+@interface WebView (WebViewBridge)
+- (WebPageBridge *)_pageBridge;
+@end