Commit 22c193be authored by mjs's avatar mjs

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:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11882 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a5089b89
......@@ -174,6 +174,36 @@
(SVGSVGElementImpl::checkIntersection): QRect -> QRectF, removed integer conversions
(SVGSVGElementImpl::checkEnclosure): QRect -> QRectF, removed integer conversions
2006-01-03 Maciej Stachowiak <mjs@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@apple.com>
Reviewed by Vicki.
......
......@@ -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
......
......@@ -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 */,
......
......@@ -3825,15 +3825,11 @@ void KWQKHTMLPart::setName(const QString &name)
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)
......
......@@ -196,6 +196,8 @@ typedef enum
WebCoreBridge *_firstChild;
WebCoreBridge *_lastChild;
int _childCount;
NSString *_frameNamespace;
}
+ (WebCoreBridge *)bridgeForDOMDocument:(DOMDocument *)document;
......@@ -209,6 +211,8 @@ typedef enum
- (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 @@ typedef enum
- (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 @@ typedef enum
@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 @@ typedef enum
- (WebCoreKeyboardUIMode)keyboardUIMode;
- (void)didSetName:(NSString *)name;
- (NSFileWrapper *)fileWrapperForURL:(NSURL *)URL;
- (void)print;
......
......@@ -84,6 +84,7 @@
#import "WebCoreTextRendererFactory.h"
#import "WebCoreViewFactory.h"
#import "WebCoreSettings.h"
#import "WebCoreFrameNamespaces.h"
@class NSView;
......@@ -146,13 +147,13 @@ using KJS::Bindings::RootObject;
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 @@ static BOOL hasCaseInsensitivePrefix(NSString *string, NSString *prefix)
NSNotFound;
}
static BOOL isCaseSensitiveEqual(NSString *a, NSString *b)
{
return [a caseInsensitiveCompare:b] == NSOrderedSame;
}
@implementation WebCoreBridge
static bool initializedObjectCacheSize = FALSE;
......@@ -300,9 +306,8 @@ static bool initializedKJS = FALSE;
if (last) {
last->_nextSibling = child;
child->_previousSibling = last;
} else {
} else
_firstChild = child;
}
_lastChild = child;
......@@ -331,6 +336,175 @@ static bool initializedKJS = FALSE;
[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 @@ static bool initializedKJS = FALSE;
if (pageCache) {
KWQPageState *state = [pageCache objectForKey:WebCorePageCacheStateKey];
_part->openURLFromPageCache(state);
[state invalidate];
[state invalidate];
return;
}
......@@ -794,7 +968,7 @@ static bool initializedKJS = FALSE;
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 @@ static BOOL nowPrinting(WebCoreBridge *self)
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 @@ static BOOL nowPrinting(WebCoreBridge *self)
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 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
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 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
- (void)setName:(NSString *)name
{
_part->KHTMLPart::setName(QString::fromNSString(name));
_part->setName(QString::fromNSString(name));
}
- (NSString *)name
......@@ -1458,6 +1632,38 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
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();
......
......@@ -28,10 +28,10 @@
#import <Foundation/Foundation.h>
@class WebFrame;
@class WebCoreBridge;
@interface WebFrameNamespaces : NSObject
+ (void)addFrame:(WebFrame *)frame toNamespace:(NSString *)name;
+ (void)removeFrame:(WebFrame *)frame fromNamespace:(NSString *)name;
@interface WebCoreFrameNamespaces : NSObject
+ (void)addFrame:(WebCoreBridge *)frame toNamespace:(NSString *)name;
+ (void)removeFrame:(WebCoreBridge *)frame fromNamespace:(NSString *)name;
+ (NSEnumerator *)framesInNamespace:(NSString *)name;
@end
......@@ -26,7 +26,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <WebKit/WebControllerSets.h>
#import "WebCoreFrameNamespaces.h"
static CFSetCallBacks NonRetainingSetCallbacks = {
0,
......@@ -37,11 +37,11 @@
CFHash
};
@implementation WebFrameNamespaces
@implementation WebCoreFrameNamespaces
NSMutableDictionary *namespaces = nil;
+(void)addFrame:(WebFrame *)frame toNamespace:(NSString *)name
+(void)addFrame:(WebCoreBridge *)frame toNamespace:(NSString *)name
{
if (!name)
return;
......@@ -60,7 +60,7 @@ +(void)addFrame:(WebFrame *)frame toNamespace:(NSString *)name
CFSetSetValue(namespace, frame);
}
+(void)removeFrame:(WebFrame *)frame fromNamespace:(NSString *)name
+(void)removeFrame:(WebCoreBridge *)frame fromNamespace:(NSString *)name
{
if (!name)
return;
......
2006-01-03 Maciej Stachowiak <mjs@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@apple.com>
Reviewed by Beth.
......@@ -1522,7 +1522,7 @@ - (void)loadPluginRequest:(WebPluginRequest *)pluginRequest
newWebView = [[WebDefaultUIDelegate sharedUIDelegate] webView:currentWebView createWebViewWithRequest:nil];
}
[newWebView _setTopLevelFrameName:frameName];
[[[newWebView mainFrame] _bridge] setName:frameName];
[[newWebView _UIDelegateForwarder] webViewShow:newWebView];
frame = [newWebView mainFrame];
}
......
......@@ -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 @@ - (id)initWithFrameName:(NSString *)name view:(WebFrameView *)view
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 @@ - (WebCoreBridge *)mainFrame
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 @@ - (WebCoreBridge *)createWindowWithURL:(NSURL *)URL frameName:(NSString *)name
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 @@ - (void)postWithURL:(NSURL *)URL referrer:(NSString *)referrer target:(NSString
}
}
- (NSString *)generateFrameName
{
return [_frame _generateFrameName];