Commit 4b76feb4 authored by mjs's avatar mjs

WebCore:

        Reviewed by Vicki.

        - moved frame traversal code across from bridge, also dropped the children
	array

        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge firstChild]): Moved from WebBridge. Use new _firstChild
	pointer.
        (-[WebCoreBridge lastChild]): Moved from WebBridge. Use new _lastChild pointer.
        (-[WebCoreBridge childCount]): Moved from WebBridge. Use _childCount variable.
        (-[WebCoreBridge previousSibling]): Moved from WebBridge.
        (-[WebCoreBridge nextSibling]): ditt
        (-[WebCoreBridge isDescendantOfFrame:]): ditto
        (-[WebCoreBridge traverseNextFrameStayWithin:]): ditto
        (-[WebCoreBridge appendChild:]): Moved from WebBridge, maintain count and first/last
	pointers.
        (-[WebCoreBridge removeChild:]): Moved from WebBridge, maintain count and first/last
	pointers.

WebKit:

        Reviewed by Vicki.

        - moved frame traversal code across from bridge, also dropped the children
	array

        * WebCoreSupport.subproj/WebBridge.h:
        * WebCoreSupport.subproj/WebBridge.m:
        (-[WebBridge dealloc]): Don't release children array, that was moved
	down to WebCore.
        (-[WebBridge saveDocumentState:]):
	- many methods moved to WebCore.
        * WebView.subproj/WebFrame.m:
        (Frame): New convenience method to get a WebFrame * from a method that
	returns WebCoreBridge *.
        (-[WebFrame _firstChildFrame]): use Frame()
        (-[WebFrame _lastChildFrame]): ditto
        (-[WebFrame _previousSiblingFrame]): ditto
        (-[WebFrame _nextSiblingFrame]): ditto
        (-[WebFrame _traverseNextFrameStayWithin:]): ditto


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11868 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 89cd84ca
2006-01-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Vicki.
- moved frame traversal code across from bridge, also dropped the children
array
* kwq/WebCoreBridge.h:
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge firstChild]): Moved from WebBridge. Use new _firstChild
pointer.
(-[WebCoreBridge lastChild]): Moved from WebBridge. Use new _lastChild pointer.
(-[WebCoreBridge childCount]): Moved from WebBridge. Use _childCount variable.
(-[WebCoreBridge previousSibling]): Moved from WebBridge.
(-[WebCoreBridge nextSibling]): ditt
(-[WebCoreBridge isDescendantOfFrame:]): ditto
(-[WebCoreBridge traverseNextFrameStayWithin:]): ditto
(-[WebCoreBridge appendChild:]): Moved from WebBridge, maintain count and first/last
pointers.
(-[WebCoreBridge removeChild:]): Moved from WebBridge, maintain count and first/last
pointers.
2006-01-03 Justin Garcia <justin.garcia@apple.com>
Reviewed by harrison
......
......@@ -190,6 +190,12 @@ typedef enum
KHTMLRenderPart *_renderPart;
RenderArena *_renderPartArena;
BOOL _shouldCreateRenderers;
WebCoreBridge *_nextSibling;
WebCoreBridge *_previousSibling;
WebCoreBridge *_firstChild;
WebCoreBridge *_lastChild;
int _childCount;
}
+ (WebCoreBridge *)bridgeForDOMDocument:(DOMDocument *)document;
......@@ -209,6 +215,18 @@ typedef enum
- (void)setParent:(WebCoreBridge *)parent;
- (WebCoreBridge *)parent;
- (WebCoreBridge *)firstChild;
- (WebCoreBridge *)lastChild;
- (WebCoreBridge *)previousSibling;
- (WebCoreBridge *)nextSibling;
- (void)appendChild:(WebCoreBridge *)child;
- (void)removeChild:(WebCoreBridge *)child;
- (unsigned)childCount;
- (BOOL)isDescendantOfFrame:(WebCoreBridge *)ancestor;
- (WebCoreBridge *)traverseNextFrameStayWithin:(WebCoreBridge *)stayWithin;
- (void)provisionalLoadStarted;
- (void)openURL:(NSURL *)URL reload:(BOOL)reload
......
......@@ -224,6 +224,113 @@ static BOOL hasCaseInsensitivePrefix(NSString *string, NSString *prefix)
static bool initializedObjectCacheSize = FALSE;
static bool initializedKJS = FALSE;
- (WebCoreBridge *)firstChild
{
return _firstChild;
}
- (WebCoreBridge *)lastChild
{
return _lastChild;
}
- (unsigned)childCount
{
return _childCount;
}
- (WebCoreBridge *)previousSibling;
{
return _previousSibling;
}
- (WebCoreBridge *)nextSibling;
{
return _nextSibling;
}
- (BOOL)isDescendantOfFrame:(WebCoreBridge *)ancestor
{
for (WebCoreBridge *frame = self; frame; frame = (WebCoreBridge *)[frame parent])
if (frame == ancestor)
return YES;
return NO;
}
- (WebCoreBridge *)traverseNextFrameStayWithin:(WebCoreBridge *)stayWithin
{
WebCoreBridge *firstChild = [self firstChild];
if (firstChild) {
ASSERT(!stayWithin || [firstChild isDescendantOfFrame:stayWithin]);
return firstChild;
}
if (self == stayWithin)
return 0;
WebCoreBridge *nextSibling = [self nextSibling];
if (nextSibling) {
assert(!stayWithin || [nextSibling isDescendantOfFrame:stayWithin]);
return nextSibling;
}
WebCoreBridge *frame = self;
while (frame && !nextSibling && (!stayWithin || [frame parent] != stayWithin)) {
frame = (WebCoreBridge *)[frame parent];
nextSibling = [frame nextSibling];
}
if (frame) {
ASSERT(!stayWithin || !nextSibling || [nextSibling isDescendantOfFrame:stayWithin]);
return nextSibling;
}
return nil;
}
- (void)appendChild:(WebCoreBridge *)child
{
[child retain];
[child setParent:self];
WebCoreBridge *last = _lastChild;
if (last) {
last->_nextSibling = child;
child->_previousSibling = last;
} else {
_firstChild = child;
}
_lastChild = child;
_childCount++;
ASSERT(child->_nextSibling == nil);
}
- (void)removeChild:(WebCoreBridge *)child
{
if (child->_previousSibling)
child->_previousSibling->_nextSibling = child->_nextSibling;
else
_firstChild = child->_nextSibling;
if (child->_nextSibling)
child->_nextSibling->_previousSibling = child->_previousSibling;
else
_lastChild = child->_previousSibling;
child->_previousSibling = nil;
child->_nextSibling = nil;
_childCount--;
[child release];
}
+ (NSArray *)supportedMIMETypes
{
return [NSArray arrayWithObjects:
......
2006-01-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Vicki.
- moved frame traversal code across from bridge, also dropped the children
array
* WebCoreSupport.subproj/WebBridge.h:
* WebCoreSupport.subproj/WebBridge.m:
(-[WebBridge dealloc]): Don't release children array, that was moved
down to WebCore.
(-[WebBridge saveDocumentState:]):
- many methods moved to WebCore.
* WebView.subproj/WebFrame.m:
(Frame): New convenience method to get a WebFrame * from a method that
returns WebCoreBridge *.
(-[WebFrame _firstChildFrame]): use Frame()
(-[WebFrame _lastChildFrame]): ditto
(-[WebFrame _previousSiblingFrame]): ditto
(-[WebFrame _nextSiblingFrame]): ditto
(-[WebFrame _traverseNextFrameStayWithin:]): ditto
2006-01-03 Anders Carlsson <andersca@mac.com>
Reviewed by Darin.
......@@ -34,10 +34,6 @@
@interface WebBridge : WebCoreBridge <WebCoreBridge>
{
WebBridge *_nextSibling;
WebBridge *_previousSibling;
NSMutableArray *_children;
WebFrame *_frame;
WebCoreKeyboardUIMode _keyboardUIMode;
BOOL _keyboardUIModeAccessed;
......@@ -57,17 +53,4 @@
- (WebFrame *)webFrame;
- (WebBridge *)firstChild;
- (WebBridge *)lastChild;
- (WebBridge *)previousSibling;
- (WebBridge *)nextSibling;
- (void)appendChild:(WebBridge *)child;
- (void)removeChild:(WebBridge *)child;
- (unsigned)childCount;
- (BOOL)isDescendantOfFrame:(WebBridge *)ancestor;
- (WebBridge *)traverseNextFrameStayWithin:(WebBridge *)stayWithin;
@end
......@@ -150,7 +150,6 @@ - (void)dealloc
{
[lastDashboardRegions release];
[_frame release];
[_children release];
[self fini];
[super dealloc];
......@@ -788,7 +787,7 @@ - (WebCoreBridge *)createChildFrameNamed:(NSString *)frameName
return [newFrame _bridge];
}
- (void)saveDocumentState: (NSArray *)documentState
- (void)saveDocumentState:(NSArray *)documentState
{
WebHistoryItem *item = [_frame _itemForSavingDocState];
LOG(Loading, "%@: saving form state from to 0x%x", [_frame name], item);
......@@ -1726,103 +1725,4 @@ - (void)handledOnloadEvents
[_frame _handledOnloadEvents];
}
- (WebBridge *)firstChild
{
if (![_children count])
return nil;
return [_children objectAtIndex:0];
}
- (WebBridge *)lastChild
{
return [_children lastObject];
}
- (unsigned)childCount
{
return [_children count];
}
- (WebBridge *)previousSibling;
{
return _previousSibling;
}
- (WebBridge *)nextSibling;
{
return _nextSibling;
}
- (BOOL)isDescendantOfFrame:(WebBridge *)ancestor
{
for (WebBridge *frame = self; frame; frame = (WebBridge *)[frame parent])
if (frame == ancestor)
return YES;
return NO;
}
- (WebBridge *)traverseNextFrameStayWithin:(WebBridge *)stayWithin
{
WebBridge *firstChild = [self firstChild];
if (firstChild) {
ASSERT(!stayWithin || [firstChild isDescendantOfFrame:stayWithin]);
return firstChild;
}
if (self == stayWithin)
return 0;
WebBridge *nextSibling = [self nextSibling];
if (nextSibling) {
assert(!stayWithin || [nextSibling isDescendantOfFrame:stayWithin]);
return nextSibling;
}
WebBridge *frame = self;
while (frame && !nextSibling && (!stayWithin || [frame parent] != stayWithin)) {
frame = (WebBridge *)[frame parent];
nextSibling = [frame nextSibling];
}
if (frame) {
ASSERT(!stayWithin || !nextSibling || [nextSibling isDescendantOfFrame:stayWithin]);
return nextSibling;
}
return nil;
}
- (void)appendChild:(WebBridge *)child
{
[child setParent:self];
if (_children == nil)
_children = [[NSMutableArray alloc] init];
WebBridge *previous = [self lastChild];
if (previous) {
previous->_nextSibling = child;
child->_previousSibling = previous;
}
ASSERT(child->_nextSibling == nil);
[_children addObject:child];
}
- (void)removeChild:(WebBridge *)child
{
if (child->_previousSibling)
child->_previousSibling->_nextSibling = child->_nextSibling;
if (child->_nextSibling)
child->_nextSibling->_previousSibling = child->_previousSibling;
child->_previousSibling = nil;
child->_nextSibling = nil;
[_children removeObject:child];
}
@end
......@@ -339,15 +339,20 @@ - (void)setCurrentItem:(WebHistoryItem *)item
@end
static inline WebFrame *Frame(WebCoreBridge *bridge)
{
return [(WebBridge *)bridge webFrame];
}
@implementation WebFrame (FrameTraversal)
- (WebFrame *)_firstChildFrame
{
return [[[self _bridge] firstChild] webFrame];
return Frame([[self _bridge] firstChild]);
}
- (WebFrame *)_lastChildFrame
{
return [[[self _bridge] lastChild] webFrame];
return Frame([[self _bridge] lastChild]);
}
- (unsigned)_childFrameCount
......@@ -357,17 +362,17 @@ - (unsigned)_childFrameCount
- (WebFrame *)_previousSiblingFrame;
{
return [[[self _bridge] previousSibling] webFrame];
return Frame([[self _bridge] previousSibling]);
}
- (WebFrame *)_nextSiblingFrame;
{
return [[[self _bridge] nextSibling] webFrame];
return Frame([[self _bridge] nextSibling]);
}
- (WebFrame *)_traverseNextFrameStayWithin:(WebFrame *)stayWithin
{
return [[[self _bridge] traverseNextFrameStayWithin:[stayWithin _bridge]] webFrame];
return Frame([[self _bridge] traverseNextFrameStayWithin:[stayWithin _bridge]]);
}
- (void)_appendChild:(WebFrame *)child
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment