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

Maciej mjs at opensource.apple.com
Tue Jan 3 17:02:56 PST 2006


mjs         06/01/03 17:02:56

  Modified:    .        ChangeLog
               kwq      WebCoreBridge.h WebCoreBridge.mm
               .        ChangeLog
               WebCoreSupport.subproj WebBridge.h WebBridge.m
               WebView.subproj WebFrame.m
  Log:
  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
  
  Revision  Changes    Path
  1.83      +22 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- ChangeLog	3 Jan 2006 23:21:21 -0000	1.82
  +++ ChangeLog	4 Jan 2006 01:02:43 -0000	1.83
  @@ -1,3 +1,25 @@
  +2006-01-03  Maciej Stachowiak  <mjs at 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 at apple.com>
   
           Reviewed by harrison
  
  
  
  1.358     +18 -0     WebCore/kwq/WebCoreBridge.h
  
  Index: WebCoreBridge.h
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/WebCoreBridge.h,v
  retrieving revision 1.357
  retrieving revision 1.358
  diff -u -r1.357 -r1.358
  --- WebCoreBridge.h	30 Dec 2005 05:11:37 -0000	1.357
  +++ WebCoreBridge.h	4 Jan 2006 01:02:44 -0000	1.358
  @@ -190,6 +190,12 @@
       KHTMLRenderPart *_renderPart;
       RenderArena *_renderPartArena;
       BOOL _shouldCreateRenderers;
  +
  +    WebCoreBridge *_nextSibling;
  +    WebCoreBridge *_previousSibling;
  +    WebCoreBridge *_firstChild;
  +    WebCoreBridge *_lastChild;
  +    int _childCount;
   }
   
   + (WebCoreBridge *)bridgeForDOMDocument:(DOMDocument *)document;
  @@ -209,6 +215,18 @@
   - (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
  
  
  
  1.448     +107 -0    WebCore/kwq/WebCoreBridge.mm
  
  Index: WebCoreBridge.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/WebCoreBridge.mm,v
  retrieving revision 1.447
  retrieving revision 1.448
  diff -u -r1.447 -r1.448
  --- WebCoreBridge.mm	3 Jan 2006 09:19:17 -0000	1.447
  +++ WebCoreBridge.mm	4 Jan 2006 01:02:44 -0000	1.448
  @@ -224,6 +224,113 @@
   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:
  
  
  
  1.3440    +22 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3439
  retrieving revision 1.3440
  diff -u -r1.3439 -r1.3440
  --- ChangeLog	3 Jan 2006 21:50:12 -0000	1.3439
  +++ ChangeLog	4 Jan 2006 01:02:45 -0000	1.3440
  @@ -1,3 +1,25 @@
  +2006-01-03  Maciej Stachowiak  <mjs at 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 at mac.com>
   
           Reviewed by Darin.
  
  
  
  1.32      +0 -17     WebKit/WebCoreSupport.subproj/WebBridge.h
  
  Index: WebBridge.h
  ===================================================================
  RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebBridge.h,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- WebBridge.h	3 Jan 2006 05:15:19 -0000	1.31
  +++ WebBridge.h	4 Jan 2006 01:02:54 -0000	1.32
  @@ -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
  
  
  
  1.384     +1 -101    WebKit/WebCoreSupport.subproj/WebBridge.m
  
  Index: WebBridge.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebBridge.m,v
  retrieving revision 1.383
  retrieving revision 1.384
  diff -u -r1.383 -r1.384
  --- WebBridge.m	3 Jan 2006 05:15:20 -0000	1.383
  +++ WebBridge.m	4 Jan 2006 01:02:54 -0000	1.384
  @@ -150,7 +150,6 @@
   {
       [lastDashboardRegions release];
       [_frame release];
  -    [_children release];
       
       [self fini];
       [super dealloc];
  @@ -788,7 +787,7 @@
       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 @@
       [_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.270     +10 -5     WebKit/WebView.subproj/WebFrame.m
  
  Index: WebFrame.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebFrame.m,v
  retrieving revision 1.269
  retrieving revision 1.270
  diff -u -r1.269 -r1.270
  --- WebFrame.m	3 Jan 2006 21:50:19 -0000	1.269
  +++ WebFrame.m	4 Jan 2006 01:02:55 -0000	1.270
  @@ -339,15 +339,20 @@
   
   @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 @@
   
   - (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
  
  
  



More information about the webkit-changes mailing list