[webkit-changes] cvs commit: WebKit/WebView.subproj WebFrame.m
WebFrameInternal.h WebFramePrivate.h WebView.m
WebViewPrivate.h WebControllerSets.h WebControllerSets.m
Maciej
mjs at opensource.apple.com
Wed Jan 4 22:41:38 PST 2006
mjs 06/01/04 22:41:38
Modified: . ChangeLog WebCore.exp
WebCore.xcodeproj project.pbxproj
kwq KWQKHTMLPart.mm WebCoreBridge.h WebCoreBridge.mm
. ChangeLog
Plugins.subproj WebBaseNetscapePluginView.m
WebCoreSupport.subproj WebBridge.m
WebKit.xcodeproj project.pbxproj
WebView.subproj WebFrame.m WebFrameInternal.h
WebFramePrivate.h WebView.m WebViewPrivate.h
Added: kwq WebCoreFrameNamespaces.h WebCoreFrameNamespaces.m
Removed: WebView.subproj WebControllerSets.h WebControllerSets.m
Log:
WebCore:
Reviewed by Eric.
Based on a patch by Eric.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6180
"text" output in fragment produced by XSLTProccessor is wrong (has xhtml garbage)
* khtml/xsl/xslt_processorimpl.cpp:
(DOM::xsltParamArrayFromParameterMap):
(DOM::freeXsltParamArray):
Use fastMalloc/fastFree.
(DOM::createFragmentFromSource):
If the output is "text", just create a text node and add
it to the fragment.
WebKit:
Reviewed by Darin.
- move frame management and finding code from WebKit to WebCore
http://bugzilla.opendarwin.org/show_bug.cgi?id=6368
* Plugins.subproj/WebBaseNetscapePluginView.m:
(-[WebBaseNetscapePluginView loadPluginRequest:]): Set frame name straight on the bridge,
instead of having it bubble through the view and frame.
* WebCoreSupport.subproj/WebBridge.m:
(-[WebBridge initWithFrameName:view:]): don't pass name to frame, we own it now; set it
on ourselves directly
(-[WebBridge findFrameNamed:]): removed
(-[WebBridge createWindowWithURL:frameName:]): set name on bridge, not webview
(-[WebBridge createChildFrameNamed:withURL:referrer:renderPart:allowsScrolling:marginWidth:marginHeight:]):
(-[WebBridge runModal]): remove excess braces
* WebKit.xcodeproj/project.pbxproj:
* WebView.subproj/WebControllerSets.h: Removed.
* WebView.subproj/WebControllerSets.m: Removed.
* WebView.subproj/WebFrame.m:
(-[WebFramePrivate name]): removed
(-[WebFramePrivate setName:]): removed
(-[WebFramePrivate dealloc]): don't release name, we no longer have one
(-[WebFrame _appendChild:]): removed
(-[WebFrame _removeChild:]): removed
(-[WebFrame _createItem:]): removed stray space
(-[WebFrame _immediateChildFrameNamed:]): Just call the bridge
(-[WebFrame _setName:]): removed
(-[WebFrame _detachFromParent]): remove bridge from parent note self
(-[WebFrame _continueLoadRequestAfterNewWindowPolicy:frameName:formState:]):
(-[WebFrame _addChild:]): Call appendChild: on bridge, not self
(-[WebFrame _nextFrameWithWrap:]): just call bridge (and moved helpers there)
(-[WebFrame _previousFrameWithWrap:]): just call bridge (and moved helpers there)
(-[WebFrame _initWithWebFrameView:webView:bridge:]): don't take a name any more
(-[WebFrame _setFrameNamespace:]): just call bridge
(-[WebFrame _frameNamespace]): just call bridge
(-[WebFrame _hasSelection]): remove excess braces
(-[WebFrame _clearSelection]): ditto
(-[WebFrame initWithName:webFrameView:webView:]): no more name
(-[WebFrame name]): just call bridge
(-[WebFrame findFrameNamed:]): just call bridge (and moved helpers there)
(-[WebFrame parentFrame]): fixed for new style
* WebView.subproj/WebFrameInternal.h:
* WebView.subproj/WebFramePrivate.h:
* WebView.subproj/WebView.m:
* WebView.subproj/WebViewPrivate.h:
Revision Changes Path
1.89 +30 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- ChangeLog 4 Jan 2006 21:17:54 -0000 1.88
+++ ChangeLog 5 Jan 2006 06:41:20 -0000 1.89
@@ -176,6 +176,36 @@
2006-01-03 Maciej Stachowiak <mjs at apple.com>
+ Reviewed by Darin.
+
+ - move frame management and finding code from WebKit to WebCore
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=6368
+
+ * WebCore.exp: export WebCoreFrameNamespace
+ * WebCore.xcodeproj/project.pbxproj: add new files
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::setName): Don't call to bridge any more, not needed
+ * kwq/WebCoreBridge.h:
+ * kwq/WebCoreBridge.mm:
+ (isCaseSensitiveEqual): helper function
+ (-[WebCoreBridge appendChild:]): remove excess braces
+ (-[WebCoreBridge childFrameNamed:]): moved here from WebFrame
+ (-[WebCoreBridge _deepLastChildFrame]): ditto
+ (-[WebCoreBridge nextFrameWithWrap:]): ditto
+ (-[WebCoreBridge previousFrameWithWrap:]): ditto
+ (-[WebCoreBridge setFrameNamespace:]): ditto
+ (-[WebCoreBridge frameNamespace]): ditto
+ (-[WebCoreBridge _shouldAllowAccessFrom:]): ditto
+ (-[WebCoreBridge _descendantFrameNamed:sourceFrame:]): ditto
+ (-[WebCoreBridge _frameInAnyWindowNamed:sourceFrame:]): ditto
+ (-[WebCoreBridge findFrameNamed:]): ditto
+ (-[WebCoreBridge setName:]): don't call KHTMLPart setName directly,
+ the kwq version is fine
+ (-[WebCoreBridge _addFramePathToString:]): moved from WebFrame
+ (-[WebCoreBridge generateFrameName]): ditto
+
+2006-01-03 Maciej Stachowiak <mjs at apple.com>
+
Reviewed by Vicki.
- moved frame traversal code across from bridge, also dropped the children
1.48 +1 -0 WebCore/WebCore.exp
Index: WebCore.exp
===================================================================
RCS file: /cvs/root/WebCore/WebCore.exp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- WebCore.exp 10 Dec 2005 20:40:13 -0000 1.47
+++ WebCore.exp 5 Jan 2006 06:41:20 -0000 1.48
@@ -106,6 +106,7 @@
.objc_class_name_WebCoreCache
.objc_class_name_WebCoreCookieAdapter
.objc_class_name_WebCoreEncodings
+.objc_class_name_WebCoreFrameNamespaces
.objc_class_name_WebCoreGraphicsBridge
.objc_class_name_WebCoreHistory
.objc_class_name_WebCoreImageRendererFactory
1.64 +8 -0 WebCore/WebCore.xcodeproj/project.pbxproj
Index: project.pbxproj
===================================================================
RCS file: /cvs/root/WebCore/WebCore.xcodeproj/project.pbxproj,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- project.pbxproj 4 Jan 2006 08:20:15 -0000 1.63
+++ project.pbxproj 5 Jan 2006 06:41:21 -0000 1.64
@@ -68,6 +68,8 @@
65436082083DB9FC00C20475 /* wrap_contents_in_dummy_span_command.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6543606E083DB9FB00C20475 /* wrap_contents_in_dummy_span_command.cpp */; };
654D87B70831973B0082DCA1 /* edit_command.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 654D87B50831973B0082DCA1 /* edit_command.cpp */; };
654D87B80831973B0082DCA1 /* edit_command.h in Headers */ = {isa = PBXBuildFile; fileRef = 654D87B60831973B0082DCA1 /* edit_command.h */; };
+ 6552E7AA096AA11B0006F248 /* WebCoreFrameNamespaces.h in Headers */ = {isa = PBXBuildFile; fileRef = 6552E7A8096AA11B0006F248 /* WebCoreFrameNamespaces.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 6552E7AB096AA11B0006F248 /* WebCoreFrameNamespaces.m in Sources */ = {isa = PBXBuildFile; fileRef = 6552E7A9096AA11B0006F248 /* WebCoreFrameNamespaces.m */; };
65AC79A10831ED6D009385CE /* append_node_command.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65AC799F0831ED6D009385CE /* append_node_command.cpp */; };
65AC79A20831ED6D009385CE /* append_node_command.h in Headers */ = {isa = PBXBuildFile; fileRef = 65AC79A00831ED6D009385CE /* append_node_command.h */; };
65AC79A90831F006009385CE /* apply_style_command.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65AC79A70831F006009385CE /* apply_style_command.cpp */; };
@@ -1700,6 +1702,8 @@
654D87B60831973B0082DCA1 /* edit_command.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = edit_command.h; path = editing/edit_command.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
654E7EE00569FD4600358BD2 /* xmlhttprequest.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xmlhttprequest.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
654E7EE10569FD4600358BD2 /* xmlhttprequest.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = xmlhttprequest.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+ 6552E7A8096AA11B0006F248 /* WebCoreFrameNamespaces.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreFrameNamespaces.h; sourceTree = "<group>"; };
+ 6552E7A9096AA11B0006F248 /* WebCoreFrameNamespaces.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebCoreFrameNamespaces.m; sourceTree = "<group>"; };
65732B68054EF483007B42F8 /* KWQKPartsPart.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQKPartsPart.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
65912B0D0586921000123A69 /* xmlserializer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xmlserializer.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
65912B0E0586921000123A69 /* xmlserializer.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = xmlserializer.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
@@ -3945,6 +3949,8 @@
F58785E902DE378A01EA4122 /* WebCore SPI */ = {
isa = PBXGroup;
children = (
+ 6552E7A8096AA11B0006F248 /* WebCoreFrameNamespaces.h */,
+ 6552E7A9096AA11B0006F248 /* WebCoreFrameNamespaces.m */,
F587854702DE375901EA4122 /* WebCoreBridge.h */,
F587854802DE375901EA4122 /* WebCoreBridge.mm */,
F5B2A4FC02E2220F018635CB /* WebCoreCache.h */,
@@ -4719,6 +4725,7 @@
A88AD5180952499F001DD196 /* RGBColorImpl.h in Headers */,
A88AD5190952499F001DD196 /* KDOMHeaders.h in Headers */,
A88AD51A0952499F001DD196 /* KDOMSettings.h in Headers */,
+ 6552E7AA096AA11B0006F248 /* WebCoreFrameNamespaces.h in Headers */,
4756536509652C5D00BD9F29 /* KWQPointF.h in Headers */,
4756536709652C5D00BD9F29 /* KWQRectF.h in Headers */,
4756536909652C5D00BD9F29 /* KWQSizeF.h in Headers */,
@@ -6561,6 +6568,7 @@
A88AD51D0952499F001DD196 /* XLinkNamesWrapper.cpp in Sources */,
A88AD51E0952499F001DD196 /* SVGNamesWrapper.cpp in Sources */,
A88AD5AA09525131001DD196 /* SVGCSSStyleSelector.cpp in Sources */,
+ 6552E7AB096AA11B0006F248 /* WebCoreFrameNamespaces.m in Sources */,
4756536609652C5D00BD9F29 /* KWQPointF.mm in Sources */,
4756536809652C5D00BD9F29 /* KWQRectF.mm in Sources */,
4756536A09652C5D00BD9F29 /* KWQSizeF.mm in Sources */,
1.714 +2 -6 WebCore/kwq/KWQKHTMLPart.mm
Index: KWQKHTMLPart.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQKHTMLPart.mm,v
retrieving revision 1.713
retrieving revision 1.714
diff -u -r1.713 -r1.714
--- KWQKHTMLPart.mm 3 Jan 2006 22:42:48 -0000 1.713
+++ KWQKHTMLPart.mm 5 Jan 2006 06:41:23 -0000 1.714
@@ -3825,15 +3825,11 @@
KWQKHTMLPart *parent = KWQ(parentPart());
- if (parent && (name.isEmpty() || parent->frameExists(name))) {
+ // FIXME: is the blank rule needed or useful?
+ if (parent && (name.isEmpty() || parent->frameExists(name)) || name == "_blank")
n = parent->requestFrameName();
- }
KHTMLPart::setName(n);
-
- KWQ_BLOCK_EXCEPTIONS;
- [_bridge didSetName:n.getNSString()];
- KWQ_UNBLOCK_EXCEPTIONS;
}
void KWQKHTMLPart::didTellBridgeAboutLoad(const QString &urlString)
1.359 +12 -5 WebCore/kwq/WebCoreBridge.h
Index: WebCoreBridge.h
===================================================================
RCS file: /cvs/root/WebCore/kwq/WebCoreBridge.h,v
retrieving revision 1.358
retrieving revision 1.359
diff -u -r1.358 -r1.359
--- WebCoreBridge.h 4 Jan 2006 01:02:44 -0000 1.358
+++ WebCoreBridge.h 5 Jan 2006 06:41:24 -0000 1.359
@@ -196,6 +196,8 @@
WebCoreBridge *_firstChild;
WebCoreBridge *_lastChild;
int _childCount;
+
+ NSString *_frameNamespace;
}
+ (WebCoreBridge *)bridgeForDOMDocument:(DOMDocument *)document;
@@ -209,6 +211,8 @@
- (void)setName:(NSString *)name;
- (NSString *)name;
+/* Creates a name for an frame unnamed in the HTML. It should produce repeatable results for loads of the same frameset. */
+- (NSString *)generateFrameName;
- (KWQKHTMLPart *)part;
@@ -227,6 +231,14 @@
- (BOOL)isDescendantOfFrame:(WebCoreBridge *)ancestor;
- (WebCoreBridge *)traverseNextFrameStayWithin:(WebCoreBridge *)stayWithin;
+- (WebCoreBridge *)nextFrameWithWrap:(BOOL)wrap;
+- (WebCoreBridge *)previousFrameWithWrap:(BOOL)wrap;
+
+- (WebCoreBridge *)childFrameNamed:(NSString *)name;
+- (WebCoreBridge *)findFrameNamed:(NSString *)name;
+- (void)setFrameNamespace:(NSString *)ns;
+- (NSString *)frameNamespace;
+
- (void)provisionalLoadStarted;
- (void)openURL:(NSURL *)URL reload:(BOOL)reload
@@ -487,9 +499,6 @@
@protocol WebCoreBridge
- (WebCoreBridge *)mainFrame;
-- (WebCoreBridge *)findFrameNamed:(NSString *)name;
-/* Creates a name for an frame unnamed in the HTML. It should produce repeatable results for loads of the same frameset. */
-- (NSString *)generateFrameName;
- (void)frameDetached;
- (NSView *)documentView;
- (WebView *)webView;
@@ -626,8 +635,6 @@
- (WebCoreKeyboardUIMode)keyboardUIMode;
-- (void)didSetName:(NSString *)name;
-
- (NSFileWrapper *)fileWrapperForURL:(NSURL *)URL;
- (void)print;
1.449 +216 -10 WebCore/kwq/WebCoreBridge.mm
Index: WebCoreBridge.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/WebCoreBridge.mm,v
retrieving revision 1.448
retrieving revision 1.449
diff -u -r1.448 -r1.449
--- WebCoreBridge.mm 4 Jan 2006 01:02:44 -0000 1.448
+++ WebCoreBridge.mm 5 Jan 2006 06:41:24 -0000 1.449
@@ -84,6 +84,7 @@
#import "WebCoreTextRendererFactory.h"
#import "WebCoreViewFactory.h"
#import "WebCoreSettings.h"
+#import "WebCoreFrameNamespaces.h"
@class NSView;
@@ -146,13 +147,13 @@
NSString *WebCoreElementDOMNodeKey = @"WebElementDOMNode";
NSString *WebCoreElementFrameKey = @"WebElementFrame";
-NSString *WebCoreElementImageAltStringKey = @"WebElementImageAltString";
+NSString *WebCoreElementImageAltStringKey = @"WebElementImageAltString";
NSString *WebCoreElementImageRendererKey = @"WebCoreElementImageRenderer";
NSString *WebCoreElementImageRectKey = @"WebElementImageRect";
NSString *WebCoreElementImageURLKey = @"WebElementImageURL";
NSString *WebCoreElementIsSelectedKey = @"WebElementIsSelected";
NSString *WebCoreElementLinkURLKey = @"WebElementLinkURL";
-NSString *WebCoreElementLinkTargetFrameKey = @"WebElementTargetFrame";
+NSString *WebCoreElementLinkTargetFrameKey = @"WebElementTargetFrame";
NSString *WebCoreElementLinkLabelKey = @"WebElementLinkLabel";
NSString *WebCoreElementLinkTitleKey = @"WebElementLinkTitle";
NSString *WebCoreElementNameKey = @"WebElementName";
@@ -219,6 +220,11 @@
NSNotFound;
}
+static BOOL isCaseSensitiveEqual(NSString *a, NSString *b)
+{
+ return [a caseInsensitiveCompare:b] == NSOrderedSame;
+}
+
@implementation WebCoreBridge
static bool initializedObjectCacheSize = FALSE;
@@ -300,9 +306,8 @@
if (last) {
last->_nextSibling = child;
child->_previousSibling = last;
- } else {
+ } else
_firstChild = child;
- }
_lastChild = child;
@@ -331,6 +336,175 @@
[child release];
}
+- (WebCoreBridge *)childFrameNamed:(NSString *)name
+{
+ // FIXME: with a better data structure this could be O(1) instead of O(n) in number
+ // of child frames
+ for (WebCoreBridge *child = [self firstChild]; child; child = [child nextSibling])
+ if ([[child name] isEqualToString:name])
+ return child;
+
+ return nil;
+}
+
+// Returns the last child of us and any children, or self
+- (WebCoreBridge *)_deepLastChildFrame
+{
+ WebCoreBridge *result = self;
+ for (WebCoreBridge *lastChild = [self lastChild]; lastChild; lastChild = [lastChild lastChild])
+ result = lastChild;
+
+ return result;
+}
+
+// Return next frame to be traversed, visiting children after parent
+- (WebCoreBridge *)nextFrameWithWrap:(BOOL)wrapFlag
+{
+ WebCoreBridge *result = [self traverseNextFrameStayWithin:nil];
+
+ if (!result && wrapFlag)
+ return [self mainFrame];
+
+ return result;
+}
+
+// Return previous frame to be traversed, exact reverse order of _nextFrame
+- (WebCoreBridge *)previousFrameWithWrap:(BOOL)wrapFlag
+{
+ // FIXME: besides the wrap feature, this is just the traversePreviousNode algorithm
+
+ WebCoreBridge *prevSibling = [self previousSibling];
+ if (prevSibling)
+ return [prevSibling _deepLastChildFrame];
+ if ([self parent])
+ return [self parent];
+
+ // no siblings, no parent, self==top
+ if (wrapFlag)
+ return [self _deepLastChildFrame];
+
+ // top view is always the last one in this ordering, so prev is nil without wrap
+ return nil;
+}
+
+- (void)setFrameNamespace:(NSString *)ns
+{
+ ASSERT(self == [self mainFrame]);
+
+ if (ns != _frameNamespace){
+ [WebCoreFrameNamespaces removeFrame:self fromNamespace:_frameNamespace];
+ ns = [ns copy];
+ [_frameNamespace release];
+ _frameNamespace = ns;
+ [WebCoreFrameNamespaces addFrame:self toNamespace:_frameNamespace];
+ }
+}
+
+- (NSString *)frameNamespace
+{
+ ASSERT(self == [self mainFrame]);
+ return _frameNamespace;
+}
+
+- (BOOL)_shouldAllowAccessFrom:(WebCoreBridge *)source
+{
+ // if no source frame, allow access
+ if (source == nil)
+ return YES;
+
+ // - allow access if the two frames are in the same window
+ if ([self mainFrame] == [source mainFrame])
+ return YES;
+
+ // - allow if the request is made from a local file.
+ NSString *sourceDomain = [self domain];
+ if ([sourceDomain length] == 0)
+ return YES;
+
+ // - allow access if this frame or one of its ancestors
+ // has the same origin as source
+ for (WebCoreBridge *ancestor = self; ancestor; ancestor = [ancestor parent]) {
+ NSString *ancestorDomain = [ancestor domain];
+ if (ancestorDomain != nil &&
+ isCaseSensitiveEqual(sourceDomain, ancestorDomain))
+ return YES;
+
+ ancestor = [ancestor parent];
+ }
+
+ // - allow access if this frame is a toplevel window and the source
+ // can access its opener. Note that we only allow one level of
+ // recursion here.
+ if ([self parent] == nil) {
+ NSString *openerDomain = [[self opener] domain];
+ if (openerDomain != nil && isCaseSensitiveEqual(sourceDomain, openerDomain))
+ return YES;
+ }
+
+ // otherwise deny access
+ return NO;
+}
+
+- (WebCoreBridge *)_descendantFrameNamed:(NSString *)name sourceFrame:(WebCoreBridge *)source
+{
+ for (WebCoreBridge *frame = self; frame; frame = [frame traverseNextFrameStayWithin:self])
+ // for security reasons, we do not want to even make frames visible to frames that
+ // can't access them
+ if ([[frame name] isEqualToString:name] && [frame _shouldAllowAccessFrom:source])
+ return frame;
+
+ return nil;
+}
+
+- (WebCoreBridge *)_frameInAnyWindowNamed:(NSString *)name sourceFrame:(WebCoreBridge *)source
+{
+ ASSERT(self == [self mainFrame]);
+
+ // Try this WebView first.
+ WebCoreBridge *frame = [self _descendantFrameNamed:name sourceFrame:source];
+
+ if (frame != nil)
+ return frame;
+
+ // Try other WebViews in the same set
+
+ if ([self frameNamespace] != nil) {
+ NSEnumerator *enumerator = [WebCoreFrameNamespaces framesInNamespace:[self frameNamespace]];
+ WebCoreBridge *searchFrame;
+ while ((searchFrame = [enumerator nextObject]))
+ frame = [searchFrame _descendantFrameNamed:name sourceFrame:source];
+ }
+
+ return frame;
+}
+
+- (WebCoreBridge *)findFrameNamed:(NSString *)name
+{
+ // First, deal with 'special' names.
+ if ([name isEqualToString:@"_self"] || [name isEqualToString:@"_current"])
+ return self;
+
+ if ([name isEqualToString:@"_top"])
+ return [self mainFrame];
+
+ if ([name isEqualToString:@"_parent"]) {
+ WebCoreBridge *parent = [self parent];
+ return parent ? parent : self;
+ }
+
+ if ([name isEqualToString:@"_blank"])
+ return nil;
+
+ // Search from this frame down.
+ WebCoreBridge *frame = [self _descendantFrameNamed:name sourceFrame:self];
+
+ // Search in the main frame for this window then in others.
+ if (!frame)
+ frame = [[self mainFrame] _frameInAnyWindowNamed:name sourceFrame:self];
+
+ return frame;
+}
+
+ (NSArray *)supportedMIMETypes
{
return [NSArray arrayWithObjects:
@@ -459,7 +633,7 @@
if (pageCache) {
KWQPageState *state = [pageCache objectForKey:WebCorePageCacheStateKey];
_part->openURLFromPageCache(state);
- [state invalidate];
+ [state invalidate];
return;
}
@@ -794,7 +968,7 @@
if (doc) {
static QPaintDevice screen;
static QPrinter printer;
- doc->setPaintDevice(deviceType == WebCoreDeviceScreen ? &screen : &printer);
+ doc->setPaintDevice(deviceType == WebCoreDeviceScreen ? &screen : &printer);
}
return _part->reparseConfiguration();
}
@@ -875,7 +1049,7 @@
ERROR("printHeight has bad value %.2f", printHeight);
return pages;
}
-
+
if (!_part || !_part->xmlDocImpl() || !_part->view()) return pages;
RenderCanvas* root = static_cast<khtml::RenderCanvas *>(_part->xmlDocImpl()->renderer());
if (!root) return pages;
@@ -884,7 +1058,7 @@
NSView* documentView = view->getDocumentView();
if (!documentView)
return pages;
-
+
float currPageHeight = printHeight;
float docHeight = root->layer()->height();
float docWidth = root->layer()->width();
@@ -1115,7 +1289,7 @@
if (formElement) {
QPtrVector<HTMLGenericFormElementImpl> &elements = formElement->formElements;
for (unsigned int i = 0; i < elements.count(); i++) {
- if (elements.at(i)->isEnumeratable()) { // Skip option elements, other duds
+ if (elements.at(i)->isEnumeratable()) { // Skip option elements, other duds
DOMElement *de = [DOMElement _elementWithImpl:elements.at(i)];
if (!results) {
results = [NSMutableArray arrayWithObject:de];
@@ -1450,7 +1624,7 @@
- (void)setName:(NSString *)name
{
- _part->KHTMLPart::setName(QString::fromNSString(name));
+ _part->setName(QString::fromNSString(name));
}
- (NSString *)name
@@ -1458,6 +1632,38 @@
return _part->name().getNSString();
}
+- (void)_addFramePathToString:(NSMutableString *)path
+{
+ NSString *name = [self name];
+ if ([name hasPrefix:@"<!--framePath "]) {
+ // we have a generated name - take the path from our name
+ NSRange ourPathRange = {14, [name length] - 14 - 3};
+ [path appendString:[name substringWithRange:ourPathRange]];
+ } else {
+ // we don't have a generated name - just add our simple name to the end
+ [[self parent] _addFramePathToString:path];
+ [path appendString:@"/"];
+ if (name)
+ [path appendString:name];
+ }
+}
+
+// Generate a repeatable name for a child about to be added to us. The name must be
+// unique within the frame tree. The string we generate includes a "path" of names
+// from the root frame down to us. For this path to be unique, each set of siblings must
+// contribute a unique name to the path, which can't collide with any HTML-assigned names.
+// We generate this path component by index in the child list along with an unlikely frame name.
+- (NSString *)generateFrameName
+{
+ NSMutableString *path = [NSMutableString stringWithCapacity:256];
+ [path insertString:@"<!--framePath " atIndex:0];
+ [self _addFramePathToString:path];
+ // The new child's path component is all but the 1st char and the last 3 chars
+ // FIXME: Shouldn't this number be the index of this frame in its parent rather than the child count?
+ [path appendFormat:@"/<!--frame%d-->-->", [self childCount]];
+ return path;
+}
+
- (NSURL *)URL
{
return _part->url().getNSURL();
1.1 WebCore/kwq/WebCoreFrameNamespaces.h
Index: WebCoreFrameNamespaces.h
===================================================================
/*
* Copyright (C) 2005 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 <Foundation/Foundation.h>
@class WebCoreBridge;
@interface WebCoreFrameNamespaces : NSObject
+ (void)addFrame:(WebCoreBridge *)frame toNamespace:(NSString *)name;
+ (void)removeFrame:(WebCoreBridge *)frame fromNamespace:(NSString *)name;
+ (NSEnumerator *)framesInNamespace:(NSString *)name;
@end
1.1 WebCore/kwq/WebCoreFrameNamespaces.m
Index: WebCoreFrameNamespaces.m
===================================================================
/*
* Copyright (C) 2005 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 "WebCoreFrameNamespaces.h"
static CFSetCallBacks NonRetainingSetCallbacks = {
0,
NULL,
NULL,
CFCopyDescription,
CFEqual,
CFHash
};
@implementation WebCoreFrameNamespaces
NSMutableDictionary *namespaces = nil;
+(void)addFrame:(WebCoreBridge *)frame toNamespace:(NSString *)name
{
if (!name)
return;
if (!namespaces)
namespaces = [[NSMutableDictionary alloc] init];
CFMutableSetRef namespace = (CFMutableSetRef)[namespaces objectForKey:name];
if (!namespace) {
namespace = CFSetCreateMutable(NULL, 0, &NonRetainingSetCallbacks);
[namespaces setObject:(id)namespace forKey:name];
CFRelease(namespace);
}
CFSetSetValue(namespace, frame);
}
+(void)removeFrame:(WebCoreBridge *)frame fromNamespace:(NSString *)name
{
if (!name)
return;
CFMutableSetRef namespace = (CFMutableSetRef)[namespaces objectForKey:name];
if (!namespace)
return;
CFSetRemoveValue(namespace, frame);
if (CFSetGetCount(namespace) == 0)
[namespaces removeObjectForKey:name];
}
+(NSEnumerator *)framesInNamespace:(NSString *)name;
{
if (!name)
return [[[NSEnumerator alloc] init] autorelease];
CFMutableSetRef namespace = (CFMutableSetRef)[namespaces objectForKey:name];
if (!namespace)
return [[[NSEnumerator alloc] init] autorelease];
return [(NSSet *)namespace objectEnumerator];
}
@end
1.3442 +48 -0 WebKit/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebKit/ChangeLog,v
retrieving revision 1.3441
retrieving revision 1.3442
diff -u -r1.3441 -r1.3442
--- ChangeLog 4 Jan 2006 02:01:35 -0000 1.3441
+++ ChangeLog 5 Jan 2006 06:41:26 -0000 1.3442
@@ -1,3 +1,51 @@
+2006-01-03 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Darin.
+
+ - move frame management and finding code from WebKit to WebCore
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=6368
+
+ * Plugins.subproj/WebBaseNetscapePluginView.m:
+ (-[WebBaseNetscapePluginView loadPluginRequest:]): Set frame name straight on the bridge,
+ instead of having it bubble through the view and frame.
+ * WebCoreSupport.subproj/WebBridge.m:
+ (-[WebBridge initWithFrameName:view:]): don't pass name to frame, we own it now; set it
+ on ourselves directly
+ (-[WebBridge findFrameNamed:]): removed
+ (-[WebBridge createWindowWithURL:frameName:]): set name on bridge, not webview
+ (-[WebBridge createChildFrameNamed:withURL:referrer:renderPart:allowsScrolling:marginWidth:marginHeight:]):
+ (-[WebBridge runModal]): remove excess braces
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebView.subproj/WebControllerSets.h: Removed.
+ * WebView.subproj/WebControllerSets.m: Removed.
+ * WebView.subproj/WebFrame.m:
+ (-[WebFramePrivate name]): removed
+ (-[WebFramePrivate setName:]): removed
+ (-[WebFramePrivate dealloc]): don't release name, we no longer have one
+ (-[WebFrame _appendChild:]): removed
+ (-[WebFrame _removeChild:]): removed
+ (-[WebFrame _createItem:]): removed stray space
+ (-[WebFrame _immediateChildFrameNamed:]): Just call the bridge
+ (-[WebFrame _setName:]): removed
+ (-[WebFrame _detachFromParent]): remove bridge from parent note self
+ (-[WebFrame _continueLoadRequestAfterNewWindowPolicy:frameName:formState:]):
+ (-[WebFrame _addChild:]): Call appendChild: on bridge, not self
+ (-[WebFrame _nextFrameWithWrap:]): just call bridge (and moved helpers there)
+ (-[WebFrame _previousFrameWithWrap:]): just call bridge (and moved helpers there)
+ (-[WebFrame _initWithWebFrameView:webView:bridge:]): don't take a name any more
+ (-[WebFrame _setFrameNamespace:]): just call bridge
+ (-[WebFrame _frameNamespace]): just call bridge
+ (-[WebFrame _hasSelection]): remove excess braces
+ (-[WebFrame _clearSelection]): ditto
+ (-[WebFrame initWithName:webFrameView:webView:]): no more name
+ (-[WebFrame name]): just call bridge
+ (-[WebFrame findFrameNamed:]): just call bridge (and moved helpers there)
+ (-[WebFrame parentFrame]): fixed for new style
+ * WebView.subproj/WebFrameInternal.h:
+ * WebView.subproj/WebFramePrivate.h:
+ * WebView.subproj/WebView.m:
+ * WebView.subproj/WebViewPrivate.h:
+
2006-01-03 Darin Adler <darin at apple.com>
Reviewed by Beth.
1.140 +1 -1 WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
Index: WebBaseNetscapePluginView.m
===================================================================
RCS file: /cvs/root/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -r1.139 -r1.140
--- WebBaseNetscapePluginView.m 13 Sep 2005 20:51:36 -0000 1.139
+++ WebBaseNetscapePluginView.m 5 Jan 2006 06:41:33 -0000 1.140
@@ -1522,7 +1522,7 @@
newWebView = [[WebDefaultUIDelegate sharedUIDelegate] webView:currentWebView createWebViewWithRequest:nil];
}
- [newWebView _setTopLevelFrameName:frameName];
+ [[[newWebView mainFrame] _bridge] setName:frameName];
[[newWebView _UIDelegateForwarder] webViewShow:newWebView];
frame = [newWebView mainFrame];
}
1.385 +9 -24 WebKit/WebCoreSupport.subproj/WebBridge.m
Index: WebBridge.m
===================================================================
RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebBridge.m,v
retrieving revision 1.384
retrieving revision 1.385
diff -u -r1.384 -r1.385
--- WebBridge.m 4 Jan 2006 01:02:54 -0000 1.384
+++ WebBridge.m 5 Jan 2006 06:41:34 -0000 1.385
@@ -33,7 +33,6 @@
#import <WebKit/WebBaseNetscapePluginView.h>
#import <WebKit/WebBasePluginPackage.h>
#import <WebKit/WebLoader.h>
-#import "WebControllerSets.h"
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDefaultUIDelegate.h>
#import <WebKit/WebEditingDelegate.h>
@@ -76,6 +75,8 @@
#import <WebKit/WebUIDelegatePrivate.h>
#import <WebKitSystemInterface.h>
+#import <WebCore/WebCoreFrameNamespaces.h>
+
#import <Foundation/NSURLRequest.h>
#import <Foundation/NSURLConnection.h>
#import <Foundation/NSURLResponse.h>
@@ -123,9 +124,9 @@
WebView *webView = [view _webView];
- _frame = [[WebFrame alloc] _initWithName:name webFrameView:view webView:webView bridge:self];
+ _frame = [[WebFrame alloc] _initWithWebFrameView:view webView:webView bridge:self];
- [self setName:[_frame name]];
+ [self setName:name];
[self initializeSettings:[webView _settings]];
[self setTextSizeMultiplier:[webView textSizeMultiplier]];
@@ -172,12 +173,6 @@
return [[[_frame webView] mainFrame] _bridge];
}
-- (WebCoreBridge *)findFrameNamed:(NSString *)name;
-{
- ASSERT(_frame != nil);
- return [[_frame findFrameNamed:name] _bridge];
-}
-
- (WebView *)webView
{
ASSERT(_frame != nil);
@@ -209,8 +204,9 @@
newWebView = [wd webView:currentWebView createWebViewWithRequest:request];
else
newWebView = [[WebDefaultUIDelegate sharedUIDelegate] webView:currentWebView createWebViewWithRequest:request];
- [newWebView _setTopLevelFrameName:name];
- return [[newWebView mainFrame] _bridge];
+ WebBridge *resultBridge = [[newWebView mainFrame] _bridge];
+ [resultBridge setName:name];
+ return resultBridge;
}
- (void)showWindow
@@ -754,11 +750,6 @@
}
}
-- (NSString *)generateFrameName
-{
- return [_frame _generateFrameName];
-}
-
- (WebCoreBridge *)createChildFrameNamed:(NSString *)frameName
withURL:(NSURL *)URL
referrer:(NSString *)referrer
@@ -773,9 +764,8 @@
ASSERT(_frame != nil);
WebFrame *newFrame = [[_frame webView] _createFrameNamed:frameName inParent:_frame allowsScrolling:allowsScrolling];
- if (newFrame == nil) {
+ if (newFrame == nil)
return nil;
- }
[[newFrame _bridge] setRenderPart:childRenderPart];
@@ -1358,11 +1348,6 @@
return _keyboardUIMode;
}
-- (void)didSetName:(NSString *)name
-{
- [_frame _setName:name];
-}
-
- (NSFileWrapper *)fileWrapperForURL:(NSURL *)URL
{
return [[_frame dataSource] _fileWrapperForURL:URL];
@@ -1698,7 +1683,7 @@
NSMutableArray *deferredWebViews = [NSMutableArray array];
NSString *namespace = [webView groupName];
if (namespace) {
- NSEnumerator *enumerator = [WebFrameNamespaces framesInNamespace:namespace];
+ NSEnumerator *enumerator = [WebCoreFrameNamespaces framesInNamespace:namespace];
WebView *otherWebView;
while ((otherWebView = [[enumerator nextObject] webView]) != nil) {
if (otherWebView != webView && ![otherWebView defersCallbacks]) {
1.19 +0 -8 WebKit/WebKit.xcodeproj/project.pbxproj
Index: project.pbxproj
===================================================================
RCS file: /cvs/root/WebKit/WebKit.xcodeproj/project.pbxproj,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- project.pbxproj 30 Dec 2005 00:37:52 -0000 1.18
+++ project.pbxproj 5 Jan 2006 06:41:34 -0000 1.19
@@ -80,7 +80,6 @@
939810470824BF01008DF038 /* WebKitPrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C283730284676D018635CA /* WebKitPrefix.h */; };
939810480824BF01008DF038 /* WebLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F6866C0366057300CA2D3A /* WebLoader.h */; };
939810490824BF01008DF038 /* WebClipView.h in Headers */ = {isa = PBXBuildFile; fileRef = 933D659903413FF2008635CE /* WebClipView.h */; };
- 9398104A0824BF01008DF038 /* WebControllerSets.h in Headers */ = {isa = PBXBuildFile; fileRef = 6523FACF032DA06B005EFCFF /* WebControllerSets.h */; settings = {ATTRIBUTES = (); }; };
9398104B0824BF01008DF038 /* WebDataSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 39446070020F50ED0ECA1767 /* WebDataSource.h */; settings = {ATTRIBUTES = (Public, ); }; };
9398104C0824BF01008DF038 /* WebDataSourcePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 39446072020F50ED0ECA1767 /* WebDataSourcePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
9398104D0824BF01008DF038 /* WebDebugDOMNode.h in Headers */ = {isa = PBXBuildFile; fileRef = F57FB8C4034E180101A80180 /* WebDebugDOMNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -218,7 +217,6 @@
939810E80824BF01008DF038 /* WebViewFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = F5F7174D02885C5B018635CA /* WebViewFactory.m */; };
939810EA0824BF01008DF038 /* WebLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 51F6866D0366057300CA2D3A /* WebLoader.m */; };
939810EB0824BF01008DF038 /* WebClipView.m in Sources */ = {isa = PBXBuildFile; fileRef = 933D659A03413FF2008635CE /* WebClipView.m */; };
- 939810EC0824BF01008DF038 /* WebControllerSets.m in Sources */ = {isa = PBXBuildFile; fileRef = 6523FAD0032DA06B005EFCFF /* WebControllerSets.m */; };
939810ED0824BF01008DF038 /* WebDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 39446071020F50ED0ECA1767 /* WebDataSource.m */; };
939810EE0824BF01008DF038 /* WebDebugDOMNode.m in Sources */ = {isa = PBXBuildFile; fileRef = F57FB8C5034E180101A80180 /* WebDebugDOMNode.m */; };
939810EF0824BF01008DF038 /* WebDefaultContextMenuDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5152FADE033FC50400CA2ACD /* WebDefaultContextMenuDelegate.m */; };
@@ -396,8 +394,6 @@
51E94C6906C0347500A9B09E /* WebPDFRepresentation.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebPDFRepresentation.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
51F6866C0366057300CA2D3A /* WebLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = WebLoader.h; path = WebView.subproj/WebLoader.h; sourceTree = SOURCE_ROOT; };
51F6866D0366057300CA2D3A /* WebLoader.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = WebLoader.m; path = WebView.subproj/WebLoader.m; sourceTree = SOURCE_ROOT; };
- 6523FACF032DA06B005EFCFF /* WebControllerSets.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebControllerSets.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- 6523FAD0032DA06B005EFCFF /* WebControllerSets.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebControllerSets.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
65488D9F084FBCCB00831AD0 /* WebNSDictionaryExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSDictionaryExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
65488DA0084FBCCB00831AD0 /* WebNSDictionaryExtras.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebNSDictionaryExtras.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
6578F5DE045F817400000128 /* WebDownload.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDownload.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
@@ -847,8 +843,6 @@
51F6866D0366057300CA2D3A /* WebLoader.m */,
933D659903413FF2008635CE /* WebClipView.h */,
933D659A03413FF2008635CE /* WebClipView.m */,
- 6523FACF032DA06B005EFCFF /* WebControllerSets.h */,
- 6523FAD0032DA06B005EFCFF /* WebControllerSets.m */,
70ECD6CC043B727400A80181 /* WebDataProtocol.h */,
70ECD6CD043B727400A80181 /* WebDataProtocol.m */,
39446070020F50ED0ECA1767 /* WebDataSource.h */,
@@ -1158,7 +1152,6 @@
939810470824BF01008DF038 /* WebKitPrefix.h in Headers */,
939810480824BF01008DF038 /* WebLoader.h in Headers */,
939810490824BF01008DF038 /* WebClipView.h in Headers */,
- 9398104A0824BF01008DF038 /* WebControllerSets.h in Headers */,
9398104B0824BF01008DF038 /* WebDataSource.h in Headers */,
9398104C0824BF01008DF038 /* WebDataSourcePrivate.h in Headers */,
9398104D0824BF01008DF038 /* WebDebugDOMNode.h in Headers */,
@@ -1715,7 +1708,6 @@
939810E80824BF01008DF038 /* WebViewFactory.m in Sources */,
939810EA0824BF01008DF038 /* WebLoader.m in Sources */,
939810EB0824BF01008DF038 /* WebClipView.m in Sources */,
- 939810EC0824BF01008DF038 /* WebControllerSets.m in Sources */,
939810ED0824BF01008DF038 /* WebDataSource.m in Sources */,
939810EE0824BF01008DF038 /* WebDebugDOMNode.m in Sources */,
939810EF0824BF01008DF038 /* WebDefaultContextMenuDelegate.m in Sources */,
1.271 +19 -229 WebKit/WebView.subproj/WebFrame.m
Index: WebFrame.m
===================================================================
RCS file: /cvs/root/WebKit/WebView.subproj/WebFrame.m,v
retrieving revision 1.270
retrieving revision 1.271
diff -u -r1.270 -r1.271
--- WebFrame.m 4 Jan 2006 01:02:55 -0000 1.270
+++ WebFrame.m 5 Jan 2006 06:41:35 -0000 1.271
@@ -64,7 +64,6 @@
#import <WebKit/WebViewInternal.h>
#import <WebKit/WebUIDelegate.h>
#import <WebKit/WebScriptDebugDelegatePrivate.h>
-#import <WebKit/WebControllerSets.h>
#import <objc/objc-runtime.h>
@@ -165,14 +164,11 @@
- (WebFrame *)_previousSiblingFrame;
- (WebFrame *)_nextSiblingFrame;
- (WebFrame *)_traverseNextFrameStayWithin:(WebFrame *)stayWithin;
-- (void)_appendChild:(WebFrame *)child;
-- (void)_removeChild:(WebFrame *)child;
@end
@interface WebFramePrivate : NSObject
{
@public
- NSString *name;
WebFrameView *webFrameView;
WebDataSource *dataSource;
WebDataSource *provisionalDataSource;
@@ -207,8 +203,6 @@
NSString *frameNamespace;
}
-- (void)setName:(NSString *)name;
-- (NSString *)name;
- (void)setWebView:(WebView *)wv;
- (WebView *)webView;
- (void)setWebFrameView:(WebFrameView *)v;
@@ -246,7 +240,6 @@
- (void)dealloc
{
- [name release];
[webFrameView release];
[dataSource release];
[provisionalDataSource release];
@@ -268,14 +261,6 @@
[super dealloc];
}
-- (NSString *)name { return name; }
-- (void)setName:(NSString *)n
-{
- NSString *newName = [n copy];
- [name release];
- name = newName;
-}
-
- (WebFrameView *)webFrameView { return webFrameView; }
- (void)setWebFrameView: (WebFrameView *)v
{
@@ -375,16 +360,6 @@
return Frame([[self _bridge] traverseNextFrameStayWithin:[stayWithin _bridge]]);
}
-- (void)_appendChild:(WebFrame *)child
-{
- [[self _bridge] appendChild:[child _bridge]];
-}
-
-- (void)_removeChild:(WebFrame *)child
-{
- [[self _bridge] removeChild:[child _bridge]];
-}
-
@end
@implementation WebFrame (WebPrivate)
@@ -477,7 +452,7 @@
}
}
-- (WebHistoryItem *)_createItem: (BOOL)useOriginal
+- (WebHistoryItem *)_createItem:(BOOL)useOriginal
{
WebDataSource *dataSrc = [self dataSource];
NSURLRequest *request;
@@ -553,20 +528,7 @@
- (WebFrame *)_immediateChildFrameNamed:(NSString *)name
{
- // FIXME: with a better data structure this could be O(1) instead of O(n) in number
- // of child frames
- for (WebFrame *child = [self _firstChildFrame]; child; child = [child _nextSiblingFrame])
- if ([[child name] isEqualToString:name])
- return child;
-
- return nil;
-}
-
-- (void)_setName:(NSString *)name
-{
- // "_blank" is not a legal frame name
- if (![name isEqualToString:@"_blank"])
- [_private setName:name];
+ return Frame([[self _bridge] childFrameNamed:name]);
}
// FIXME: this exists only as a convenience for Safari, consider moving there
@@ -622,7 +584,7 @@
[self retain]; // retain self temporarily because dealloc can re-enter this method
[bridge close];
- [[self parentFrame] _removeChild:self];
+ [[[self parentFrame] _bridge] removeChild:bridge];
_private->bridge = nil;
@@ -1858,9 +1820,11 @@
else
webView = [[WebDefaultUIDelegate sharedUIDelegate] webView:currentWebView createWebViewWithRequest:nil];
- [webView _setTopLevelFrameName:frameName];
- [[webView _UIDelegateForwarder] webViewShow:webView];
+
WebFrame *frame = [webView mainFrame];
+ [[frame _bridge] setName:frameName];
+
+ [[webView _UIDelegateForwarder] webViewShow:webView];
[[self _bridge] setOpener:[frame _bridge]];
[frame _loadRequest:request triggeringAction:nil loadType:WebFrameLoadTypeStandard formState:formState];
@@ -2180,42 +2144,10 @@
- (void)_addChild:(WebFrame *)child
{
- [self _appendChild:child];
+ [[self _bridge] appendChild:[child _bridge]];
[[child dataSource] _setOverrideEncoding:[[self dataSource] _overrideEncoding]];
}
-- (void)_addFramePathToString:(NSMutableString *)path
-{
- if ([_private->name hasPrefix:@"<!--framePath "]) {
- // we have a generated name - take the path from our name
- NSRange ourPathRange = {14, [_private->name length] - 14 - 3};
- [path appendString:[_private->name substringWithRange:ourPathRange]];
- } else {
- // we don't have a generated name - just add our simple name to the end
- [[self parentFrame] _addFramePathToString:path];
- [path appendString:@"/"];
- if (_private->name) {
- [path appendString:_private->name];
- }
- }
-}
-
-// Generate a repeatable name for a child about to be added to us. The name must be
-// unique within the frame tree. The string we generate includes a "path" of names
-// from the root frame down to us. For this path to be unique, each set of siblings must
-// contribute a unique name to the path, which can't collide with any HTML-assigned names.
-// We generate this path component by index in the child list along with an unlikely frame name.
-- (NSString *)_generateFrameName
-{
- NSMutableString *path = [NSMutableString stringWithCapacity:256];
- [path insertString:@"<!--framePath " atIndex:0];
- [self _addFramePathToString:path];
- // The new child's path component is all but the 1st char and the last 3 chars
- // FIXME: Shouldn't this number be the index of this frame in its parent rather than the child count?
- [path appendFormat:@"/<!--frame%d-->-->", [self _childFrameCount]];
- return path;
-}
-
- (void)_resetBackForwardList
{
// Note this doesn't verify the current load type as a b/f operation because it is called from
@@ -2448,44 +2380,16 @@
[self _checkNewWindowPolicyForRequest:request action:(NSDictionary *)action frameName:frameName formState:nil andCall:self withSelector:@selector(_continueLoadRequestAfterNewWindowPolicy:frameName:formState:)];
}
-// Returns the last child of us and any children, or self
-- (WebFrame *)_deepLastChildFrame
-{
- WebFrame *result = self;
- for (WebFrame *lastChild = [self _lastChildFrame]; lastChild; lastChild = [lastChild _lastChildFrame])
- result = lastChild;
-
- return result;
-}
-
// Return next frame to be traversed, visiting children after parent
- (WebFrame *)_nextFrameWithWrap:(BOOL)wrapFlag
{
- WebFrame *result = [self _traverseNextFrameStayWithin:nil];
-
- if (!result && wrapFlag)
- return [[self webView] mainFrame];
-
- return result;
+ return Frame([[self _bridge] nextFrameWithWrap:wrapFlag]);
}
// Return previous frame to be traversed, exact reverse order of _nextFrame
- (WebFrame *)_previousFrameWithWrap:(BOOL)wrapFlag
{
- // FIXME: besides the wrap feature, this is just the traversePreviousNode algorithm
-
- WebFrame *prevSibling = [self _previousSiblingFrame];
- if (prevSibling)
- return [prevSibling _deepLastChildFrame];
- if ([self parentFrame])
- return [self parentFrame];
-
- // no siblings, no parent, self==top
- if (wrapFlag)
- return [self _deepLastChildFrame];
-
- // top view is always the last one in this ordering, so prev is nil without wrap
- return nil;
+ return Frame([[self _bridge] previousFrameWithWrap:wrapFlag]);
}
- (void)_setShouldCreateRenderers:(BOOL)f
@@ -2570,7 +2474,7 @@
@implementation WebFrame (WebInternal)
-- (id)_initWithName:(NSString *)n webFrameView:(WebFrameView *)fv webView:(WebView *)v bridge:(WebBridge *)bridge
+- (id)_initWithWebFrameView:(WebFrameView *)fv webView:(WebView *)v bridge:(WebBridge *)bridge
{
self = [super init];
if (!self)
@@ -2579,7 +2483,6 @@
_private = [[WebFramePrivate alloc] init];
[self _setWebView:v];
- [self _setName:n];
_private->bridge = bridge;
if (fv) {
@@ -2760,22 +2663,12 @@
- (void)_setFrameNamespace:(NSString *)namespace
{
- ASSERT(self == [[self webView] mainFrame]);
-
- if (namespace != _private->frameNamespace){
- [WebFrameNamespaces removeFrame:self fromNamespace:_private->frameNamespace];
- namespace = [namespace copy];
- [_private->frameNamespace release];
- _private->frameNamespace = namespace;
- [WebFrameNamespaces addFrame:self toNamespace:_private->frameNamespace];
- }
+ [[self _bridge] setFrameNamespace:namespace];
}
- (NSString *)_frameNamespace
{
- ASSERT(self == [[self webView] mainFrame]);
-
- return _private->frameNamespace;
+ return [[self _bridge] frameNamespace];
}
- (BOOL)_hasSelection
@@ -2788,9 +2681,8 @@
return selectedDOMRange && ![selectedDOMRange collapsed];
}
- if ([documentView conformsToProtocol:@protocol(WebDocumentText)]) {
+ if ([documentView conformsToProtocol:@protocol(WebDocumentText)])
return [[documentView selectedString] length] > 0;
- }
return NO;
}
@@ -2798,9 +2690,8 @@
- (void)_clearSelection
{
id documentView = [[self frameView] documentView];
- if ([documentView conformsToProtocol:@protocol(WebDocumentText)]) {
+ if ([documentView conformsToProtocol:@protocol(WebDocumentText)])
[documentView deselectAll];
- }
}
#ifndef NDEBUG
@@ -2920,7 +2811,7 @@
// FIXME: this method can't work any more and should be marked deprecated
- (id)initWithName:(NSString *)n webFrameView:(WebFrameView *)fv webView:(WebView *)v
{
- return [self _initWithName:n webFrameView:fv webView:v bridge:nil];
+ return [self _initWithWebFrameView:fv webView:v bridge:nil];
}
- (void)dealloc
@@ -2952,7 +2843,7 @@
- (NSString *)name
{
- return [_private name];
+ return [[self _bridge] name];
}
- (WebFrameView *)frameView
@@ -3065,7 +2956,6 @@
_private->isStoppingLoad = NO;
}
-
- (void)reload
{
WebDataSource *dataSource = [self dataSource];
@@ -3105,114 +2995,14 @@
[newDataSource release];
}
-
-- (BOOL)_shouldAllowAccessFrom:(WebFrame *)source
-{
- // if no source frame, allow access
- if (source == nil) {
- return YES;
- }
-
- // - allow access if the two frames are in the same window
- if ([self webView] == [source webView]) {
- return YES;
- }
-
- // - allow if the request is made from a local file.
- NSString *sourceDomain = [[source _bridge] domain];
- if ([sourceDomain length] == 0) {
- return YES;
- }
-
- // - allow access if this frame or one of its ancestors
- // has the same origin as source
- WebFrame *ancestor = self;
- while (ancestor != nil) {
- NSString *ancestorDomain = [[ancestor _bridge] domain];
- if (ancestorDomain != nil && [sourceDomain _webkit_isCaseInsensitiveEqualToString:ancestorDomain]) {
- return YES;
- }
- ancestor = [ancestor parentFrame];
- }
-
- // - allow access if this frame is a toplevel window and the source
- // can access its opener. Note that we only allow one level of
- // recursion here.
- if ([self parentFrame] == nil) {
- NSString *openerDomain = [[[self _bridge] opener] domain];
- if (openerDomain != nil && [sourceDomain _webkit_isCaseInsensitiveEqualToString:openerDomain]) {
- return YES;
- }
- }
-
- // otherwise deny access
- return NO;
-}
-
-- (WebFrame *)_descendantFrameNamed:(NSString *)name sourceFrame:(WebFrame *)source
-{
- for (WebFrame *frame = self; frame; frame = [frame _traverseNextFrameStayWithin:self])
- // for security reasons, we do not want to even make frames visible to frames that
- // can't access them
- if ([[frame name] isEqualToString:name] && [frame _shouldAllowAccessFrom:source])
- return frame;
-
- return nil;
-}
-
-- (WebFrame *)_frameInAnyWindowNamed:(NSString *)name sourceFrame:(WebFrame *)source
-{
- ASSERT(self == [[self webView] mainFrame]);
-
- // Try this WebView first.
- WebFrame *frame = [self _descendantFrameNamed:name sourceFrame:source];
-
- if (frame != nil) {
- return frame;
- }
-
- // Try other WebViews in the same set
- if ([self _frameNamespace] != nil) {
- NSEnumerator *enumerator = [WebFrameNamespaces framesInNamespace:[self _frameNamespace]];
- WebFrame *searchFrame;
- while ((searchFrame = [enumerator nextObject])) {
- frame = [searchFrame _descendantFrameNamed:name sourceFrame:source];
- }
- }
-
- return frame;
-}
-
- (WebFrame *)findFrameNamed:(NSString *)name
{
- // First, deal with 'special' names.
- if ([name isEqualToString:@"_self"] || [name isEqualToString:@"_current"])
- return self;
-
- if ([name isEqualToString:@"_top"])
- return [[self webView] mainFrame];
-
- if ([name isEqualToString:@"_parent"]) {
- WebFrame *parent = [self parentFrame];
- return parent ? parent : self;
- }
-
- if ([name isEqualToString:@"_blank"])
- return nil;
-
- // Search from this frame down.
- WebFrame *frame = [self _descendantFrameNamed:name sourceFrame:self];
-
- // Search in the main frame for this window then in others.
- if (!frame)
- frame = [[[self webView] mainFrame] _frameInAnyWindowNamed:name sourceFrame:self];
-
- return frame;
+ return Frame([[self _bridge] findFrameNamed:name]);
}
- (WebFrame *)parentFrame
{
- return [[[(WebBridge *)[[self _bridge] parent] webFrame] retain] autorelease];
+ return [[Frame([[self _bridge] parent]) retain] autorelease];
}
- (NSArray *)childFrames
1.20 +1 -1 WebKit/WebView.subproj/WebFrameInternal.h
Index: WebFrameInternal.h
===================================================================
RCS file: /cvs/root/WebKit/WebView.subproj/WebFrameInternal.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- WebFrameInternal.h 3 Jan 2006 05:15:21 -0000 1.19
+++ WebFrameInternal.h 5 Jan 2006 06:41:35 -0000 1.20
@@ -58,7 +58,7 @@
- (WebFrame *)_findFrameWithSelection;
- (void)_clearSelectionInOtherFrames;
- (BOOL)_subframeIsLoading;
-- (id)_initWithName:(NSString *)n webFrameView:(WebFrameView *)fv webView:(WebView *)v bridge:(WebBridge *)bridge;
+- (id)_initWithWebFrameView:(WebFrameView *)fv webView:(WebView *)v bridge:(WebBridge *)bridge;
@end
1.166 +0 -2 WebKit/WebView.subproj/WebFramePrivate.h
Index: WebFramePrivate.h
===================================================================
RCS file: /cvs/root/WebKit/WebView.subproj/WebFramePrivate.h,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -r1.165 -r1.166
--- WebFramePrivate.h 30 Dec 2005 05:11:46 -0000 1.165
+++ WebFramePrivate.h 5 Jan 2006 06:41:35 -0000 1.166
@@ -85,7 +85,6 @@
- (void)_loadRequest:(NSURLRequest *)request subresources:(NSArray *)subresources subframeArchives:(NSArray *)subframeArchives;
- (void)_setWebView:(WebView *)webView;
-- (void)_setName:(NSString *)name;
- (void)_detachFromParent;
- (void)_detachChildren;
- (void)_closeOldDataSources;
@@ -129,7 +128,6 @@
- (void)_addChild:(WebFrame *)child;
-- (NSString *)_generateFrameName;
- (NSDictionary *)_actionInformationForNavigationType:(WebNavigationType)navigationType event:(NSEvent *)event originalURL:(NSURL *)URL;
- (WebHistoryItem *)_itemForSavingDocState;
1.325 +0 -6 WebKit/WebView.subproj/WebView.m
Index: WebView.m
===================================================================
RCS file: /cvs/root/WebKit/WebView.subproj/WebView.m,v
retrieving revision 1.324
retrieving revision 1.325
diff -u -r1.324 -r1.325
--- WebView.m 3 Jan 2006 05:15:21 -0000 1.324
+++ WebView.m 5 Jan 2006 06:41:36 -0000 1.325
@@ -34,7 +34,6 @@
#import <WebKit/WebBackForwardList.h>
#import <WebKit/WebBaseNetscapePluginView.h>
#import <WebKit/WebBridge.h>
-#import <WebKit/WebControllerSets.h>
#import <WebKit/WebDashboardRegion.h>
#import <WebKit/WebDataProtocol.h>
#import <WebKit/WebDataSourcePrivate.h>
@@ -693,11 +692,6 @@
[[self mainFrame] _defersCallbacksChanged];
}
-- (void)_setTopLevelFrameName:(NSString *)name
-{
- [[self mainFrame] _setName:name];
-}
-
- (WebView *)_openNewWindowWithRequest:(NSURLRequest *)request
{
id wd = [self UIDelegate];
1.154 +0 -2 WebKit/WebView.subproj/WebViewPrivate.h
Index: WebViewPrivate.h
===================================================================
RCS file: /cvs/root/WebKit/WebView.subproj/WebViewPrivate.h,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -r1.153 -r1.154
--- WebViewPrivate.h 20 Dec 2005 20:41:55 -0000 1.153
+++ WebViewPrivate.h 5 Jan 2006 06:41:36 -0000 1.154
@@ -153,8 +153,6 @@
- (BOOL)defersCallbacks;
- (void)setDefersCallbacks:(BOOL)defers;
-- (void)_setTopLevelFrameName:(NSString *)name;
-
- (WebView *)_openNewWindowWithRequest:(NSURLRequest *)request;
- (NSMenu *)_menuForElement:(NSDictionary *)element defaultItems:(NSArray *)items;
More information about the webkit-changes
mailing list