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

John sullivan at opensource.apple.com
Tue Jul 19 10:11:57 PDT 2005


sullivan    05/07/19 10:11:56

  Modified:    .        ChangeLog
               WebCoreSupport.subproj WebBridge.m
               WebView.subproj WebFrame.m WebFrameInternal.h
  Log:
          Written by Trey Matteson  <trey at usa.net>
          Reviewed by John Sullivan.
  
          Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4049
            scroll position not restored when going back/forward at ebay
          Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4061
            When going back/forward to some pages, they redraw at top before restoring scroll position
  
          The short story is that attempting to restore the scroll position
          at the time when the first layout finishes addresses both of these
          issues.  An explanation of the underlying race condition is in
          a large comment near -_restoreScrollPosition.
  
          * WebCoreSupport.subproj/WebBridge.m:
          (-[WebBridge didFirstLayout]):  Pass through to WebFrame.
          * WebView.subproj/WebFrame.m:
          (-[WebFrame _transitionToCommitted:]):  Get rid of attempt to
            restoreScrollPosition that never did anything because the
            docView was always 0x0 size at that point.
          (-[WebFrame _opened]):  Get rid of redundant call to restoreScrollPosition.
            The imminent call to layoutCompleted makes the same call.
          (-[WebFrame _didFirstLayout]):  Restore the scroll position on
            first layout, if we're doing a b/f nav.
          * WebView.subproj/WebFrameInternal.h:
  
  Revision  Changes    Path
  1.3236    +27 -1     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3235
  retrieving revision 1.3236
  diff -u -r1.3235 -r1.3236
  --- ChangeLog	18 Jul 2005 23:18:19 -0000	1.3235
  +++ ChangeLog	19 Jul 2005 17:11:52 -0000	1.3236
  @@ -1,4 +1,31 @@
   2005-07-18  John Sullivan  <sullivan at apple.com>
  +        
  +        Written by Trey Matteson  <trey at usa.net>
  +        Reviewed by John Sullivan.
  +
  +        Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4049
  +          scroll position not restored when going back/forward at ebay
  +        Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4061
  +          When going back/forward to some pages, they redraw at top before restoring scroll position
  +
  +        The short story is that attempting to restore the scroll position
  +        at the time when the first layout finishes addresses both of these
  +        issues.  An explanation of the underlying race condition is in
  +        a large comment near -_restoreScrollPosition.
  +
  +        * WebCoreSupport.subproj/WebBridge.m:
  +        (-[WebBridge didFirstLayout]):  Pass through to WebFrame.
  +        * WebView.subproj/WebFrame.m:
  +        (-[WebFrame _transitionToCommitted:]):  Get rid of attempt to
  +          restoreScrollPosition that never did anything because the
  +          docView was always 0x0 size at that point.
  +        (-[WebFrame _opened]):  Get rid of redundant call to restoreScrollPosition.
  +          The imminent call to layoutCompleted makes the same call.
  +        (-[WebFrame _didFirstLayout]):  Restore the scroll position on
  +          first layout, if we're doing a b/f nav.
  +        * WebView.subproj/WebFrameInternal.h:
  +
  +2005-07-18  John Sullivan  <sullivan at apple.com>
   
           Reviewed by Darin Adler.
   
  @@ -1356,7 +1383,6 @@
   
           * WebView.subproj/WebUIDelegate.h: Fixed incorrect comment.
   
  ->>>>>>> 1.3131
   2005-05-01  Darin Adler  <darin at apple.com>
   
           - move to Xcode native targets and stop checking in generated files
  
  
  
  1.361     +1 -0      WebKit/WebCoreSupport.subproj/WebBridge.m
  
  Index: WebBridge.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebBridge.m,v
  retrieving revision 1.360
  retrieving revision 1.361
  diff -u -r1.360 -r1.361
  --- WebBridge.m	14 Jul 2005 23:52:54 -0000	1.360
  +++ WebBridge.m	19 Jul 2005 17:11:55 -0000	1.361
  @@ -1509,6 +1509,7 @@
   
   - (void)didFirstLayout
   {
  +    [_frame _didFirstLayout];
       WebView *wv = [_frame webView];
       [[wv _frameLoadDelegateForwarder] webView:wv didFirstLayoutInFrame:_frame];
   }
  
  
  
  1.243     +26 -7     WebKit/WebView.subproj/WebFrame.m
  
  Index: WebFrame.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebFrame.m,v
  retrieving revision 1.242
  retrieving revision 1.243
  diff -u -r1.242 -r1.243
  --- WebFrame.m	16 Jul 2005 05:53:04 -0000	1.242
  +++ WebFrame.m	19 Jul 2005 17:11:56 -0000	1.243
  @@ -178,7 +178,6 @@
   
   - (void)_saveScrollPositionToItem:(WebHistoryItem *)item;
   - (void)_restoreScrollPosition;
  -- (void)_scrollToTop;
   
   - (WebHistoryItem *)_createItem: (BOOL)useOriginal;
   - (WebHistoryItem *)_createItemTreeWithTargetFrame:(WebFrame *)targetFrame clippedAtTarget:(BOOL)doClip;
  @@ -794,10 +793,6 @@
                       }
                       else
                           [self _makeDocumentView];
  -                        
  -                    // FIXME - I'm not sure this call does anything.  Should be dealt with as
  -                    // part of 3024377
  -                    [self _restoreScrollPosition];
                   }
                   break;
   
  @@ -1069,8 +1064,7 @@
           }
           [view setNeedsLayout: YES];
           [view layout];
  -        [self _restoreScrollPosition];
  -        
  +
           NSArray *responses = [[self dataSource] _responses];
           NSURLResponse *response;
           int i, count = [responses count];
  @@ -2093,6 +2087,18 @@
       }
   }
   
  +/*
  +    There is a race condition between the layout and load completion that affects restoring the scroll position.
  +    We try to restore the scroll position at both the first layout and upon load completion.
  +
  +    1) If first layout happens before the load completes, we want to restore the scroll position then so that the
  +       first time we draw the page is already scrolled to the right place, instead of starting at the top and later
  +       jumping down.  It is possible that the old scroll position is past the part of the doc laid out so far, in
  +       which case the restore silent fails and we will fix it in when we try to restore on doc completion.
  +    2) If the layout happens after the load completes, the attempt to restore at load completion time silently
  +       fails.  We then successfully restore it when the layout happens.
  + */
  +
   - (void)_restoreScrollPosition
   {
       ASSERT([_private currentItem]);
  @@ -2702,6 +2708,19 @@
       [_private->children makeObjectsPerformSelector:@selector(_unmarkAllMisspellings)];
   }
   
  +- (void)_didFirstLayout
  +{
  +    if ([[self webView] backForwardList]) {
  +        WebFrameLoadType loadType = [self _loadType];
  +        if (loadType == WebFrameLoadTypeForward ||
  +            loadType == WebFrameLoadTypeBack ||
  +            loadType == WebFrameLoadTypeIndexedBackForward)
  +        {
  +            [self _restoreScrollPosition];
  +        }
  +    }
  +}
  +
   @end
   
   @implementation WebFormState : NSObject
  
  
  
  1.12      +1 -0      WebKit/WebView.subproj/WebFrameInternal.h
  
  Index: WebFrameInternal.h
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebFrameInternal.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- WebFrameInternal.h	14 Jul 2005 23:06:10 -0000	1.11
  +++ WebFrameInternal.h	19 Jul 2005 17:11:56 -0000	1.12
  @@ -36,6 +36,7 @@
   - (void)_setInternalLoadDelegate:(id)internalLoadDelegate;
   - (id)_internalLoadDelegate;
   - (void)_unmarkAllMisspellings;
  +- (void)_didFirstLayout;
   
   - (NSURLRequest *)_requestFromDelegateForRequest:(NSURLRequest *)request identifier:(id *)identifier error:(NSError **)error;
   - (void)_sendRemainingDelegateMessagesWithIdentifier:(id)identifier response:(NSURLResponse *)response length:(unsigned)length error:(NSError *)error;
  
  
  



More information about the webkit-changes mailing list