Changeset 95459 in webkit


Ignore:
Timestamp:
Sep 19, 2011 1:07:46 PM (13 years ago)
Author:
andersca@apple.com
Message:

Remove calls to -[WebView _usesDocumentViews] from WebFrameLoaderClient.mm
https://bugs.webkit.org/show_bug.cgi?id=68379

Reviewed by Adam Roben.

Remove checks and begin assuming that -[WebView _usesDocumentViews] always
returns true, since viewless WebKit1 has been abandoned.

  • WebCoreSupport/WebFrameLoaderClient.mm:

(WebFrameLoaderClient::hasHTMLView):
(WebFrameLoaderClient::dispatchDidCommitLoad):
(WebFrameLoaderClient::transitionToCommittedForNewPage):
(WebFrameLoaderClient::createFrame):

  • WebView/WebFrame.mm:

(-[WebFrame _updateBackgroundAndUpdatesWhileOffscreen]):
(-[WebFrame _hasSelection]):
(-[WebFrame _clearSelection]):
(-[WebFrame _shouldFlattenCompositingLayers:]):
(-[WebFrame _dragSourceEndedAt:operation:]):
(-[WebFrame frameView]):

Location:
trunk/Source/WebKit/mac
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/mac/ChangeLog

    r95458 r95459  
     12011-09-19  Anders Carlsson  <andersca@apple.com>
     2
     3        Remove calls to -[WebView _usesDocumentViews] from WebFrameLoaderClient.mm
     4        https://bugs.webkit.org/show_bug.cgi?id=68379
     5
     6        Reviewed by Adam Roben.
     7
     8        Remove checks and begin assuming that -[WebView _usesDocumentViews] always
     9        returns true, since viewless WebKit1 has been abandoned.
     10
     11        * WebCoreSupport/WebFrameLoaderClient.mm:
     12        (WebFrameLoaderClient::hasHTMLView):
     13        (WebFrameLoaderClient::dispatchDidCommitLoad):
     14        (WebFrameLoaderClient::transitionToCommittedForNewPage):
     15        (WebFrameLoaderClient::createFrame):
     16        * WebView/WebFrame.mm:
     17        (-[WebFrame _updateBackgroundAndUpdatesWhileOffscreen]):
     18        (-[WebFrame _hasSelection]):
     19        (-[WebFrame _clearSelection]):
     20        (-[WebFrame _shouldFlattenCompositingLayers:]):
     21        (-[WebFrame _dragSourceEndedAt:operation:]):
     22        (-[WebFrame frameView]):
     23
    1242011-09-19  Anders Carlsson  <andersca@apple.com>
    225
  • trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r95387 r95459  
    234234bool WebFrameLoaderClient::hasHTMLView() const
    235235{
    236     if (![getWebView(m_webFrame.get()) _usesDocumentViews]) {
    237         // FIXME (Viewless): For now we just assume that all frames have an HTML view
    238         return true;
    239     }
    240    
    241236    NSView <WebDocumentView> *view = [m_webFrame->_private->webFrameView documentView];
    242237    return [view isKindOfClass:[WebHTMLView class]];
     
    659654{
    660655    // Tell the client we've committed this URL.
    661     ASSERT([m_webFrame->_private->webFrameView documentView] != nil || ![getWebView(m_webFrame.get()) _usesDocumentViews]);
     656    ASSERT([m_webFrame->_private->webFrameView documentView] != nil);
    662657   
    663658    WebView *webView = getWebView(m_webFrame.get());   
     
    12341229    WebView *webView = getWebView(m_webFrame.get());
    12351230    WebDataSource *dataSource = [m_webFrame.get() _dataSource];
    1236     bool usesDocumentViews = [webView _usesDocumentViews];
    1237 
    1238     if (usesDocumentViews) {
    1239         // FIXME (Viewless): I assume we want the equivalent of this optimization for viewless mode too.
    1240         bool willProduceHTMLView = [m_webFrame->_private->webFrameView _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class];
    1241         bool canSkipCreation = core(m_webFrame.get())->loader()->stateMachine()->committingFirstRealLoad() && willProduceHTMLView;
    1242         if (canSkipCreation) {
    1243             [[m_webFrame->_private->webFrameView documentView] setDataSource:dataSource];
    1244             return;
    1245         }
    1246 
    1247         // Don't suppress scrollbars before the view creation if we're making the view for a non-HTML view.
    1248         if (!willProduceHTMLView)
    1249             [[m_webFrame->_private->webFrameView _scrollView] setScrollBarsSuppressed:NO repaintOnUnsuppress:NO];
    1250     }
     1231
     1232    bool willProduceHTMLView = [m_webFrame->_private->webFrameView _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class];
     1233    bool canSkipCreation = core(m_webFrame.get())->loader()->stateMachine()->committingFirstRealLoad() && willProduceHTMLView;
     1234    if (canSkipCreation) {
     1235        [[m_webFrame->_private->webFrameView documentView] setDataSource:dataSource];
     1236        return;
     1237    }
     1238
     1239    // Don't suppress scrollbars before the view creation if we're making the view for a non-HTML view.
     1240    if (!willProduceHTMLView)
     1241        [[m_webFrame->_private->webFrameView _scrollView] setScrollBarsSuppressed:NO repaintOnUnsuppress:NO];
    12511242   
    12521243    // clean up webkit plugin instances before WebHTMLView gets freed.
    12531244    [webView removePluginInstanceViewsFor:(m_webFrame.get())];
    12541245   
    1255     NSView <WebDocumentView> *documentView = nil;
    1256     if (usesDocumentViews) {
    1257         documentView = [m_webFrame->_private->webFrameView _makeDocumentViewForDataSource:dataSource];
    1258         if (!documentView)
    1259             return;
    1260     }
     1246    NSView <WebDocumentView> *documentView = [m_webFrame->_private->webFrameView _makeDocumentViewForDataSource:dataSource];
     1247    if (!documentView)
     1248        return;
    12611249
    12621250    // FIXME: Could we skip some of this work for a top-level view that is not a WebHTMLView?
     
    12691257        coreFrame->view()->setParentVisible(false);
    12701258    coreFrame->setView(0);
    1271     RefPtr<FrameView> coreView;
    1272     if (usesDocumentViews)
    1273         coreView = FrameView::create(coreFrame);
    1274     else
    1275         coreView = FrameView::create(coreFrame, IntSize([webView bounds].size));
     1259    RefPtr<FrameView> coreView = FrameView::create(coreFrame);
    12761260    coreFrame->setView(coreView);
    12771261
    12781262    [m_webFrame.get() _updateBackgroundAndUpdatesWhileOffscreen];
    1279 
    1280     if (usesDocumentViews)
    1281         [m_webFrame->_private->webFrameView _install];
     1263    [m_webFrame->_private->webFrameView _install];
    12821264
    12831265    if (isMainFrame)
    12841266        coreView->setParentVisible(true);
    12851267
    1286     if (usesDocumentViews) {
    1287         // Call setDataSource on the document view after it has been placed in the view hierarchy.
    1288         // This what we for the top-level view, so should do this for views in subframes as well.
    1289         [documentView setDataSource:dataSource];
    1290 
    1291         // The following is a no-op for WebHTMLRepresentation, but for custom document types
    1292         // like the ones that Safari uses for bookmarks it is the only way the DocumentLoader
    1293         // will get the proper title.
    1294         if (DocumentLoader* documentLoader = [dataSource _documentLoader])
    1295             documentLoader->setTitle(StringWithDirection([dataSource pageTitle], LTR));
    1296     }
     1268    // Call setDataSource on the document view after it has been placed in the view hierarchy.
     1269    // This what we for the top-level view, so should do this for views in subframes as well.
     1270    [documentView setDataSource:dataSource];
     1271
     1272    // The following is a no-op for WebHTMLRepresentation, but for custom document types
     1273    // like the ones that Safari uses for bookmarks it is the only way the DocumentLoader
     1274    // will get the proper title.
     1275    if (DocumentLoader* documentLoader = [dataSource _documentLoader])
     1276        documentLoader->setTitle(StringWithDirection([dataSource pageTitle], LTR));
    12971277
    12981278    if (HTMLFrameOwnerElement* owner = coreFrame->ownerElement())
     
    13001280       
    13011281    // If the document view implicitly became first responder, make sure to set the focused frame properly.
    1302     if (usesDocumentViews && [[documentView window] firstResponder] == documentView) {
     1282    if ([[documentView window] firstResponder] == documentView) {
    13031283        page->focusController()->setFocusedFrame(coreFrame);
    13041284        page->focusController()->setFocused(true);
     
    14211401    ASSERT(m_webFrame);
    14221402   
    1423     WebFrameView *childView = [getWebView(m_webFrame.get()) _usesDocumentViews] ? [[WebFrameView alloc] init] : nil;
     1403    WebFrameView *childView = [[WebFrameView alloc] init];
    14241404   
    14251405    RefPtr<Frame> result = [WebFrame _createSubframeWithOwnerElement:ownerElement frameName:name frameView:childView];
  • trunk/Source/WebKit/mac/WebView/WebFrame.mm

    r95271 r95459  
    364364    Frame* coreFrame = _private->coreFrame;
    365365    for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) {
    366         if ([webView _usesDocumentViews]) {
    367             // Don't call setDrawsBackground:YES here because it may be NO because of a load
    368             // in progress; WebFrameLoaderClient keeps it set to NO during the load process.
    369             WebFrame *webFrame = kit(frame);
    370             if (!drawsBackground)
    371                 [[[webFrame frameView] _scrollView] setDrawsBackground:NO];
    372             [[[webFrame frameView] _scrollView] setBackgroundColor:backgroundColor];
    373             id documentView = [[webFrame frameView] documentView];
    374             if ([documentView respondsToSelector:@selector(setDrawsBackground:)])
    375                 [documentView setDrawsBackground:drawsBackground];
    376             if ([documentView respondsToSelector:@selector(setBackgroundColor:)])
    377                 [documentView setBackgroundColor:backgroundColor];
    378         }
     366        // Don't call setDrawsBackground:YES here because it may be NO because of a load
     367        // in progress; WebFrameLoaderClient keeps it set to NO during the load process.
     368        WebFrame *webFrame = kit(frame);
     369        if (!drawsBackground)
     370            [[[webFrame frameView] _scrollView] setDrawsBackground:NO];
     371        [[[webFrame frameView] _scrollView] setBackgroundColor:backgroundColor];
     372        id documentView = [[webFrame frameView] documentView];
     373        if ([documentView respondsToSelector:@selector(setDrawsBackground:)])
     374            [documentView setDrawsBackground:drawsBackground];
     375        if ([documentView respondsToSelector:@selector(setBackgroundColor:)])
     376            [documentView setBackgroundColor:backgroundColor];
    379377
    380378        if (FrameView* view = frame->view()) {
     
    416414- (BOOL)_hasSelection
    417415{
    418     if ([getWebView(self) _usesDocumentViews]) {
    419         id documentView = [_private->webFrameView documentView];   
    420 
    421         // optimization for common case to avoid creating potentially large selection string
    422         if ([documentView isKindOfClass:[WebHTMLView class]])
    423             if (Frame* coreFrame = _private->coreFrame)
    424                 return coreFrame->selection()->isRange();
    425 
    426         if ([documentView conformsToProtocol:@protocol(WebDocumentText)])
    427             return [[documentView selectedString] length] > 0;
    428        
    429         return NO;
    430     }
    431 
    432     Frame* coreFrame = _private->coreFrame;
    433     return coreFrame && coreFrame->selection()->isRange();
     416    id documentView = [_private->webFrameView documentView];   
     417
     418    // optimization for common case to avoid creating potentially large selection string
     419    if ([documentView isKindOfClass:[WebHTMLView class]])
     420        if (Frame* coreFrame = _private->coreFrame)
     421            return coreFrame->selection()->isRange();
     422
     423    if ([documentView conformsToProtocol:@protocol(WebDocumentText)])
     424        return [[documentView selectedString] length] > 0;
     425   
     426    return NO;
    434427}
    435428
    436429- (void)_clearSelection
    437430{
    438     ASSERT([getWebView(self) _usesDocumentViews]);
    439431    id documentView = [_private->webFrameView documentView];   
    440432    if ([documentView conformsToProtocol:@protocol(WebDocumentText)])
     
    546538
    547539    // If we're drawing into a bitmap, we might be snapshotting, or drawing into a layer-backed view.
    548     if ([getWebView(self) _usesDocumentViews]) {
    549         id documentView = [_private->webFrameView documentView];
    550         if ([documentView isKindOfClass:[WebHTMLView class]] && [(WebHTMLView *)documentView _web_isDrawingIntoLayer])
    551             return NO;
    552     }
     540    id documentView = [_private->webFrameView documentView];
     541    if ([documentView isKindOfClass:[WebHTMLView class]] && [(WebHTMLView *)documentView _web_isDrawingIntoLayer])
     542        return NO;
    553543
    554544    return [getWebView(self) _includesFlattenedCompositingLayersWhenDrawingToBitmap];
     
    834824    if (!view)
    835825        return;
    836     ASSERT([getWebView(self) _usesDocumentViews]);
    837826    // FIXME: These are fake modifier keys here, but they should be real ones instead.
    838827    PlatformMouseEvent event(IntPoint(windowLoc), globalPoint(windowLoc, [view->platformWidget() window]),
     
    14121401- (WebFrameView *)frameView
    14131402{
    1414     ASSERT(!getWebView(self) || [getWebView(self) _usesDocumentViews]);
    14151403    return _private->webFrameView;
    14161404}
Note: See TracChangeset for help on using the changeset viewer.