+2006-10-09 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Alice.
+
+ - moved WebFormState into Loader directory and tweaked to void WebKit dependencies
+
+ * Loader/WebDocumentLoader.h:
+ * Loader/WebFormState.h: Added.
+ * Loader/WebFormState.m: Added.
+ (-[WebFormState initWithForm:values:sourceFrame:]):
+ (-[WebFormState dealloc]):
+ (-[WebFormState form]):
+ (-[WebFormState values]):
+ (-[WebFormState sourceFrame]):
+ * Loader/WebFrameLoader.h:
+ * Loader/WebFrameLoader.m:
+ (-[WebFrameLoader loadURL:referrer:loadType:target:triggeringEvent:form:formValues:]):
+ (-[WebFrameLoader continueLoadRequestAfterNavigationPolicy:formState:]):
+ (-[WebFrameLoader postWithURL:referrer:target:data:contentType:triggeringEvent:form:formValues:]):
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebView/WebFrame.m:
+ * WebView/WebFrameInternal.h:
+
2006-10-09 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
@class WebFrameLoader;
-// To be renamed to WebDocumentLoader
@interface WebDocumentLoader : NSObject
{
@public
--- /dev/null
+/*
+ * Copyright (C) 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
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+@class DOMElement;
+@class WebCoreFrameBridge;
+
+// One day we might want to expand the use of this kind of class such that we'd receive one
+// over the bridge, and possibly hand it on through to the FormsDelegate.
+// Today it is just used internally to keep some state as we make our way through a bunch
+// layers while doing a load.
+@interface WebFormState : NSObject
+{
+ DOMElement *_form;
+ NSDictionary *_values;
+ WebCoreFrameBridge *_sourceFrame;
+}
+- (id)initWithForm:(DOMElement *)form values:(NSDictionary *)values sourceFrame:(WebCoreFrameBridge *)sourceFrame;
+- (DOMElement *)form;
+- (NSDictionary *)values;
+- (WebCoreFrameBridge *)sourceFrame;
+@end
+
--- /dev/null
+/*
+ * Copyright (C) 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
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebFormState.h"
+
+@implementation WebFormState : NSObject
+
+- (id)initWithForm:(DOMElement *)form values:(NSDictionary *)values sourceFrame:(WebCoreFrameBridge *)sourceFrame
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ _form = [form retain];
+ _values = [values copy];
+ _sourceFrame = [sourceFrame retain];
+ return self;
+}
+
+- (void)dealloc
+{
+ [_form release];
+ [_values release];
+ [_sourceFrame release];
+ [super dealloc];
+}
+
+- (DOMElement *)form
+{
+ return _form;
+}
+
+- (NSDictionary *)values
+{
+ return _values;
+}
+
+- (WebCoreFrameBridge *)sourceFrame
+{
+ return _sourceFrame;
+}
+
+@end
+
@class WebFrameBridge;
@class WebLoader;
@class WebMainResourceLoader;
-@class WebArchive;
@protocol WebFrameLoaderClient;
@class WebArchive;
@class WebPolicyDecisionListener;
-@class WebResource;
typedef enum {
WebFrameStateProvisional,
#import "WebDataProtocol.h"
#import "WebDocumentLoader.h"
#import "WebFormDataStream.h"
+#import "WebFormState.h"
#import "WebFrameBridge.h"
#import "WebFrameLoaderClient.h"
#import "WebMainResourceLoader.h"
NSDictionary *action = [self actionInformationForLoadType:_loadType isFormSubmission:isFormSubmission event:event originalURL:URL];
WebFormState *formState = nil;
if (form && values)
- formState = [[WebFormState alloc] initWithForm:form values:values sourceFrame:client];
+ formState = [[WebFormState alloc] initWithForm:form values:values sourceFrame:[client _bridge]];
if (target != nil) {
WebFrame *targetFrame = [client findFrameNamed:target];
// It's a bit of a hack to reuse the WebPolicyDecisionListener for the continuation
// mechanism across the willSubmitForm callout.
listener = [[WebPolicyDecisionListener alloc] _initWithTarget:self action:@selector(continueAfterWillSubmitForm:)];
- [[[client webView] _formDelegate] frame:client sourceFrame:[formState sourceFrame] willSubmitForm:[formState form] withValues:[formState values] submissionListener:listener];
+ [[[client webView] _formDelegate] frame:client sourceFrame:[(WebFrameBridge *)[formState sourceFrame] webFrame] willSubmitForm:[formState form] withValues:[formState values] submissionListener:listener];
}
else {
[self continueAfterWillSubmitForm:WebPolicyUse];
NSDictionary *action = [self actionInformationForLoadType:FrameLoadTypeStandard isFormSubmission:YES event:event originalURL:URL];
WebFormState *formState = nil;
if (form && values)
- formState = [[WebFormState alloc] initWithForm:form values:values sourceFrame:client];
+ formState = [[WebFormState alloc] initWithForm:form values:values sourceFrame:[client _bridge]];
if (target != nil) {
WebFrame *targetFrame = [client findFrameNamed:target];
654B3C3C0A82C47200E1AE3D /* WebSubresourceLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 654B3C320A82C47200E1AE3D /* WebSubresourceLoader.m */; };
6550B7C7099EFAE90090D781 /* WebArchiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 6550B7C5099EFAE90090D781 /* WebArchiver.h */; };
6550B7C8099EFAE90090D781 /* WebArchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 6550B7C6099EFAE90090D781 /* WebArchiver.m */; };
+ 656D8B540ADA4EA400B34CBB /* WebFormState.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D8B520ADA4EA400B34CBB /* WebFormState.h */; };
+ 656D8B550ADA4EA400B34CBB /* WebFormState.m in Sources */ = {isa = PBXBuildFile; fileRef = 656D8B530ADA4EA400B34CBB /* WebFormState.m */; };
658A40960A14853B005E6987 /* WebDataSourceInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 658A40950A14853B005E6987 /* WebDataSourceInternal.h */; };
659044280A9D3B4200E89459 /* WebDocumentLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 659044260A9D3B4200E89459 /* WebDocumentLoader.h */; };
659044290A9D3B4200E89459 /* WebDocumentLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 659044270A9D3B4200E89459 /* WebDocumentLoader.m */; };
654B3C320A82C47200E1AE3D /* WebSubresourceLoader.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebSubresourceLoader.m; sourceTree = "<group>"; };
6550B7C5099EFAE90090D781 /* WebArchiver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebArchiver.h; sourceTree = "<group>"; };
6550B7C6099EFAE90090D781 /* WebArchiver.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebArchiver.m; sourceTree = "<group>"; };
+ 656D8B520ADA4EA400B34CBB /* WebFormState.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebFormState.h; sourceTree = "<group>"; };
+ 656D8B530ADA4EA400B34CBB /* WebFormState.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebFormState.m; sourceTree = "<group>"; };
6578F5DE045F817400000128 /* WebDownload.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDownload.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
6578F5DF045F817400000128 /* WebDownload.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDownload.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
65836F5E07EE425900682F95 /* WebPluginContainerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginContainerPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
659044270A9D3B4200E89459 /* WebDocumentLoader.m */,
6538B1C60A90596D00A07522 /* WebFormDataStream.h */,
6538B1C70A90596D00A07522 /* WebFormDataStream.m */,
+ 656D8B520ADA4EA400B34CBB /* WebFormState.h */,
+ 656D8B530ADA4EA400B34CBB /* WebFormState.m */,
654B3C290A82C47200E1AE3D /* WebFrameLoader.h */,
654B3C2A0A82C47200E1AE3D /* WebFrameLoader.m */,
930653930AD6FEF6008E969A /* WebFrameLoaderClient.h */,
1C0D40870AC1C8F40009C113 /* WebKitVersionChecks.h in Headers */,
65FFB7FC0AD0B7D30048CD05 /* WebDocumentLoaderMac.h in Headers */,
930653940AD6FEF6008E969A /* WebFrameLoaderClient.h in Headers */,
+ 656D8B540ADA4EA400B34CBB /* WebFormState.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
659044290A9D3B4200E89459 /* WebDocumentLoader.m in Sources */,
1C0D40880AC1C8F40009C113 /* WebKitVersionChecks.m in Sources */,
65FFB7FD0AD0B7D30048CD05 /* WebDocumentLoaderMac.m in Sources */,
+ 656D8B550ADA4EA400B34CBB /* WebFormState.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@end
-@implementation WebFormState : NSObject
-
-- (id)initWithForm:(DOMElement *)form values:(NSDictionary *)values sourceFrame:(WebFrame *)sourceFrame
-{
- self = [super init];
- if (!self)
- return nil;
-
- _form = [form retain];
- _values = [values copy];
- _sourceFrame = [sourceFrame retain];
- return self;
-}
-
-- (void)dealloc
-{
- [_form release];
- [_values release];
- [_sourceFrame release];
- [super dealloc];
-}
-
-- (DOMElement *)form
-{
- return _form;
-}
-
-- (NSDictionary *)values
-{
- return _values;
-}
-
-- (WebFrame *)sourceFrame
-{
- return _sourceFrame;
-}
-
-@end
-
@implementation WebFrame
- (id)init
@class WebFrameBridge;
@class WebFormState;
-// One day we might want to expand the use of this kind of class such that we'd receive one
-// over the bridge, and possibly hand it on through to the FormsDelegate.
-// Today it is just used internally to keep some state as we make our way through a bunch
-// layers while doing a load.
-@interface WebFormState : NSObject
-{
- DOMElement *_form;
- NSDictionary *_values;
- WebFrame *_sourceFrame;
-}
-- (id)initWithForm:(DOMElement *)form values:(NSDictionary *)values sourceFrame:(WebFrame *)sourceFrame;
-- (DOMElement *)form;
-- (NSDictionary *)values;
-- (WebFrame *)sourceFrame;
-@end
-
@interface WebFrame (WebInternal)
- (void)_updateBackground;