Title: [95459] trunk/Source/WebKit/mac
Revision
95459
Author
ander...@apple.com
Date
2011-09-19 13:07:46 -0700 (Mon, 19 Sep 2011)

Log 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]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (95458 => 95459)


--- trunk/Source/WebKit/mac/ChangeLog	2011-09-19 19:46:42 UTC (rev 95458)
+++ trunk/Source/WebKit/mac/ChangeLog	2011-09-19 20:07:46 UTC (rev 95459)
@@ -1,5 +1,28 @@
 2011-09-19  Anders Carlsson  <ander...@apple.com>
 
+        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]):
+
+2011-09-19  Anders Carlsson  <ander...@apple.com>
+
         Remove calls to -[WebView _usesDocumentViews]
         https://bugs.webkit.org/show_bug.cgi?id=68377
 

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (95458 => 95459)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2011-09-19 19:46:42 UTC (rev 95458)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2011-09-19 20:07:46 UTC (rev 95459)
@@ -233,11 +233,6 @@
 
 bool WebFrameLoaderClient::hasHTMLView() const
 {
-    if (![getWebView(m_webFrame.get()) _usesDocumentViews]) {
-        // FIXME (Viewless): For now we just assume that all frames have an HTML view
-        return true;
-    }
-    
     NSView <WebDocumentView> *view = [m_webFrame->_private->webFrameView documentView];
     return [view isKindOfClass:[WebHTMLView class]];
 }
