[webkit-changes] cvs commit: WebKit/WebView.subproj WebFrame.m WebFrameInternal.h WebView.m

Maciej mjs at opensource.apple.com
Mon Jan 2 21:15:23 PST 2006


mjs         06/01/02 21:15:22

  Modified:    .        ChangeLog
               WebCoreSupport.subproj WebBridge.h WebBridge.m
               WebView.subproj WebFrame.m WebFrameInternal.h WebView.m
  Log:
          Reviewed by Eric.
  
  	- moved frame traversal logic from WebFrame to WebBridge
  	http://bugzilla.opendarwin.org/show_bug.cgi?id=6341
  
  	To do this, I had to invert the ownership so that WebBridge now
  	owns WebFrame instead of vice versa. As a result, WebView now owns
  	a WebBridge pointer and does not have a direct WebFrame pointer.
  
          * WebCoreSupport.subproj/WebBridge.h:
          * WebCoreSupport.subproj/WebBridge.m:
          (-[WebBridge initWithFrameName:view:]): The initializer is now responsible for creating
  	the frame, so pass it what it needs to do that.
          (-[WebBridge dealloc]): The bridge now owns the frame, so release it.
          (-[WebBridge close]): ditto
          (-[WebBridge firstChild]): Moved from WebFrame
          (-[WebBridge lastChild]): ditto
          (-[WebBridge childCount]): ditto
          (-[WebBridge previousSibling]): ditto
          (-[WebBridge nextSibling]): ditto
          (-[WebBridge isDescendantOfFrame:]): ditto
          (-[WebBridge traverseNextFrameStayWithin:]): ditto
          (-[WebBridge appendChild:]): ditto
          (-[WebBridge removeChild:]): ditto
          * WebView.subproj/WebFrame.m:
          (-[WebFrame _removeChild::]): Call WebBridge version
          (-[WebFramePrivate dealloc]): ditto
          (-[WebFrame _firstChildFrame]): ditto
          (-[WebFrame _lastChildFrame]): ditto
          (-[WebFrame _childFrameCount]): ditto
          (-[WebFrame _previousSiblingFrame]): ditto
          (-[WebFrame _nextSiblingFrame]): ditto
          (-[WebFrame _traverseNextFrameStayWithin:]): ditto
          (-[WebFrame _appendChild:]): ditto
          (-[WebFrame _removeChild:]): ditto
          (-[WebFrame _isDescendantOfFrame:]): ditto,
          (-[WebFrame _detachFromParent]): reorder a bit to avoid losing our bridge
  	pointer before the bridge is due to release us, and don't release the
  	bridge any more since it now owns us
          (-[WebFrame _initWithName:webFrameView:webView:bridge:]): new initializer,
  	we no longer create the bridge, instead it is passed in
          (-[WebFrame initWithName:webFrameView:webView:]): Call the new designated
  	initializer, but this method is no longer viable and should be deprecated.
          * WebView.subproj/WebFrameInternal.h:
  
  	* WebView.subproj/WebView.m: WebView was changed to hold onto
  	the WebBridge for the main frame instead of the WebFrame.
  
          (-[WebViewPrivate dealloc]): update for the fact that we hold
  	a bridge now, not a frame.
          (-[WebView _close]): ditto
          (-[WebView _createFrameNamed:inParent:allowsScrolling:]): Create
  	a bridge, not a frame.
          (-[WebView _commonInitializationWithFrameName:groupName:]): ditto.
          (-[WebView setDefersCallbacks:]): get mainFrame via method
          (-[WebView mainFrame]): Update to get the main frame properly
  
  Revision  Changes    Path
  1.3438    +59 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3437
  retrieving revision 1.3438
  diff -u -r1.3437 -r1.3438
  --- ChangeLog	30 Dec 2005 22:17:06 -0000	1.3437
  +++ ChangeLog	3 Jan 2006 05:15:15 -0000	1.3438
  @@ -1,3 +1,62 @@
  +2006-01-02  Maciej Stachowiak  <mjs at apple.com>
  +
  +        Reviewed by Eric.
  +
  +	- moved frame traversal logic from WebFrame to WebBridge
  +	http://bugzilla.opendarwin.org/show_bug.cgi?id=6341
  +
  +	To do this, I had to invert the ownership so that WebBridge now
  +	owns WebFrame instead of vice versa. As a result, WebView now owns
  +	a WebBridge pointer and does not have a direct WebFrame pointer.
  +
  +        * WebCoreSupport.subproj/WebBridge.h:
  +        * WebCoreSupport.subproj/WebBridge.m:
  +        (-[WebBridge initWithFrameName:view:]): The initializer is now responsible for creating
  +	the frame, so pass it what it needs to do that.
  +        (-[WebBridge dealloc]): The bridge now owns the frame, so release it.
  +        (-[WebBridge close]): ditto
  +        (-[WebBridge firstChild]): Moved from WebFrame
  +        (-[WebBridge lastChild]): ditto
  +        (-[WebBridge childCount]): ditto
  +        (-[WebBridge previousSibling]): ditto
  +        (-[WebBridge nextSibling]): ditto
  +        (-[WebBridge isDescendantOfFrame:]): ditto
  +        (-[WebBridge traverseNextFrameStayWithin:]): ditto
  +        (-[WebBridge appendChild:]): ditto
  +        (-[WebBridge removeChild:]): ditto
  +        * WebView.subproj/WebFrame.m:
  +        (-[WebFrame _removeChild::]): Call WebBridge version
  +        (-[WebFramePrivate dealloc]): ditto
  +        (-[WebFrame _firstChildFrame]): ditto
  +        (-[WebFrame _lastChildFrame]): ditto
  +        (-[WebFrame _childFrameCount]): ditto
  +        (-[WebFrame _previousSiblingFrame]): ditto
  +        (-[WebFrame _nextSiblingFrame]): ditto
  +        (-[WebFrame _traverseNextFrameStayWithin:]): ditto
  +        (-[WebFrame _appendChild:]): ditto
  +        (-[WebFrame _removeChild:]): ditto
  +        (-[WebFrame _isDescendantOfFrame:]): ditto,
  +        (-[WebFrame _detachFromParent]): reorder a bit to avoid losing our bridge
  +	pointer before the bridge is due to release us, and don't release the
  +	bridge any more since it now owns us
  +        (-[WebFrame _initWithName:webFrameView:webView:bridge:]): new initializer,
  +	we no longer create the bridge, instead it is passed in
  +        (-[WebFrame initWithName:webFrameView:webView:]): Call the new designated
  +	initializer, but this method is no longer viable and should be deprecated.
  +        * WebView.subproj/WebFrameInternal.h:
  +        
  +	* WebView.subproj/WebView.m: WebView was changed to hold onto
  +	the WebBridge for the main frame instead of the WebFrame.
  +	
  +        (-[WebViewPrivate dealloc]): update for the fact that we hold
  +	a bridge now, not a frame.
  +        (-[WebView _close]): ditto
  +        (-[WebView _createFrameNamed:inParent:allowsScrolling:]): Create
  +	a bridge, not a frame.
  +        (-[WebView _commonInitializationWithFrameName:groupName:]): ditto.
  +        (-[WebView setDefersCallbacks:]): get mainFrame via method
  +        (-[WebView mainFrame]): Update to get the main frame properly
  +
   2005-12-30  Mitz Pettel  <opendarwin.org at mitzpettel.com>
   
           Reviewed by Darin, landed by ap.
  
  
  
  1.31      +18 -2     WebKit/WebCoreSupport.subproj/WebBridge.h
  
  Index: WebBridge.h
  ===================================================================
  RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebBridge.h,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- WebBridge.h	26 Dec 2005 21:46:26 -0000	1.30
  +++ WebBridge.h	3 Jan 2006 05:15:19 -0000	1.31
  @@ -34,7 +34,10 @@
   
   @interface WebBridge : WebCoreBridge <WebCoreBridge>
   {
  -    WebBridge *_parentBridge;
  +    WebBridge *_nextSibling;
  +    WebBridge *_previousSibling;
  +    NSMutableArray *_children;
  +
       WebFrame *_frame;
       WebCoreKeyboardUIMode _keyboardUIMode;
       BOOL _keyboardUIModeAccessed;
  @@ -45,7 +48,7 @@
       NSDictionary *lastDashboardRegions;
   }
   
  -- (id)initWithWebFrame:(WebFrame *)webFrame;
  +- (id)initWithFrameName:(NSString *)name view:(WebFrameView *)view ;
   - (void)close;
   
   - (void)receivedData:(NSData *)data textEncodingName:(NSString *)textEncodingName;
  @@ -54,4 +57,17 @@
   
   - (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
  
  
  
  1.383     +107 -8    WebKit/WebCoreSupport.subproj/WebBridge.m
  
  Index: WebBridge.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebBridge.m,v
  retrieving revision 1.382
  retrieving revision 1.383
  diff -u -r1.382 -r1.383
  --- WebBridge.m	30 Dec 2005 05:11:45 -0000	1.382
  +++ WebBridge.m	3 Jan 2006 05:15:20 -0000	1.383
  @@ -115,20 +115,17 @@
   
   @implementation WebBridge
   
  -- (id)initWithWebFrame:(WebFrame *)webFrame
  +- (id)initWithFrameName:(NSString *)name view:(WebFrameView *)view 
   {
       self = [super init];
   
       ++WebBridgeCount;
       
  -    WebView *webView = [webFrame webView];
  -    
  -    // Non-retained because data source owns representation owns bridge.
  -    // But WebFrame will call close on us before it goes away, which
  -    // guarantees we will not have a stale reference.
  -    _frame = webFrame;
  +    WebView *webView = [view _webView];
  +
  +    _frame = [[WebFrame alloc] _initWithName:name webFrameView:view webView:webView bridge:self];
   
  -    [self setName:[webFrame name]];
  +    [self setName:[_frame name]];
       [self initializeSettings:[webView _settings]];
       [self setTextSizeMultiplier:[webView textSizeMultiplier]];
   
  @@ -152,6 +149,8 @@
   - (void)dealloc
   {
       [lastDashboardRegions release];
  +    [_frame release];
  +    [_children release];
       
       [self fini];
       [super dealloc];
  @@ -641,6 +640,7 @@
   
   - (void)close
   {
  +    [_frame release];
       _frame = nil;
   }
   
  @@ -1726,4 +1726,103 @@
       [_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
  
  
  
  1.268     +38 -125   WebKit/WebView.subproj/WebFrame.m
  
  Index: WebFrame.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebFrame.m,v
  retrieving revision 1.267
  retrieving revision 1.268
  diff -u -r1.267 -r1.268
  --- WebFrame.m	30 Dec 2005 20:42:15 -0000	1.267
  +++ WebFrame.m	3 Jan 2006 05:15:21 -0000	1.268
  @@ -128,36 +128,6 @@
   
   @end
   
  - at interface NSArray (WebSafeMakePerform)
  -
  -- (void)_web_safeMakeObjectsPerformSelector:(SEL)aSelector;
  -
  - at end
  -
  -
  - at implementation NSArray (WebSafeMakePerform)
  -
  -- (void)_web_safeMakeObjectsPerformSelector:(SEL)aSelector
  -{
  -    unsigned count = [self count];
  -    if (0 == count)
  -        return;
  -
  -    if (count > 128) {
  -        [[self copy] makeObjectsPerformSelector:aSelector];
  -        return;
  -    }
  - 
  -    id batch[128];
  -    [self getObjects:batch range:NSMakeRange(0, count)];
  -    unsigned i;
  -    for (i = 0; i < count; i++) {
  -        objc_msgSend(batch[i], aSelector);
  -    }
  -}
  -
  - at end
  -
   // One day we might want to expand the use of this kind of class such that we'd receive one
   // over the bridge, and possibly hand it on through to the FormsDelegate.
   // Today it is just used internally to keep some state as we make our way through a bunch
  @@ -202,9 +172,6 @@
   @interface WebFramePrivate : NSObject
   {
   @public
  -    WebFrame *nextSibling;
  -    WebFrame *previousSibling;
  -
       NSString *name;
       WebFrameView *webFrameView;
       WebDataSource *dataSource;
  @@ -213,7 +180,6 @@
       WebView *webView;
       WebFrameState state;
       WebFrameLoadType loadType;
  -    NSMutableArray *children;
       WebHistoryItem *currentItem;	// BF item for our current content
       WebHistoryItem *provisionalItem;	// BF item for where we're trying to go
                                           // (only known when navigating to a pre-existing BF item)
  @@ -284,8 +250,6 @@
       [webFrameView release];
       [dataSource release];
       [provisionalDataSource release];
  -    [bridge release];
  -    [children release];
   
       [currentItem release];
       [provisionalItem release];
  @@ -378,94 +342,42 @@
   @implementation WebFrame (FrameTraversal)
   - (WebFrame *)_firstChildFrame
   {
  -    if (![_private->children count])
  -        return nil;
  -
  -    return [_private->children objectAtIndex:0];
  +    return [[[self _bridge] firstChild] webFrame];
   }
   
   - (WebFrame *)_lastChildFrame
   {
  -    return [_private->children lastObject];
  +    return [[[self _bridge] lastChild] webFrame];
   }
   
   - (unsigned)_childFrameCount
   {
  -    return [_private->children count];
  +    return [[self _bridge] childCount];
   }
   
   - (WebFrame *)_previousSiblingFrame;
   {
  -    return _private->previousSibling;
  +    return [[[self _bridge] previousSibling] webFrame];
   }
   
   - (WebFrame *)_nextSiblingFrame;
   {
  -    return _private->nextSibling;
  +    return [[[self _bridge] nextSibling] webFrame];
   }
   
   - (WebFrame *)_traverseNextFrameStayWithin:(WebFrame *)stayWithin
   {
  -    WebFrame *firstChild = [self _firstChildFrame];
  -    if (firstChild) {
  -        ASSERT(!stayWithin || [firstChild _isDescendantOfFrame:stayWithin]);
  -        return firstChild;
  -    }
  -
  -    if (self == stayWithin)
  -        return 0;
  -
  -    WebFrame *nextSibling = [self _nextSiblingFrame];
  -    if (nextSibling) {
  -        assert(!stayWithin || [nextSibling  _isDescendantOfFrame:stayWithin]);
  -	return nextSibling;
  -    }
  -
  -    WebFrame *frame = self;
  -    while (frame && !nextSibling && (!stayWithin || [frame parentFrame] != stayWithin)) {
  -        frame = [frame parentFrame];
  -        nextSibling = [frame _nextSiblingFrame];
  -    }
  -
  -    if (frame) {
  -        ASSERT(!stayWithin || !nextSibling || [nextSibling _isDescendantOfFrame:stayWithin]);
  -        return nextSibling;
  -    }
  -
  -    return nil;
  +    return [[[self _bridge] traverseNextFrameStayWithin:[stayWithin _bridge]] webFrame];
   }
   
   - (void)_appendChild:(WebFrame *)child
   {
  -    [[child _bridge] setParent:_private->bridge];
  -
  -    if (_private->children == nil)
  -        _private->children = [[NSMutableArray alloc] init];
  -
  -    WebFrame *previousFrame = [self _lastChildFrame];
  -    if (previousFrame) {
  -        previousFrame->_private->nextSibling = child;
  -        child->_private->previousSibling = previousFrame;
  -    }
  -    ASSERT(child->_private->nextSibling == nil);
  -
  -    [_private->children addObject:child];
  +    [[self _bridge] appendChild:[child _bridge]];
   }
   
   - (void)_removeChild:(WebFrame *)child
   {
  -    // move corresponding previous and next WebFrame sibling pointers to their new positions
  -    // when we remove a child we may have to reattach the previous frame's next frame and visa versa
  -    if (child->_private->previousSibling)
  -        child->_private->previousSibling->_private->nextSibling = child->_private->nextSibling;
  -    
  -    if (child->_private->nextSibling)
  -        child->_private->nextSibling->_private->previousSibling = child->_private->previousSibling; 
  -
  -    child->_private->previousSibling = nil;
  -    child->_private->nextSibling = nil;
  -
  -    [_private->children removeObject:child];
  +    [[self _bridge] removeChild:[child _bridge]];
   }
   
   @end
  @@ -655,11 +567,7 @@
   // FIXME: this exists only as a convenience for Safari, consider moving there
   - (BOOL)_isDescendantOfFrame:(WebFrame *)ancestor
   {
  -    for (WebFrame *frame = self; frame; frame = [frame parentFrame])
  -        if (frame == ancestor)
  -            return YES;
  -
  -    return NO;
  +    return [[self _bridge] isDescendantOfFrame:[ancestor _bridge]];
   }
   
   - (BOOL)_isFrameSet
  @@ -708,9 +616,9 @@
   
       [self retain]; // retain self temporarily because dealloc can re-enter this method
   
  -    [[self parentFrame] _removeChild:self];
       [bridge close];
  -    [bridge release];
  +    [[self parentFrame] _removeChild:self];
  +
       _private->bridge = nil;
   
       [self release];
  @@ -2657,6 +2565,29 @@
   
   @implementation WebFrame (WebInternal)
   
  +- (id)_initWithName:(NSString *)n webFrameView:(WebFrameView *)fv webView:(WebView *)v bridge:(WebBridge *)bridge
  +{
  +    self = [super init];
  +    if (!self)
  +        return nil;
  +
  +    _private = [[WebFramePrivate alloc] init];
  +
  +    [self _setWebView:v];
  +    [self _setName:n];
  +    _private->bridge = bridge;
  +
  +    if (fv) {
  +        [_private setWebFrameView:fv];
  +        [fv _setWebView:v];
  +        [fv _setWebFrame:self];
  +    }
  +    
  +    ++WebFrameCount;
  +    
  +    return self;
  +}
  +
   - (NSArray *)_documentViews
   {
       NSMutableArray *result = [NSMutableArray array];
  @@ -2976,33 +2907,15 @@
   
   @implementation WebFrame
   
  -- init
  +- (id)init
   {
       return [self initWithName:nil webFrameView:nil webView:nil];
   }
   
  -- initWithName:(NSString *)n webFrameView:(WebFrameView *)fv webView:(WebView *)v
  +// FIXME: this method can't work any more and should be marked deprecated
  +- (id)initWithName:(NSString *)n webFrameView:(WebFrameView *)fv webView:(WebView *)v
   {
  -    self = [super init];
  -    if (!self)
  -        return nil;
  -
  -    _private = [[WebFramePrivate alloc] init];
  -
  -    [self _setWebView:v];
  -    [self _setName:n];
  -
  -    _private->bridge = [[WebBridge alloc] initWithWebFrame:self];
  -    
  -    if (fv) {
  -        [_private setWebFrameView:fv];
  -        [fv _setWebView:v];
  -        [fv _setWebFrame:self];
  -    }
  -    
  -    ++WebFrameCount;
  -    
  -    return self;
  +    return [self _initWithName:n webFrameView:fv webView:v bridge:nil];
   }
   
   - (void)dealloc
  
  
  
  1.19      +1 -0      WebKit/WebView.subproj/WebFrameInternal.h
  
  Index: WebFrameInternal.h
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebFrameInternal.h,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- WebFrameInternal.h	25 Dec 2005 11:05:04 -0000	1.18
  +++ WebFrameInternal.h	3 Jan 2006 05:15:21 -0000	1.19
  @@ -58,6 +58,7 @@
   - (WebFrame *)_findFrameWithSelection;
   - (void)_clearSelectionInOtherFrames;
   - (BOOL)_subframeIsLoading;
  +- (id)_initWithName:(NSString *)n webFrameView:(WebFrameView *)fv webView:(WebView *)v bridge:(WebBridge *)bridge;
   
   @end
   
  
  
  
  1.324     +17 -16    WebKit/WebView.subproj/WebView.m
  
  Index: WebView.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebView.m,v
  retrieving revision 1.323
  retrieving revision 1.324
  diff -u -r1.323 -r1.324
  --- WebView.m	30 Dec 2005 05:11:47 -0000	1.323
  +++ WebView.m	3 Jan 2006 05:15:21 -0000	1.324
  @@ -207,7 +207,7 @@
   @interface WebViewPrivate : NSObject
   {
   @public
  -    WebFrame *mainFrame;
  +    WebBridge *mainFrameBridge;
       
       id UIDelegate;
       id UIDelegateForwarder;
  @@ -369,7 +369,7 @@
   
   - (void)dealloc
   {
  -    ASSERT(mainFrame == nil);
  +    ASSERT(mainFrameBridge == nil);
       ASSERT(draggingDocumentView == nil);
       ASSERT(dragCaretBridge == nil);
       
  @@ -540,9 +540,9 @@
       // To avoid leaks, call removeDragCaret in case it wasn't called after moveDragCaretToPoint.
       [self removeDragCaret];
       
  -    [_private->mainFrame _detachFromParent];
  -    [_private->mainFrame release];
  -    _private->mainFrame = nil;
  +    [[self mainFrame] _detachFromParent];
  +    [_private->mainFrameBridge release];
  +    _private->mainFrameBridge = nil;
       
       // Clear the page cache so we call destroy on all the plug-ins in the page cache to break any retain cycles.
       // See comment in [WebHistoryItem _releaseAllPendingPageCaches] for more information.
  @@ -561,15 +561,14 @@
       [childView _setWebView:self];
       [childView setAllowsScrolling:allowsScrolling];
       
  -    WebFrame *newFrame = [[WebFrame alloc] initWithName:fname webFrameView:childView webView:self];
  +    WebBridge *newBridge = [[WebBridge alloc] initWithFrameName:fname view:childView];
   
  -    [childView release];
  -
  -    [parent _addChild:newFrame];
  +    [parent _addChild:[newBridge webFrame]];
       
  -    [newFrame release];
  +    [childView release];
  +    [newBridge release];
           
  -    return newFrame;
  +    return [newBridge webFrame];
   }
   
   - (void)_finishedLoadingResourceFromDataSource:(WebDataSource *)dataSource
  @@ -691,7 +690,7 @@
       }
   
       _private->defersCallbacks = defers;
  -    [_private->mainFrame _defersCallbacksChanged];
  +    [[self mainFrame] _defersCallbacksChanged];
   }
   
   - (void)_setTopLevelFrameName:(NSString *)name
  @@ -1554,11 +1553,13 @@
   
       NSRect f = [self frame];
       WebFrameView *wv = [[WebFrameView alloc] initWithFrame: NSMakeRect(0,0,f.size.width,f.size.height)];
  +    [wv _setWebView:self];
       [wv setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
       [self addSubview: wv];
       [wv release];
   
  -    _private->mainFrame = [[WebFrame alloc] initWithName: frameName webFrameView: wv  webView: self];
  +    _private->mainFrameBridge = [[WebBridge alloc] initWithFrameName:frameName view:wv];
  +
       [self _addToAllWebViewsSet];
       [self setGroupName:groupName];
       
  @@ -1817,9 +1818,9 @@
   - (WebFrame *)mainFrame
   {
       // This can be called in initialization, before _private has been set up (3465613)
  -    if (_private != nil) {
  -        return _private->mainFrame;
  -    }
  +    if (_private != nil)
  +        return [_private->mainFrameBridge webFrame];
  +
       return nil;
   }
   
  
  
  



More information about the webkit-changes mailing list