Changeset 38245 in webkit


Ignore:
Timestamp:
Nov 9, 2008 12:19:54 PM (15 years ago)
Author:
Darin Adler
Message:

2008-11-09 Darin Adler <Darin Adler>

Reviewed by John Sullivan.

  • WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::frameLoadCompleted): Added comments, and got rid of a local variable to make this code match the code in the function below more closely. (WebFrameLoaderClient::provisionalLoadStarted): Added comments.
  • WebView/WebFrame.mm: (-[WebFrame _updateBackgroundAndUpdatesWhileOffscreen]): Improved comment.
  • WebView/WebFrameView.mm: (-[WebFrameView _scrollView]): Tweaked formatting. (-[WebFrameView initWithFrame:]): Ditto. (-[WebFrameView setFrameSize:]): Added a comment and tweaked formatting. (-[WebFrameView viewDidMoveToWindow]): Added. This is the change that fixes the bug. Calls setDrawsBackground:YES as appropriate since moving the view out of the window to switch to another view disrupts the special technique for showing the old page during the start of loading. This is the identical reason for the setFrameSize: method above, and the code is almost the same.
Location:
trunk/WebKit/mac
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/mac/ChangeLog

    r38235 r38245  
     12008-11-09  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by John Sullivan.
     4
     5        - fix https://bugs.webkit.org/show_bug.cgi?id=15063
     6          <rdar://problem/5452227> REGRESSION (r25151): Switching to a tab waiting
     7          for first data does not clear the window
     8
     9        * WebCoreSupport/WebFrameLoaderClient.mm:
     10        (WebFrameLoaderClient::frameLoadCompleted): Added comments, and got rid of
     11        a local variable to make this code match the code in the function below
     12        more closely.
     13        (WebFrameLoaderClient::provisionalLoadStarted): Added comments.
     14
     15        * WebView/WebFrame.mm:
     16        (-[WebFrame _updateBackgroundAndUpdatesWhileOffscreen]): Improved comment.
     17
     18        * WebView/WebFrameView.mm:
     19        (-[WebFrameView _scrollView]): Tweaked formatting.
     20        (-[WebFrameView initWithFrame:]): Ditto.
     21        (-[WebFrameView setFrameSize:]): Added a comment and tweaked formatting.
     22        (-[WebFrameView viewDidMoveToWindow]): Added. This is the change that fixes
     23        the bug. Calls setDrawsBackground:YES as appropriate since moving the view
     24        out of the window to switch to another view disrupts the special technique
     25        for showing the old page during the start of loading. This is the identical
     26        reason for the setFrameSize: method above, and the code is almost the same.
     27
    1282008-11-08  David Kilzer  <ddkilzer@apple.com>
    229
  • trunk/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r38110 r38245  
    801801{
    802802    // Note: Can be called multiple times.
     803
     804    // See WebFrameLoaderClient::provisionalLoadStarted.
     805    if ([getWebView(m_webFrame.get()) drawsBackground])
     806        [[m_webFrame->_private->webFrameView _scrollView] setDrawsBackground:YES];
     807
    803808    // Even if already complete, we might have set a previous item on a frame that
    804809    // didn't do any data loading on the past transaction. Make sure to clear these out.
    805     NSScrollView *sv = [m_webFrame->_private->webFrameView _scrollView];
    806     if ([getWebView(m_webFrame.get()) drawsBackground])
    807         [sv setDrawsBackground:YES];
    808810    core(m_webFrame.get())->loader()->setPreviousHistoryItem(0);
    809811}
     
    847849void WebFrameLoaderClient::provisionalLoadStarted()
    848850{   
    849     // FIXME: This is OK as long as no one resizes the window,
    850     // but in the case where someone does, it means garbage outside
    851     // the occupied part of the scroll view.
     851    // Tell the scroll view not to draw a background so we can leave the contents of
     852    // the old page showing during the beginning of the loading process.
     853
     854    // This will stay set to NO until:
     855    //    1) The load gets far enough along: WebFrameLoader::frameLoadCompleted.
     856    //    2) The window is resized: -[WebFrameView setFrameSize:].
     857    // or 3) The view is moved out of the window: -[WebFrameView viewDidMoveToWindow].
     858    // Please keep the comments in these four functions in agreement with each other.
     859
    852860    [[m_webFrame->_private->webFrameView _scrollView] setDrawsBackground:NO];
    853861}
  • trunk/WebKit/mac/WebView/WebFrame.mm

    r38235 r38245  
    374374    for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) {
    375375        WebFrame *webFrame = kit(frame);
    376         // Never call setDrawsBackground:YES here on the scroll view or the background color will
    377         // flash between pages loads. setDrawsBackground:YES will be called in _frameLoadCompleted.
     376        // Don't call setDrawsBackground:YES here because it may be NO because of a load
     377        // in progress; WebFrameLoaderClient keeps it set to NO during the load process.
    378378        if (!drawsBackground)
    379379            [[[webFrame frameView] _scrollView] setDrawsBackground:NO];
  • trunk/WebKit/mac/WebView/WebFrameView.mm

    r37371 r38245  
    190190- (WebDynamicScrollBarsView *)_scrollView
    191191{
    192     // this can be called by [super dealloc] when cleaning up the keyview loop,
     192    // This can be called by [super dealloc] when cleaning up the key view loop,
    193193    // after _private has been nilled out.
    194     if (_private == nil) {
     194    if (_private == nil)
    195195        return nil;
    196     }
    197196    return _private->frameScrollView;
    198197}
     
    301300        InitWebCoreSystemInterface();
    302301       
    303         // Need to tell WebCore what function to call for the
    304         // "History Item has Changed" notification
    305         // Note: We also do this in WebHistoryItem's init method
     302        // Need to tell WebCore what function to call for the "History Item has Changed" notification.
     303        // Note: We also do this in WebHistoryItem's init method.
    306304        WebCore::notifyHistoryItemChanged = WKNotifyHistoryItemChanged;
    307305
     
    311309        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    312310       
    313         // CoreGraphics deferred updates are disabled if WebKitEnableCoalescedUpdatesPreferenceKey is set
    314         // to NO, or has no value.  For compatibility with Mac OS X 10.4.6, deferred updates are OFF by
    315         // default.
     311        // CoreGraphics deferred updates are disabled if WebKitEnableCoalescedUpdatesPreferenceKey is NO
     312        // or has no value. For compatibility with Mac OS X 10.4.6, deferred updates are off by default.
    316313        if (![defaults boolForKey:WebKitEnableDeferredUpdatesPreferenceKey])
    317314            WKDisableCGDeferredUpdates();
     
    323320    _private = [[WebFrameViewPrivate alloc] init];
    324321
    325     WebDynamicScrollBarsView *scrollView  = [[WebDynamicScrollBarsView alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, frame.size.width, frame.size.height)];
     322    WebDynamicScrollBarsView *scrollView = [[WebDynamicScrollBarsView alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, frame.size.width, frame.size.height)];
    326323    _private->frameScrollView = scrollView;
    327324    [scrollView setContentView:[[[WebClipView alloc] initWithFrame:[scrollView bounds]] autorelease]];
     
    332329    [scrollView setLineScroll:40.0f];
    333330    [self addSubview:scrollView];
    334     // don't call our overridden version here; we need to make the standard NSView link between us
    335     // and our subview so that previousKeyView and previousValidKeyView work as expected. This works
    336     // together with our becomeFirstResponder and setNextKeyView overrides.
     331
     332    // Don't call our overridden version of setNextKeyView here; we need to make the standard NSView
     333    // link between us and our subview so that previousKeyView and previousValidKeyView work as expected.
     334    // This works together with our becomeFirstResponder and setNextKeyView overrides.
    337335    [super setNextKeyView:scrollView];
    338336   
     
    492490- (void)setFrameSize:(NSSize)size
    493491{
    494     if (!NSEqualSizes(size, [self frame].size) && [[[self webFrame] webView] drawsBackground]) {
     492    // See WebFrameLoaderClient::provisionalLoadStarted.
     493    if (!NSEqualSizes(size, [self frame].size) && [[[self webFrame] webView] drawsBackground])
    495494        [[self _scrollView] setDrawsBackground:YES];
    496     }
    497495    [super setFrameSize:size];
     496}
     497
     498- (void)viewDidMoveToWindow
     499{
     500    // See WebFrameLoaderClient::provisionalLoadStarted.
     501    if ([[[self webFrame] webView] drawsBackground])
     502        [[self _scrollView] setDrawsBackground:YES];
     503    [super viewDidMoveToWindow];
    498504}
    499505
Note: See TracChangeset for help on using the changeset viewer.