@@ -658,7 +653,7 @@
 void WebFrameLoaderClient::dispatchDidCommitLoad()
 {
     // Tell the client we've committed this URL.
-    ASSERT([m_webFrame->_private->webFrameView documentView] != nil || ![getWebView(m_webFrame.get()) _usesDocumentViews]);
+    ASSERT([m_webFrame->_private->webFrameView documentView] != nil);
     
     WebView *webView = getWebView(m_webFrame.get());   
     [webView _didCommitLoadForFrame:m_webFrame.get()];
@@ -1233,31 +1228,24 @@
 {
     WebView *webView = getWebView(m_webFrame.get());
     WebDataSource *dataSource = [m_webFrame.get() _dataSource];
-    bool usesDocumentViews = [webView _usesDocumentViews];
 
-    if (usesDocumentViews) {
-        // FIXME (Viewless): I assume we want the equivalent of this optimization for viewless mode too.
-        bool willProduceHTMLView = [m_webFrame->_private->webFrameView _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class];
-        bool canSkipCreation = core(m_webFrame.get())->loader()->stateMachine()->committingFirstRealLoad() && willProduceHTMLView;
-        if (canSkipCreation) {
-            [[m_webFrame->_private->webFrameView documentView] setDataSource:dataSource];
-            return;
-        }
-
-        // Don't suppress scrollbars before the view creation if we're making the view for a non-HTML view.
-        if (!willProduceHTMLView)
-            [[m_webFrame->_private->webFrameView _scrollView] setScrollBarsSuppressed:NO repaintOnUnsuppress:NO];
+    bool willProduceHTMLView = [m_webFrame->_private->webFrameView _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class];
+    bool canSkipCreation = core(m_webFrame.get())->loader()->stateMachine()->committingFirstRealLoad() && willProduceHTMLView;
+    if (canSkipCreation) {
+        [[m_webFrame->_private->webFrameView documentView] setDataSource:dataSource];
+        return;
     }
+
+    // Don't suppress scrollbars before the view creation if we're making the view for a non-HTML view.
+    if (!willProduceHTMLView)
+        [[m_webFrame->_private->webFrameView _scrollView] setScrollBarsSuppressed:NO repaintOnUnsuppress:NO];
     
     // clean up webkit plugin instances before WebHTMLView gets freed.
     [webView removePluginInstanceViewsFor:(m_webFrame.get())];
     
-    NSView <WebDocumentView> *documentView = nil;
-    if (usesDocumentViews) {
-        documentView = [m_webFrame->_private->webFrameView _makeDocumentViewForDataSource:dataSource];
-        if (!documentView)
-            return;
-    }
+    NSView <WebDocumentView> *documentView = [m_webFrame->_private->webFrameView _makeDocumentViewForDataSource:dataSource];
+    if (!documentView)
+        return;
 
     // FIXME: Could we skip some of this work for a top-level view that is not a WebHTMLView?
 
@@ -1268,38 +1256,30 @@
     if (isMainFrame && coreFrame->view())
         coreFrame->view()->setParentVisible(false);
     coreFrame->setView(0);
-    RefPtr<FrameView> coreView;
-    if (usesDocumentViews)
-        coreView = FrameView::create(coreFrame);
-    else
-        coreView = FrameView::create(coreFrame, IntSize([webView bounds].size));
+    RefPtr<FrameView> coreView = FrameView::create(coreFrame);
     coreFrame->setView(coreView);
 
     [m_webFrame.get() _updateBackgroundAndUpdatesWhileOffscreen];
+    [m_webFrame->_private->webFrameView _install];
 
-    if (usesDocumentViews)
-        [m_webFrame->_private->webFrameView _install];
-
     if (isMainFrame)
         coreView->setParentVisible(true);
 
-    if (usesDocumentViews) {
-        // Call setDataSource on the document view after it has been placed in the view hierarchy.
-        // This what we for the top-level view, so should do this for views in subframes as well.
-        [documentView setDataSource:dataSource];
+    // Call setDataSource on the document view after it has been placed in the view hierarchy.
+    // This what we for the top-level view, so should do this for views in subframes as well.
+    [documentView setDataSource:dataSource];
 
-        // The following is a no-op for WebHTMLRepresentation, but for custom document types
-        // like the ones that Safari uses for bookmarks it is the only way the DocumentLoader
-        // will get the proper title.
-        if (DocumentLoader* documentLoader = [dataSource _documentLoader])
-            documentLoader->setTitle(StringWithDirection([dataSource pageTitle], LTR));
-    }
+    // The following is a no-op for WebHTMLRepresentation, but for custom document types
+    // like the ones that Safari uses for bookmarks it is the only way the DocumentLoader
+    // will get the proper title.
+    if (DocumentLoader* documentLoader = [dataSource _documentLoader])
+        documentLoader->setTitle(StringWithDirection([dataSource pageTitle], LTR));
 
     if (HTMLFrameOwnerElement* owner = coreFrame->ownerElement())
         coreFrame->view()->setCanHaveScrollbars(owner->scrollingMode() != ScrollbarAlwaysOff);
         
     // If the document view implicitly became first responder, make sure to set the focused frame properly.
-    if (usesDocumentViews && [[documentView window] firstResponder] == documentView) {
+    if ([[documentView window] firstResponder] == documentView) {
         page->focusController()->setFocusedFrame(coreFrame);
         page->focusController()->setFocused(true);
     }
@@ -1420,7 +1400,7 @@
     
     ASSERT(m_webFrame);
     
-    WebFrameView *childView = [getWebView(m_webFrame.get()) _usesDocumentViews] ? [[WebFrameView alloc] init] : nil;
+    WebFrameView *childView = [[WebFrameView alloc] init];
     
     RefPtr<Frame> result = [WebFrame _createSubframeWithOwnerElement:ownerElement frameName:name frameView:childView];
     [childView release];

Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (95458 => 95459)


--- trunk/Source/WebKit/mac/WebView/WebFrame.mm	2011-09-19 19:46:42 UTC (rev 95458)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm	2011-09-19 20:07:46 UTC (rev 95459)
@@ -363,19 +363,17 @@
 
     Frame* coreFrame = _private->coreFrame;
     for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) {
-        if ([webView _usesDocumentViews]) {
-            // Don't call setDrawsBackground:YES here because it may be NO because of a load
-            // in progress; WebFrameLoaderClient keeps it set to NO during the load process.
-            WebFrame *webFrame = kit(frame);
-            if (!drawsBackground)
-                [[[webFrame frameView] _scrollView] setDrawsBackground:NO];
-            [[[webFrame frameView] _scrollView] setBackgroundColor:backgroundColor];
-            id documentView = [[webFrame frameView] documentView];
-            if ([documentView respondsToSelector:@selector(setDrawsBackground:)])
-                [documentView setDrawsBackground:drawsBackground];
-            if ([documentView respondsToSelector:@selector(setBackgroundColor:)])
-                [documentView setBackgroundColor:backgroundColor];
-        }
+        // Don't call setDrawsBackground:YES here because it may be NO because of a load
+        // in progress; WebFrameLoaderClient keeps it set to NO during the load process.
+        WebFrame *webFrame = kit(frame);
+        if (!drawsBackground)
+            [[[webFrame frameView] _scrollView] setDrawsBackground:NO];
+        [[[webFrame frameView] _scrollView] setBackgroundColor:backgroundColor];
+        id documentView = [[webFrame frameView] documentView];
+        if ([documentView respondsToSelector:@selector(setDrawsBackground:)])
+            [documentView setDrawsBackground:drawsBackground];
+        if ([documentView respondsToSelector:@selector(setBackgroundColor:)])
+            [documentView setBackgroundColor:backgroundColor];
 
         if (FrameView* view = frame->view()) {
             view->setTransparent(!drawsBackground);
@@ -415,27 +413,21 @@
 
 - (BOOL)_hasSelection
 {
-    if ([getWebView(self) _usesDocumentViews]) {
-        id documentView = [_private->webFrameView documentView];    
+    id documentView = [_private->webFrameView documentView];    
 
-        // optimization for common case to avoid creating potentially large selection string
-        if ([documentView isKindOfClass:[WebHTMLView class]])
-            if (Frame* coreFrame = _private->coreFrame)
-                return coreFrame->selection()->isRange();
+    // optimization for common case to avoid creating potentially large selection string
+    if ([documentView isKindOfClass:[WebHTMLView class]])
+        if (Frame* coreFrame = _private->coreFrame)
+            return coreFrame->selection()->isRange();
 
-        if ([documentView conformsToProtocol:@protocol(WebDocumentText)])
-            return [[documentView selectedString] length] > 0;
-        
-        return NO;
-    }
-
-    Frame* coreFrame = _private->coreFrame;
-    return coreFrame && coreFrame->selection()->isRange();
+    if ([documentView conformsToProtocol:@protocol(WebDocumentText)])
+        return [[documentView selectedString] length] > 0;
+    
+    return NO;
 }
 
 - (void)_clearSelection
 {
-    ASSERT([getWebView(self) _usesDocumentViews]);
     id documentView = [_private->webFrameView documentView];    
     if ([documentView conformsToProtocol:@protocol(WebDocumentText)])
         [documentView deselectAll];
@@ -545,11 +537,9 @@
         return NO;
 
     // If we're drawing into a bitmap, we might be snapshotting, or drawing into a layer-backed view.
-    if ([getWebView(self) _usesDocumentViews]) {
-        id documentView = [_private->webFrameView documentView];
-        if ([documentView isKindOfClass:[WebHTMLView class]] && [(WebHTMLView *)documentView _web_isDrawingIntoLayer])
-            return NO;
-    }
+    id documentView = [_private->webFrameView documentView];
+    if ([documentView isKindOfClass:[WebHTMLView class]] && [(WebHTMLView *)documentView _web_isDrawingIntoLayer])
+        return NO;
 
     return [getWebView(self) _includesFlattenedCompositingLayersWhenDrawingToBitmap];
 }
@@ -833,7 +823,6 @@
     FrameView* view = _private->coreFrame->view();
     if (!view)
         return;
-    ASSERT([getWebView(self) _usesDocumentViews]);
     // FIXME: These are fake modifier keys here, but they should be real ones instead.
     PlatformMouseEvent event(IntPoint(windowLoc), globalPoint(windowLoc, [view->platformWidget() window]),
         LeftButton, MouseEventMoved, 0, false, false, false, false, currentTime());
@@ -1411,7 +1400,6 @@
 
 - (WebFrameView *)frameView
 {
-    ASSERT(!getWebView(self) || [getWebView(self) _usesDocumentViews]);
     return _private->webFrameView;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to